Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error has occured #37

Open
zlhdd108 opened this issue Dec 28, 2015 · 16 comments
Open

An error has occured #37

zlhdd108 opened this issue Dec 28, 2015 · 16 comments
Labels

Comments

@zlhdd108
Copy link

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

@abyssis
Copy link
Contributor

abyssis commented Jan 26, 2016

Anyone?

@zlhdd108
Copy link
Author

zlhdd108 commented Feb 1, 2016

yes

@nerdbaggy nerdbaggy added the bug label Feb 3, 2016
@nerdbaggy
Copy link
Owner

Any errors in your webserver logs?

@KaugummiAutomat
Copy link

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

@lduer
Copy link

lduer commented Feb 19, 2016

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

@hocoding
Copy link

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?

@lduer
Copy link

lduer commented Feb 21, 2016

@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

@hocoding
Copy link

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

@lduer
Copy link

lduer commented Feb 22, 2016

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

@Zillionx
Copy link

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

@Chris6284
Copy link

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;

}

@Zillionx
Copy link

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 #37 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ACS6q9u2u3UGuPN4pA5DjRXAiUH3lGDpks5qXJ6AgaJpZM4G77FD.

@yylzcom
Copy link

yylzcom commented Jul 20, 2016

@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

@wang259797
Copy link

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

@hocoding
Copy link

hocoding commented Aug 6, 2016

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

@TomasHurtz
Copy link

TomasHurtz commented May 3, 2017

How do you restrict to say 3 monitors ?

(edit - found answers here #27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests