Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Poduptime
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
Poduptime
Commits
2402c1a9
Commit
2402c1a9
authored
Nov 28, 2016
by
dmorley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move to v2 api for uptimerobot
parent
a5d68080
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
db/showuptimerobot.php
db/showuptimerobot.php
+16
-15
showmap.php
showmap.php
+1
-0
No files found.
db/showuptimerobot.php
View file @
2402c1a9
...
...
@@ -10,27 +10,28 @@ $result = pg_query_params($dbh, $sql, array($domain));
if
(
!
$result
)
{
die
(
"Error in SQL query: "
.
pg_last_error
());}
$apikey
=
pg_fetch_all
(
$result
);
$upti
=
curl_init
();
$curlurl
=
"https://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&responseTimes=1&responseTimesAverage=86400&apiKey="
.
$apikey
[
0
][
'pingdomurl'
];
curl_setopt
(
$upti
,
CURLOPT_URL
,
$curlurl
);
$key
=
$apikey
[
0
][
"pingdomurl"
];
$data
=
array
(
'all_time_uptime_ratio'
=>
1
,
'format'
=>
'json'
,
'custom_uptime_ratios'
=>
'7-30-60-90'
,
'response_times'
=>
1
,
'response_times_average'
=>
86400
,
'api_key'
=>
$key
,
'callback'
=>
'jsonpUptimeRobot'
);
curl_setopt
(
$upti
,
CURLOPT_URL
,
"https://api.uptimerobot.com/v2/getMonitors"
);
curl_setopt
(
$upti
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$upti
,
CURLOPT_POST
,
1
);
curl_setopt
(
$upti
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$data
));
curl_setopt
(
$upti
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$upti
,
CURLOPT_CONNECTTIMEOUT
,
8
);
curl_setopt
(
$upti
,
CURLOPT_FOLLOWLOCATION
,
true
);
$uptimerobot
=
curl_exec
(
$upti
);
curl_close
(
$upti
);
$json_encap
=
"json
UptimeRobotApi
()"
;
$up2
=
substr
(
$uptimerobot
,
strlen
(
$json_encap
)
-
1
,
strlen
(
$uptimerobot
)
-
strlen
(
$json_encap
));
$uptr
=
json_decode
(
$up2
);
$json_encap
=
"json
pUptimeRobot
()"
;
$up2
=
substr
(
$uptimerobot
,
strlen
(
$json_encap
)
-
1
,
strlen
(
$uptimerobot
)
-
strlen
(
$json_encap
));
$uptr
=
json_decode
(
$up2
);
echo
"<b>UptimeRobot Json displayed in Human</b><br><br>"
;
echo
"Name: "
.
$uptr
->
monitors
->
monitor
{
'0'
}
->
friendly
name
.
"<br>"
;
echo
"Url: "
.
$uptr
->
monitors
->
monitor
{
'0'
}
->
url
.
"<br>"
;
echo
"Interval: "
.
$uptr
->
monitors
->
monitor
{
'0'
}
->
interval
.
"ms<br>"
;
echo
"Uptime: "
.
$uptr
->
monitors
->
monitor
{
'0'
}
->
alltimeuptime
ratio
.
"%<br>"
;
echo
"Response Time: "
.
$uptr
->
monitors
->
monitor
{
'0'
}
->
responsetime
{
'0'
}
->
value
.
"ms<br>"
;
if
(
$uptr
->
monitors
->
monitor
{
'0'
}
->
status
==
2
)
{
$live
=
"Up"
;}
if
(
$uptr
->
monitors
->
monitor
{
'0'
}
->
status
==
0
)
{
$live
=
"Paused"
;}
if
(
$uptr
->
monitors
->
monitor
{
'0'
}
->
status
==
1
)
{
$live
=
"Not Checked Yet"
;}
if
(
$uptr
->
monitors
->
monitor
{
'0'
}
->
status
==
8
)
{
$live
=
"Seems Down"
;}
if
(
$uptr
->
monitors
->
monitor
{
'0'
}
->
status
==
9
)
{
$live
=
"Down"
;}
echo
"Name: "
.
$uptr
->
monitors
[
0
]
->
friendly_
name
.
"<br>"
;
echo
"Url: "
.
$uptr
->
monitors
[
0
]
->
url
.
"<br>"
;
echo
"Interval: "
.
$uptr
->
monitors
[
0
]
->
interval
.
"ms<br>"
;
echo
"Uptime: "
.
$uptr
->
monitors
[
0
]
->
all_time_uptime_
ratio
.
"%<br>"
;
echo
"Response Time: "
.
round
(
$uptr
->
monitors
[
0
]
->
average_response_time
)
.
"ms<br>"
;
if
(
$uptr
->
monitors
[
0
]
->
status
==
2
)
{
$live
=
"Up"
;}
if
(
$uptr
->
monitors
[
0
]
->
status
==
0
)
{
$live
=
"Paused"
;}
if
(
$uptr
->
monitors
[
0
]
->
status
==
1
)
{
$live
=
"Not Checked Yet"
;}
if
(
$uptr
->
monitors
[
0
]
->
status
==
8
)
{
$live
=
"Seems Down"
;}
if
(
$uptr
->
monitors
[
0
]
->
status
==
9
)
{
$live
=
"Down"
;}
echo
"Status: "
.
$live
;
pg_free_result
(
$result
);
pg_close
(
$dbh
);
?>
showmap.php
View file @
2402c1a9
Show as:
<a
href=
"?mapview=true"
>
Map
</a>
<a
href=
"/"
>
Simple Table
</a>
<a
href=
"?advancedview=true"
>
Advanced Table
</a>
<?php
//focus map to the users side of the globe
$country_code
=
$_SERVER
[
"HTTP_CF_IPCOUNTRY"
];
$csv
=
array_map
(
'str_getcsv'
,
file
(
'db/country_latlon.csv'
));
foreach
(
$csv
as
$cords
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment