Commit 4443da59 authored by root's avatar root

fix number for percent in table add config example

parent a7368eb6
......@@ -54,7 +54,7 @@ elseif ($_GET['format'] == "json") {
print json_encode($obj);
} else {
$i=0;
$sql = "SELECT * FROM pods WHERE hidden <> 'yes' ORDER BY uptimelast7 ASC";
$sql = "SELECT * FROM pods WHERE hidden <> 'yes' ORDER BY uptimelast7 DESC";
$result = pg_query($dbh, $sql);
if (!$result) {
die("Error in SQL query: " . pg_last_error());
......@@ -63,7 +63,7 @@ elseif ($_GET['format'] == "json") {
while ($row = pg_fetch_array($result)) {
if ($row["status"] == "up"){$status="Online";}else{$status="Offline";}
if ($row["secure"] == "true") {$method = "https://";$class="green";} else {$method = "http://";$class="red";}
echo $row["domain"] ." Up ".$row["uptimelast7"]." This Month - Located in: ".$row["country"];
echo $row["domain"] ." Up ".$row["uptimelast7"]."% This Month - Located in: ".$row["country"];
if ($i < ($numrows -1)) {
echo ",";
}
......
<?php
/* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
$pguser='';
$pgpass='';
$pgdb='';
$geouser='';
$geokey='';
$adminemail = '';
$adminkey = '';
$chimpkey = '';
$apikey= '';
?>
......@@ -254,7 +254,7 @@ else {$live="error";$score=$score-2;}
$up2 = substr ($uptimerobot, strlen($json_encap) - 1, strlen ($uptimerobot) - strlen($json_encap));
$uptr = json_decode($up2);
$responsetime = 'n/a';
$uptime = $uptr->monitors->monitor{'0'}->alltimeuptimeratio."%";
$uptime = $uptr->monitors->monitor{'0'}->alltimeuptimeratio;
$diff = abs(strtotime(date('Y-m-d H:i:s')) - strtotime($dateadded));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
if ($uptr->monitors->monitor{'0'}->status == 2) {$live = "Up";}
......
......@@ -26,7 +26,7 @@ CREATE TABLE pods (
pingdomurl text,
pingdomlast text,
monthsmonitored int,
uptimelast7 numeric{3,3},
uptimelast7 numeric(5,2),
status text,
responsetimelast7 text,
dateUpdated timestamp DEFAULT current_timestamp,
......
......@@ -44,7 +44,7 @@ $tip="This pod does not offer SSL";
$verdiff = str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
$tip.="\n This pod {$row["domain"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]} this month and was last checked on {$row["dateupdated"]}. ";
$tip.="\n This pod {$row["domain"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. ";
$tip.="Code base is {$row["shortversion"]} and the current github base is {$row["masterversion"]}. ";
$tip.="This pod is {$verdiff} versions behind the current code. This pods IP {$row["ip"]} has IPv6 {$row["ipv6"]} and is located in {$row["country"]}. On a score of -20 to +20 this pod is a {$row["score"]} right now, all data is checked every hour.";
......@@ -63,7 +63,7 @@ else
{$version=$row["shortversion"];$pre="This pod runs production code";}
if ($row["shortversion"] == $row["masterversion"] && $row["shortversion"] != "") {$classver = "green";} elseif ($verdiff > 6) {$classver = "red";} else {$classver = "black";}
echo "<td class='$classver'><div title='{$pre} codename: {$row["longversion"]} master version is: {$row["masterversion"]}' class='tipsy'>{$version}</div></td>";
echo "<td>" . $row["uptimelast7"] . "</td>";
echo "<td>" . $row["uptimelast7"] . "%</td>";
if (strpos($row["pingdomurl"], "pingdom.com")) {$moreurl = $row["pingdomurl"];} else {$moreurl = "http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=".$row["pingdomurl"];}
echo "<td><div title='Last Check ".$row["dateupdated"]."' class='tipsy'><a target='new' href='".$moreurl."'>" . $row["monthsmonitored"] . "</a></div></td>";
if ($row["userrating"] >6) {$userratingclass="green";} elseif ($row["userrating"] <7) {$userratingclass="yellow";} elseif ($row["userrating"] <3) {$userratingclass="red";}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment