For any down host it adds text for how long it's been down for. Sure you can get the Last Fail time by hovering your mouse over any monitored system icon, but I thought it might be nice to have the downtime of a down host shown on the main page.
What you need to modify is the ./plugins/monitor/monitor.php. Find,
Code: Select all
$s = $s2 = '';
if ($status < 2) {
// If the host is down, we bold the name
$s = '<b>';
$s2 = '</b>';
Code: Select all
// If the host is down, make a downtime since message
$dt = "";
$sfd = time() - strtotime($row['status_fail_date']);
$dt_d = floor($sfd/86400);
$dt_h = floor(($sfd - ($dt_d * 86400))/3600);
$dt_m = floor(($sfd - ($dt_d * 86400) - ($dt_h * 3600))/60);
$dt_s = $sfd - ($dt_d * 86400) - ($dt_h * 3600) - ($dt_m * 60);
if ($dt_d > 0 ) {
$dt .= $dt_d . " days<br>" . $dt_h . " hours<br>" . $dt_m . " minutes<br>" . $dt_s . " seconds";
} elseif ($dt_h > 0 ) {
$dt .= $dt_h . " hours<br>" . $dt_m . " minutes<br>" . $dt_s . " seconds";
} elseif ($dt_m > 0 ) {
$dt .= $dt_m . " minutes<br>" . $dt_s . " seconds";
} else {
$dt .= $dt_s . " seconds";
}
Code: Select all
print "<td valign=top><center>
<a href=$anchor>
<img src='images/$i' name='$name' id='$name' onmouseover=\"return escape('$title')\" border='0'><br>
<font color='black'>$s$name$s2</font>
</a></center></td>\n";
Code: Select all
if ($status < 2) {
print "<td valign=top><center>
<a href=$anchor>
<img src='images/$i' name='$name' id='$name' onmouseover=\"return escape('$title')\" border='0'><br>
<font color='black'>$s$name$s2</font><br><font color='red'>$s$dt$s2</font>
</a></center></td>\n";
} else {
print "<td valign=top><center>
<a href=$anchor>
<img src='images/$i' name='$name' id='$name' onmouseover=\"return escape('$title')\" border='0'><br>
<font color='black'>$s$name$s2</font>
</a></center></td>\n";
}