StatusPage
StatusPage copied to clipboard
An error has occured
I am getting the error below:
If i run the API call manually it all works fine - but the public page always returns this error :(
this is on a LNMP, I use Debian
Anyone?
yes
Any errors in your webserver logs?
Hello, i get the Same error. PHP Log File:
`[15-Feb-2016 07:49:34 UTC] PHP Notice: Undefined variable: allCheckID in C:\xampp\htdocs\status\build\statuspage\statusPage.php on line 103
[15-Feb-2016 07:49:34 UTC] PHP Notice: Undefined variable: allCheckInfo in C:\xampp\htdocs\status\build\statuspage\statusPage.php on line 41 `
I am using : Windows Server 2012 and Xampp
The variables are missing (undefined) if there are no monitors/accounts connected and therefore no loops accessed.
I've added the missing variable definitions in my PR #38
Here is another error I got from the check.php: `Warning: Invalid argument supplied for foreach() in /web/statuspage/statusPage.php on line 49
Warning: Invalid argument supplied for foreach() in /web/statuspage/statusPage.php on line 23 StatusPage({"headers":["Past 24 Hours","Past Week","Past Month","Past Year","Total"],"checks":null})`
How do I fix this?
@timhal15 do you use the contents from /backend/statuspage
or /build/statuspage
? The backend-Files are out of date. Also my update only includes the build-files.
Have you checked out my fix (https://github.com/lduer/StatusPage/tree/fix_issue34
)? The PR is not yet merged and the released zip-archive therefore not updated.
Your warning from L49 occures when the variable contains no monitors. This is already fixed in the build/statuspage/statusPage.php#L51
@lduer yes I use the file you fixed, the unhappy face no longer exist. But still nothing shows up.... Got the error reported: `Uncaught TypeError: Cannot read property 'log' of undefined
$.ajax.success @ statuspage.min.js:41 u @ statuspage.min.js:31 c.fireWith @ statuspage.min.js:31 n @ statuspage.min.js:32 (anonymous function) @ statuspage.min.js:32 `
could you please paste the response you get from the check.php
, when it is called via ajax-request from the index?
I've tried with /build/statuspage
but error is the same on line 23 and 49.
The response from my check.php is the following:
StatusPage({"headers":["Past 24 Hours","Past Week","Past Month","Past Year","Total"],"checks":null})
thx
Quickfix: (works for me) /statuspage/statusPage.php Replace getChecksJson() Replace API-KEY with your own Api-Key
private function getChecksJson($action) { $apiKey = constant('apiKey'); $historyDay = constant('historyDay');
$url = 'https://api.uptimerobot.com/getMonitors?apikey=API-KEY&format=json&noJsonCallback=1&customUptimeRatio=1-7-30-360';
if ($action){
$url .= '&logs=1&responseTimes=1&responseTimesAverage=30&showTimezone=1';
}
if (constant('includedMonitors') != '') {
$monitors = constant('includedMonitors');
$url .= "&monitors=$monitors";
}
if (constant('searchMonitors') != '') {
$search = constant('searchMonitors');
$url .= "&search=$search";
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
#CURLOPT_USERAGENT => 'UptimeRobot Public Status Page',
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_CONNECTTIMEOUT => 15
));
$checks = json_decode(curl_exec($curl), TRUE);
//Checks to make sure curl is happy
if (curl_errno($curl)) {
return False;
}
curl_close($curl);
//Checks to make sure UptimeRobot didn't return any errors
if ($checks['stat'] != 'ok') {
error_log('UptimeRobot API Error - ' . $checks['message']);
return False;
}
return $checks;
}
work very fine, thank You
On 19 Jul 2016, at 11:53, Chris6284 [email protected] wrote:
Quickfix: (works for me) /statuspage/statusPage.php Replace getChecksJson() Replace API-KEY with your own Api-Key
private function getChecksJson($action) { $apiKey = constant('apiKey'); $historyDay = constant('historyDay');
$url = 'https://api.uptimerobot.com/getMonitors?apikey=API-KEY&format=json&noJsonCallback=1&customUptimeRatio=1-7-30-360';
if ($action){
$url .= '&logs=1&responseTimes=1&responseTimesAverage=30&showTimezone=1';
}
if (constant('includedMonitors') != '') { $monitors = constant('includedMonitors'); $url .= "&monitors=$monitors"; }
if (constant('searchMonitors') != '') { $search = constant('searchMonitors'); $url .= "&search=$search"; }
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url, #CURLOPT_USERAGENT => 'UptimeRobot Public Status Page', CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_CONNECTTIMEOUT => 15 ));
$checks = json_decode(curl_exec($curl), TRUE); //Checks to make sure curl is happy if (curl_errno($curl)) { return False; } curl_close($curl);
//Checks to make sure UptimeRobot didn't return any errors
if ($checks['stat'] != 'ok') { error_log('UptimeRobot API Error - ' . $checks['message']); return False; }
return $checks; }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nerdbaggy/StatusPage/issues/37#issuecomment-233584705, or mute the thread https://github.com/notifications/unsubscribe-auth/ACS6q9u2u3UGuPN4pA5DjRXAiUH3lGDpks5qXJ6AgaJpZM4G77FD.
@Zillionx @Chris6284 Works fine for me, however, is there any way to use not modifying this file(use the apikey setted in config.php instead)?
Thanks
where Replace getChecksJson() and Replace API-KEY with your own Api-Key ? thx
@wang259797 I guess what he/she mean was that, well, check the following line:
$url = 'https://api.uptimerobot.com/getMonitors?apikey=API-KEY&format=json&noJsonCallback=1&customUptimeRatio=1-7-30-360';
You gotta to get your own API-KEY from uptimebot, which will generate one for you in the dashboard. Copy and paste that key and place them after "apikey="
How do you restrict to say 3 monitors ?
(edit - found answers here https://github.com/nerdbaggy/StatusPage/issues/27)