some new things!

git-svn-id: http://www.observium.org/svn/observer/trunk@221 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2008-04-03 21:52:59 +00:00
parent 4e10de77a7
commit 70b36878be
7 changed files with 56 additions and 16 deletions
+9 -1
View File
@@ -44,7 +44,15 @@
$os = gethostosbyid($device_id); $os = gethostosbyid($device_id);
switch ($type) { switch ($type) {
case 'fortigate_sessions':
$graph = graph_fortigate_sessions ($hostname . "/fortigate-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'fortigate_cpu':
$graph = graph_fortigate_cpu ($hostname . "/fortigate-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'fortigate_memory':
$graph = graph_fortigate_memory ($hostname . "/fortigate-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'netscreen_sessions': case 'netscreen_sessions':
$graph = graph_netscreen_sessions ($hostname . "/netscreen-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); $graph = graph_netscreen_sessions ($hostname . "/netscreen-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break; break;
+9 -4
View File
@@ -8,17 +8,22 @@ while($device = mysql_fetch_array($device_query)) {
echo("<div style='clear: both;'>"); echo("<div style='clear: both;'>");
switch ($device['os']) { switch ($device['os']) {
case "ScreenOS": case "Fortigate":
echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "fortigate_cpu"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Memory Usage</div>");
$graph_type = "fortigate_memory"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Firewall Sessions</div>");
$graph_type = "fortigate_sessions"; include ("includes/print-device-graph.php");
break;
case "ScreenOS":
echo("<div class=graphhead>Processor Utilisation</div>"); echo("<div class=graphhead>Processor Utilisation</div>");
$graph_type = "netscreen_cpu"; include ("includes/print-device-graph.php"); $graph_type = "netscreen_cpu"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Memory Usage</div>"); echo("<div class=graphhead>Memory Usage</div>");
$graph_type = "netscreen_memory"; include ("includes/print-device-graph.php"); $graph_type = "netscreen_memory"; include ("includes/print-device-graph.php");
echo("<div class=graphhead>Firewall Sessions</div>"); echo("<div class=graphhead>Firewall Sessions</div>");
$graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php"); $graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php");
break; break;
case "ProCurve": case "ProCurve":
+25 -1
View File
@@ -34,9 +34,14 @@
# Add Interface # Add Interface
echo("+"); echo("+");
} else { } else {
# Interface Already Exists mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex' AND `deleted` = '1'");
if(mysql_affected_rows()) {
echo("*");
} else {
echo("."); echo(".");
} }
}
$int_exists[] = "$ifIndex";
} else { } else {
# Ignored ifName # Ignored ifName
echo("X"); echo("X");
@@ -44,6 +49,25 @@
} }
} }
$sql = "SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = '0'";
$query = mysql_query($sql);
while ($test_if = mysql_fetch_array($query)) {
unset($exists);
$i = 0;
while ($i < count($int_exists) && !$exists) {
$this_if = $test_if['ifIndex'];
if ($int_exists[$i] == $this_if) { $exists = 1; }
$i++;
}
if(!$exists) {
echo("-");
mysql_query("UPDATE `interfaces` SET `deleted` = '1' WHERE interface_id = '" . $test_if['interface_id'] . "'");
}
}
unset($temp_exists);
echo("\n"); echo("\n");
?> ?>
+1
View File
@@ -1,6 +1,7 @@
<?php <?php
include("graphing/screenos.php"); include("graphing/screenos.php");
include("graphing/fortigate.php");
function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height) { function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height) {
global $config, $rrdtool, $installdir, $mono_font; global $config, $rrdtool, $installdir, $mono_font;
+1 -1
View File
@@ -2,7 +2,7 @@
if(!$os) { if(!$os) {
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -m ".$config['mibs_dir']."/NS-PRODUCTS.mib -v2c -c ". $community ." ". $hostname ." .1.3.6.1.2.1.1.2.0"); $sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname ." .1.3.6.1.2.1.1.2.0");
if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; }
} }
+5 -1
View File
@@ -1,6 +1,10 @@
<? <?
echo("Doing Juniper Netscreen ScreenOS"); echo("Doing Juniper Netscreen (ScreenOS)");
$version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr);
echo("$version\n");
list($hardware,$version,$serial,$features) = explode("||", $version);
$cpurrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-cpu.rrd"; $cpurrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-cpu.rrd";
$memrrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-memory.rrd"; $memrrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-memory.rrd";
+4 -6
View File
@@ -66,10 +66,7 @@ while ($device = mysql_fetch_array($device_query)) {
$ciscomodel = str_replace("\"", "", trim(`$snmp_cmdb`)); $ciscomodel = str_replace("\"", "", trim(`$snmp_cmdb`));
} else { unset($ciscomodel); } } else { unset($ciscomodel); }
echo("$snmp_cmd \n");
$snmpdata = shell_exec($snmp_cmd); $snmpdata = shell_exec($snmp_cmd);
echo("completed");
$snmpdata = preg_replace("/^.*IOS/","", $snmpdata); $snmpdata = preg_replace("/^.*IOS/","", $snmpdata);
$snmpdata = trim($snmpdata); $snmpdata = trim($snmpdata);
$snmpdata = str_replace("\"", "", $snmpdata); $snmpdata = str_replace("\"", "", $snmpdata);
@@ -139,12 +136,13 @@ while ($device = mysql_fetch_array($device_query)) {
break; break;
case "ScreenOS": case "ScreenOS":
$version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr);
echo("$version\n");
list($hardware,$version,$serial,$features) = explode("||", $version);
include("includes/polling/device-screenos.inc.php"); include("includes/polling/device-screenos.inc.php");
break; break;
case "Fortigate":
include("includes/polling/device-fortigate.inc.php");
break;
case "IOS": case "IOS":
$version = str_replace("Cisco IOS Software,", "", $sysDescr); $version = str_replace("Cisco IOS Software,", "", $sysDescr);
$version = str_replace("IOS (tm) ", "", $version); $version = str_replace("IOS (tm) ", "", $version);