mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Juniper Netscreen Additions
git-svn-id: http://www.observium.org/svn/observer/trunk@174 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -45,6 +45,15 @@
|
||||
|
||||
switch ($type) {
|
||||
|
||||
case 'netscreen_sessions':
|
||||
$graph = graph_netscreen_sessions ($hostname . "/netscreen-sessions.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
break;
|
||||
case 'netscreen_cpu':
|
||||
$graph = graph_netscreen_cpu ($hostname . "/netscreen-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
break;
|
||||
case 'netscreen_memory':
|
||||
$graph = graph_netscreen_memory ($hostname . "/netscreen-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||
break;
|
||||
case 'multi_bits':
|
||||
$graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height);
|
||||
break;
|
||||
|
BIN
html/images/os/junos.png
Normal file
BIN
html/images/os/junos.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
html/images/os/screenos.png
Normal file
BIN
html/images/os/screenos.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@@ -8,6 +8,19 @@ while($device = mysql_fetch_array($device_query)) {
|
||||
echo("<div style='clear: both;'>");
|
||||
|
||||
switch ($device['os']) {
|
||||
case "ScreenOS":
|
||||
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
$graph_type = "netscreen_cpu"; include ("includes/print-device-graph.php");
|
||||
|
||||
echo("<div class=graphhead>Memory Usage</div>");
|
||||
$graph_type = "netscreen_memory"; include ("includes/print-device-graph.php");
|
||||
|
||||
echo("<div class=graphhead>Firewall Sessions</div>");
|
||||
$graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php");
|
||||
|
||||
break;
|
||||
|
||||
case "ProCurve":
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
include("graphing/screenos.php");
|
||||
|
||||
function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height) {
|
||||
global $config, $rrdtool, $installdir, $mono_font;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
@@ -12,33 +12,33 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
if($device['status'] == '1') {
|
||||
|
||||
unset($update);
|
||||
unset($update_query);
|
||||
unset($seperator);
|
||||
unset($update);
|
||||
unset($update_query);
|
||||
unset($seperator);
|
||||
|
||||
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
|
||||
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
|
||||
|
||||
$snmp_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'];
|
||||
$snmp_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'];
|
||||
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
$snmp_output = str_replace("No Such Object available on this agent at this OID", "", $snmp_output);
|
||||
$snmp_output = str_replace("No Such Instance currently exists at this OID", "", $snmp_output);
|
||||
$snmp_output = str_replace("\"", "", $snmp_output);
|
||||
$snmp_output = trim(`$snmp_cmd`);
|
||||
$snmp_output = str_replace("No Such Object available on this agent at this OID", "", $snmp_output);
|
||||
$snmp_output = str_replace("No Such Instance currently exists at this OID", "", $snmp_output);
|
||||
$snmp_output = str_replace("\"", "", $snmp_output);
|
||||
|
||||
list($ifAdminStatus, $ifOperStatus, $ifAlias) = explode("\n", $snmp_output);
|
||||
list($ifAdminStatus, $ifOperStatus, $ifAlias) = explode("\n", $snmp_output);
|
||||
|
||||
if ($ifAlias == " ") { $ifAlias = str_replace(" ", "", $ifAlias); }
|
||||
$ifAlias = trim(str_replace("\"", "", $ifAlias));
|
||||
$ifAlias = trim($ifAlias);
|
||||
if ($ifAlias == " ") { $ifAlias = str_replace(" ", "", $ifAlias); }
|
||||
$ifAlias = trim(str_replace("\"", "", $ifAlias));
|
||||
$ifAlias = trim($ifAlias);
|
||||
|
||||
$old_rrdfile = "rrd/" . $device['hostname'] . "." . $interface['ifIndex'] . ".rrd";
|
||||
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$old_rrdfile = "rrd/" . $device['hostname'] . "." . $interface['ifIndex'] . ".rrd";
|
||||
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
|
||||
|
||||
if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moving $old_rrdfile to $rrdfile"); }
|
||||
if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moving $old_rrdfile to $rrdfile"); }
|
||||
|
||||
if(!is_file($rrdfile)) {
|
||||
$woo = `rrdtool create $rrdfile \
|
||||
if(!is_file($rrdfile)) {
|
||||
$woo = `rrdtool create $rrdfile \
|
||||
DS:INOCTETS:COUNTER:600:U:100000000000 \
|
||||
DS:OUTOCTETS:COUNTER:600:U:10000000000 \
|
||||
DS:INERRORS:COUNTER:600:U:10000000000 \
|
||||
@@ -55,36 +55,40 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797`;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $interface['ifAlias'] != $ifAlias ) {
|
||||
|
||||
if( file_exists("includes/polling/interface-" . $device['os'] . ".php") ) { include("includes/polling/interface-" . $device['os'] . ".php"); }
|
||||
|
||||
|
||||
if ( $interface['ifAlias'] != $ifAlias ) {
|
||||
$update .= $seperator . "`ifAlias` = '$ifAlias'";
|
||||
$seperator = ", ";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'Desc -> $ifAlias')");
|
||||
}
|
||||
if ( $interface['ifOperStatus'] != $ifOperStatus && $ifOperStatus != "" ) {
|
||||
}
|
||||
if ( $interface['ifOperStatus'] != $ifOperStatus && $ifOperStatus != "" ) {
|
||||
$update .= $seperator . "`ifOperStatus` = '$ifOperStatus'";
|
||||
$seperator = ", ";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'Interface went $ifOperStatus')");
|
||||
}
|
||||
if ( $interface['ifAdminStatus'] != $ifAdminStatus && $ifAdminStatus != "" ) {
|
||||
}
|
||||
if ( $interface['ifAdminStatus'] != $ifAdminStatus && $ifAdminStatus != "" ) {
|
||||
$update .= $seperator . "`ifAdminStatus` = '$ifAdminStatus'";
|
||||
$seperator = ", ";
|
||||
if($ifAdminStatus == "up") { $admin = "enabled"; } else { $admin = "disabled"; }
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'Interface $admin')");
|
||||
}
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
if ($update) {
|
||||
$update_query = "UPDATE `interfaces` SET ";
|
||||
$update_query .= $update;
|
||||
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'";
|
||||
echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||
$update_result = mysql_query($update_query);
|
||||
} else {
|
||||
} else {
|
||||
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($ifOperStatus == "up") {
|
||||
if($ifOperStatus == "up") {
|
||||
|
||||
$snmp_data_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
$snmp_data_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
|
||||
@@ -111,7 +115,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
}
|
||||
}
|
||||
|
||||
$rates = interface_rates ($interface);
|
||||
$rates = interface_rates ($interface);
|
||||
mysql_query("UPDATE `interfaces` SET in_rate = '" . $rates['in'] . "', out_rate = '" . $rates['out'] . "' WHERE interface_id= '" . $interface['interface_id'] . "'");
|
||||
|
||||
}
|
||||
|
@@ -191,6 +191,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
include("includes/polling/temperatures.inc.php");
|
||||
include("includes/polling/device-netstats.inc.php");
|
||||
echo("Polling interfaces\n");
|
||||
|
||||
$where = "WHERE device_id = '" . $device['device_id'] . "'";
|
||||
include("includes/polling/interfaces.inc.php");
|
||||
|
||||
|
Reference in New Issue
Block a user