StatusPage icon indicating copy to clipboard operation
StatusPage copied to clipboard

An error has occured

Open zlhdd108 opened this issue 9 years ago • 16 comments

I am getting the error below: testj 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

zlhdd108 avatar Dec 28 '15 16:12 zlhdd108

Anyone?

abyssis avatar Jan 26 '16 10:01 abyssis

yes

zlhdd108 avatar Feb 01 '16 06:02 zlhdd108

Any errors in your webserver logs?

nerdbaggy avatar Feb 03 '16 15:02 nerdbaggy

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

KaugummiAutomat avatar Feb 15 '16 07:02 KaugummiAutomat

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

lduer avatar Feb 19 '16 15:02 lduer

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?

hocoding avatar Feb 21 '16 06:02 hocoding

@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 avatar Feb 21 '16 13:02 lduer

@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 `

hocoding avatar Feb 22 '16 00:02 hocoding

could you please paste the response you get from the check.php, when it is called via ajax-request from the index?

lduer avatar Feb 22 '16 06:02 lduer

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

Zillionx avatar May 18 '16 17:05 Zillionx

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;

}

Chris6284 avatar Jul 19 '16 09:07 Chris6284

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 avatar Jul 19 '16 16:07 Zillionx

@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

yylzcom avatar Jul 20 '16 02:07 yylzcom

where Replace getChecksJson() and Replace API-KEY with your own Api-Key ? thx

wang259797 avatar Aug 04 '16 11:08 wang259797

@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="

hocoding avatar Aug 06 '16 10:08 hocoding

How do you restrict to say 3 monitors ?

(edit - found answers here https://github.com/nerdbaggy/StatusPage/issues/27)

TomasHurtz avatar May 03 '17 05:05 TomasHurtz