Giter Site home page Giter Site logo

An error has occured about statuspage HOT 16 OPEN

nerdbaggy avatar nerdbaggy commented on July 18, 2024
An error has occured

from statuspage.

Comments (16)

Chris6284 avatar Chris6284 commented on July 18, 2024 1

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;

}

from statuspage.

abyssis avatar abyssis commented on July 18, 2024

Anyone?

from statuspage.

zlhdd108 avatar zlhdd108 commented on July 18, 2024

yes

from statuspage.

nerdbaggy avatar nerdbaggy commented on July 18, 2024

Any errors in your webserver logs?

from statuspage.

KaugummiAutomat avatar KaugummiAutomat commented on July 18, 2024

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

from statuspage.

lduer avatar lduer commented on July 18, 2024

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

from statuspage.

hocoding avatar hocoding commented on July 18, 2024

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?

from statuspage.

lduer avatar lduer commented on July 18, 2024

@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

from statuspage.

hocoding avatar hocoding commented on July 18, 2024

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

from statuspage.

lduer avatar lduer commented on July 18, 2024

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

from statuspage.

Zillionx avatar Zillionx commented on July 18, 2024

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

from statuspage.

Zillionx avatar Zillionx commented on July 18, 2024

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.

from statuspage.

yylzcom avatar yylzcom commented on July 18, 2024

@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

from statuspage.

wang259797 avatar wang259797 commented on July 18, 2024

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

from statuspage.

hocoding avatar hocoding commented on July 18, 2024

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

from statuspage.

TomasHurtz avatar TomasHurtz commented on July 18, 2024

How do you restrict to say 3 monitors ?

(edit - found answers here #27)

from statuspage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.