fix service graphs, add CISCO-PRODUCT-MIB

git-svn-id: http://www.observium.org/svn/observer/trunk@1655 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-08-10 12:16:00 +00:00
parent a69d2936ca
commit 8297e6aa5e
6 changed files with 1144 additions and 16 deletions

View File

@@ -0,0 +1,20 @@
<?
if(is_numeric($id))
{
$service = mysql_fetch_assoc(mysql_query("SELECT * FROM services WHERE service_id = '".mres($id)."'"));
if(is_numeric($service['device_id']) && device_permitted($service['device_id']))
{
$device = device_by_id_cache($service['device_id']);
### This doesn't quite work for all yet.
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd");
$title = generate_device_link($device);
$title .= " :: Service :: " . htmlentities($service['service_type']);
$auth = TRUE;
}
}
?>

View File

@@ -5,18 +5,10 @@ $scale_max = "1";
include("includes/graphs/common.inc.php");
$iter = "1";
$sql = "SELECT * FROM `services` AS S, `devices` AS D where S.`service_id` = '".mres($_GET['id'])."' AND S.device_id = D.device_id";
$query = mysql_query($sql);
$service = mysql_fetch_array($query);
$service_text = substr(str_pad($service['service_type'], 28),0,28);
$rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd");
$rrd_options .= " COMMENT:' Cur Avail\\n'";
$rrd_options .= " DEF:status=$rrd:status:AVERAGE";
$rrd_options .= " DEF:status=$rrd_filename:status:AVERAGE";
$rrd_options .= " CDEF:percent=status,100,*";
$rrd_options .= " CDEF:down=status,1,LT,status,UNKN,IF";
$rrd_options .= " CDEF:percentdown=down,100,*";

View File

@@ -21,10 +21,10 @@ if(!$samehost) {
$checked = formatUptime($checked);
} else { $checked = "Never"; }
$mini_url = $config['base_url'] . "/graph.php?id=".$service['service_id']."&type=service&from=".$day."&to=".$now."&width=80&height=20&bg=efefef";
$mini_url = $config['base_url'] . "/graph.php?id=".$service['service_id']."&type=service_availability&from=".$day."&to=".$now."&width=80&height=20&bg=efefef";
$popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$service['service_type'];
$popup .= "</div><img src=\'".$config['base_url']."/graph.php?id=" . $service['service_id'] . "&type=service&from=$day&to=$now&width=400&height=125\'>";
$popup .= "</div><img src=\'".$config['base_url']."/graph.php?id=" . $service['service_id'] . "&type=service_availability&from=$day&to=$now&width=400&height=125\'>";
$popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";

View File

@@ -33,7 +33,7 @@ if ($_SESSION['userlevel'] >= '5') {
$graph_array['width'] = "215";
$graph_array['to'] = $now;
$graph_array['id'] = $service['service_id'];
$graph_array['type'] = "service";
$graph_array['type'] = "service_availability";
$periods = array('day', 'week', 'month', 'year');

1120
mibs/CISCO-PRODUCTS-MIB Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -139,8 +139,6 @@ while ($device = mysql_fetch_assoc($device_query))
if (is_numeric($uptime))
{
$graphs['uptime'] = TRUE;
if ( $uptime < $device['uptime'] ) {
notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago.");
log_event('Device rebooted after '.formatUptime($device['uptime']), $device['device_id'], 'reboot', $device['uptime']);
@@ -158,8 +156,6 @@ while ($device = mysql_fetch_assoc($device_query))
echo("Uptime: ".formatUptime($uptime)."\n");
print_r($graphs);
$poll_update .= $poll_separator . "`uptime` = '$uptime'";
$poll_separator = ", ";
}