add some mibs, update snmp functions

git-svn-id: http://www.observium.org/svn/observer/trunk@1458 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-22 21:58:49 +00:00
parent f09b9c4d63
commit e220114f4c
59 changed files with 13439 additions and 176 deletions
@@ -6,7 +6,7 @@ $community = $device['community'];
if($device['os'] == "ironware") {
echo(" Brocade FDP: ");
$fdp_array = snmpwalk_cache_twopart_oid("snFdpCacheEntry", $device, array(), "FOUNDRY-SN-SWITCH-GROUP-MIB");
$fdp_array = snmpwalk_cache_twopart_oid($device, "snFdpCacheEntry", array(), "FOUNDRY-SN-SWITCH-GROUP-MIB");
$fdp_array = $fdp_array[$device['device_id']];
if($fdp_array) {
unset($fdp_links);
@@ -32,7 +32,7 @@ if($device['os'] == "ironware") {
if($device['os_group'] == "ios") {
echo(" CISCO-CDP-MIB: ");
unset($cdp_array);
$cdp_array = snmpwalk_cache_twopart_oid("cdpCache", $device, array(), "CISCO-CDP-MIB");
$cdp_array = snmpwalk_cache_twopart_oid($device, "cdpCache", array(), "CISCO-CDP-MIB");
$cdp_array = $cdp_array[$device['device_id']];
if($cdp_array) {
unset($cdp_links);
@@ -58,7 +58,7 @@ if($device['os_group'] == "ios") {
echo(" LLDP-MIB: ");
unset($lldp_array);
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, array(), "LLDP-MIB");
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB");
$lldp_array = $lldp_array[$device['device_id']];
if($lldp_array) {
$lldp_links = "";
+1 -2
View File
@@ -7,8 +7,7 @@
if($config['enable_inventory']) {
$entity_array = array();
$entity_array = snmpwalk_cache_oid("entPhysicalEntry", $device, $entity_array, "ENTITY-MIB");
#$entity_array = snmpwalk_cache_oid("entSensorValues", $device, $entity_array, "CISCO-ENTITY-SENSOR-MIB");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB");
if(!$entity_array[$device['device_id']]) { $entity_array[$device['device_id']] = array(); }
+29 -21
View File
@@ -5,30 +5,38 @@ echo("hrDevice : ");
$hrDevice_oids = array('hrDeviceEntry','hrProcessorEntry');
if($debug) {print_r($hrDevices);}
foreach ($hrDevice_oids as $oid) { $hrDevices = snmp_cache_oid($oid, $device, $hrDevices, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
$hrDevices = array();
foreach ($hrDevice_oids as $oid) { $hrDevices = snmpwalk_cache_oid($device, $oid, $hrDevices, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
if($debug) {print_r($hrDevices);}
foreach($hrDevices[$device['device_id']] as $hrDevice) {
if(is_array($hrDevice) && is_numeric($hrDevice['hrDeviceIndex'])) {
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'"),0)) {
$update_query = "UPDATE `hrDevice` SET";
$update_query .= " `hrDeviceType` = '".mres($hrDevice[hrDeviceType])."'";
$update_query .= ", `hrDeviceDescr` = '".mres($hrDevice[hrDeviceDescr])."'";
$update_query .= ", `hrDeviceStatus` = '".mres($hrDevice[hrDeviceStatus])."'";
$update_query .= ", `hrDeviceErrors` = '".mres($hrDevice[hrDeviceErrors])."'";
if($hrDevice['hrDeviceType'] == "hrDeviceProcessor") {
$update_query .= ", `hrProcessorLoad` = '".mres($hrDevice[hrProcessorLoad])."'";
if(is_array($hrDevices[$device['device_id']]))
{
$hrDevices = $hrDevices[$device['device_id']];
foreach($hrDevices as $hrDevice)
{
if(is_array($hrDevice) && is_numeric($hrDevice['hrDeviceIndex']))
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'"),0))
{
$update_query = "UPDATE `hrDevice` SET";
$update_query .= " `hrDeviceType` = '".mres($hrDevice[hrDeviceType])."'";
$update_query .= ", `hrDeviceDescr` = '".mres($hrDevice[hrDeviceDescr])."'";
$update_query .= ", `hrDeviceStatus` = '".mres($hrDevice[hrDeviceStatus])."'";
$update_query .= ", `hrDeviceErrors` = '".mres($hrDevice[hrDeviceErrors])."'";
if($hrDevice['hrDeviceType'] == "hrDeviceProcessor")
{
$update_query .= ", `hrProcessorLoad` = '".mres($hrDevice[hrProcessorLoad])."'";
}
$update_query .= " WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'";
@mysql_query($update_query); $mysql++; echo(".");
} else {
$insert_query = "INSERT INTO `hrDevice` (`hrDeviceIndex`,`device_id`,`hrDeviceType`,`hrDeviceDescr`,`hrDeviceStatus`,`hrDeviceErrors`) ";
$insert_query .= " VALUES ('".mres($hrDevice[hrDeviceIndex])."','".mres($device[device_id])."','".mres($hrDevice[hrDeviceType])."','".mres($hrDevice[hrDeviceDescr])."','".mres($hrDevice[hrDeviceStatus])."','".mres($hrDevice[hrDeviceErrors])."')";
@mysql_query($insert_query); $mysql++; echo("+");
if($debug) { print_r($hrDevice); echo("$insert_query" . mysql_affected_rows() . " row inserted"); }
}
$update_query .= " WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'";
@mysql_query($update_query); $mysql++; echo(".");
} else {
$insert_query = "INSERT INTO `hrDevice` (`hrDeviceIndex`,`device_id`,`hrDeviceType`,`hrDeviceDescr`,`hrDeviceStatus`,`hrDeviceErrors`) ";
$insert_query .= " VALUES ('".mres($hrDevice[hrDeviceIndex])."','".mres($device[device_id])."','".mres($hrDevice[hrDeviceType])."','".mres($hrDevice[hrDeviceDescr])."','".mres($hrDevice[hrDeviceStatus])."','".mres($hrDevice[hrDeviceErrors])."')";
@mysql_query($insert_query); $mysql++; echo("+");
if($debug) { print_r($hrDevice); echo("$insert_query" . mysql_affected_rows() . " row inserted"); }
}
$valid_hrDevice[$hrDevice[hrDeviceIndex]] = 1;
$valid_hrDevice[$hrDevice[hrDeviceIndex]] = 1;
}
}
}
+1 -3
View File
@@ -8,9 +8,7 @@ if(($device['os'] == "ios" || $device['os_group'] == "ios") && $cemp_count == "0
echo("OLD-CISCO-MEMORY-POOL: ");
$cmp_oids = array('ciscoMemoryPool');
foreach ($cmp_oids as $oid) { $cmp_array = snmp_cache_oid($oid, $device, array(), "CISCO-MEMORY-POOL-MIB"); }
$cmp_array = snmpwalk_cache_oid($device, 'ciscoMemoryPool', NULL, "CISCO-MEMORY-POOL-MIB");
if(is_array($cmp_array)) {
foreach($cmp_array[$device[device_id]] as $index => $cmp) {
@@ -1,6 +1,6 @@
<?php
$storage_array = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if(is_array($storage_array)) {
echo("hrStorage : ");
@@ -5,8 +5,8 @@ global $valid_processor;
if ($device['os_group'] == "unix" || $device['os'] == "windows" || $device['os'] == "routeros")
{
echo("hrDevice ");
$hrDevice_oids = array('hrDevice','hrProcessorLoad');
foreach ($hrDevice_oids as $oid) { $hrDevice_array = snmp_cache_oid($oid, $device, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
$hrDevice_oids = array('hrDevice','hrProcessorLoad');
foreach ($hrDevice_oids as $oid) { $hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
foreach($hrDevice_array[$device['device_id']] as $index => $entry)
{
if ($entry['hrDeviceType'] == "hrDeviceProcessor")
+11 -5
View File
@@ -5,11 +5,12 @@ global $valid_processor;
if ($device['os'] == "ios" || $device['os_group'] == "ios")
{
echo("CISCO-PROCESS-MIB : ");
$processors_array = snmpwalk_cache_oid("cpmCPU", $device, $processors_array, "CISCO-PROCESS-MIB");
$processors_array = snmpwalk_cache_oid($device, "cpmCPU", NULL, "CISCO-PROCESS-MIB");
if($debug) { print_r($processors_array); }
foreach ($processors_array[$device['device_id']] as $index => $entry)
{
if ($entry['cpmCPUTotal5minRev'] || $entry['cpmCPUTotal5min'])
if (is_numeric($entry['cpmCPUTotal5minRev']) || is_numeric($entry['cpmCPUTotal5min']))
{
$entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex'];
@@ -21,26 +22,31 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
$usage = $entry['cpmCPUTotal5min'];
}
$descr_oid = "entPhysicalName." . $entPhysicalIndex;
$descr = snmp_get($device, $descr_oid, "-Oqv", "ENTITY-MIB");
if($entPhysicalIndex) {
$descr_oid = "entPhysicalName." . $entPhysicalIndex;
$descr = snmp_get($device, $descr_oid, "-Oqv", "ENTITY-MIB");
}
if(!$descr) { $descr = "Processor $index"; }
$old_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("cpmCPU-" . $index . ".rrd");
$new_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-cpm-" . $index . ".rrd");
if($debug) { echo("$old_rrd $new_rrd"); }
if (is_file($old_rrd))
{
shell_exec("mv -f $old_rrd $new_rrd");
if($debug) { echo("$old_rrd $new_rrd"); }
echo("Moved RRD ");
}
echo("|".$descr."|");
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" )
{
discover_processor($valid_processor, $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
}
}
}
if (!is_array($valid_processor['cpm']))
{
$avgBusy5 = snmp_get($device, ".1.3.6.1.4.1.9.2.1.58.0", "-Oqv");
@@ -0,0 +1,26 @@
<?php
global $valid_processor;
##
## Hardcoded discovery of cpu usage on RADLAN devices.
##
if($device['os'] == "radlan")
{
echo("RADLAN : ");
$descr = "Processor";
$usage = snmp_get($device, ".1.3.6.1.4.1.89.1.9.0", "-OQUvs", "RADLAN-rndMng", $config['mib_dir'].":".$config['mib_dir']."/radlan");
if(is_numeric($usage))
{
discover_processor($valid_processor, $device, ".1.3.6.1.4.1.89.1.9.0", "0", "radlan", $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);
?>
+2 -7
View File
@@ -2,18 +2,13 @@
echo("Q-BRIDGE-MIB VLANs : ");
$vlanversion_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m Q-BRIDGE-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " ";
$vlanversion_cmd .= $device['hostname'].":".$device['port'] . " Q-BRIDGE-MIB::dot1qVlanVersionNumber.0";
$vlanversion = trim(`$vlanversion_cmd 2>/dev/null`);
$vlanversion = snmp_get($device, "dot1qVlanVersionNumber.0", "-Oqv", "Q-BRIDGE-MIB");
if($vlanversion == 'version1') {
echo("VLAN $vlanversion ");
$vlans_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m Q-BRIDGE-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
$vlans_cmd .= "dot1qVlanFdbId";
$vlans = trim(`$vlans_cmd | grep -v o`);
$vlans = snmp_walk($device, "dot1qVlanFdbId", $options = "-Oqn", $mib = "Q-BRIDGE-MIB");
foreach(explode("\n", $vlans) as $vlan_oid) {
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
$storage_array = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if(is_array($storage_array)) {
echo("hrStorage : ");
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
echo("UCD Disk IO : ");
$diskio_array = snmpwalk_cache_oid("diskIOEntry", $device, array(), "UCD-DISKIO-MIB" , "+".$config['install_dir']."/mibs/");
$diskio_array = snmpwalk_cache_oid($device, "diskIOEntry", array(), "UCD-DISKIO-MIB" , "+".$config['install_dir']."/mibs/");
$valid_diskio = array();
# if($debug) { print_r($diskio_array); }
+48
View File
@@ -0,0 +1,48 @@
<?php
if($device['os'] == "asa" || $device['os'] == "pix") {
echo("ALTIGA-MIB SSL VPN Statistics \n");
$oids = array('alSslStatsTotalSessions','alSslStatsActiveSessions','alSslStatsMaxSessions','alSslStatsPreDecryptOctets',
'alSslStatsPostDecryptOctets','alSslStatsPreEncryptOctets','alSslStatsPostEncryptOctets');
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("altiga-ssl.rrd");
$rrd_create = " RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600";
$rrd_create .= " RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
$rrd_create .= " DS:TotalSessions:COUNTER:600:U:100000 DS:ActiveSessions:GAUGE:600:0:U DS:MaxSessions:GAUGE:600:0:U";
$rrd_create .= " DS:PreDecryptOctets:COUNTER:600:U:100000000000 DS:PostDecryptOctets:COUNTER:600:U:100000000000 DS:PreEncryptOctets:COUNTER:600:U:100000000000";
$rrd_create .= " DS:PostEncryptOctets:COUNTER:600:U:100000000000";
if(!file_exists($rrdfile))
{
rrdtool_create($rrdfile, $rrd_create);
}
$data_array = snmpwalk_cache_oid($device, $proto, array(), "ALTIGA-SSL-STATS-MIB");
$rrdupdate = "N";
foreach($oids as $oid)
{
if(is_numeric($data_array[$device['device_id']][0][$oid])) {
$value = $data_array[$device['device_id']][0][$oid];
} else {
$value = "0";
}
$rrdupdate .= ":$value";
}
if($data_array[$device['device_id']][0]['alSslStatsTotalSessions'])
{
rrdtool_update($rrdfile, $rrdupdate);
}
unset($rrdfile, $rrdupdate, $data_array);
}
?>
@@ -7,7 +7,7 @@ $cip_array = array();
foreach ($cip_oids as $oid)
{
echo("$oid ");
$cip_array = snmp_cache_cip($oid, $device, $cip_array, "CISCO-IP-STAT-MIB");
$cip_array = snmpwalk_cache_cip($device, $oid, $cip_array, "CISCO-IP-STAT-MIB");
}
$polled = time();
+1 -1
View File
@@ -49,7 +49,7 @@
echo("Polling IP-MIB ipSystemStats ");
$ipSystemStats = snmpwalk_cache_oid("ipSystemStats", $device, $ipSystemStats, "IP-MIB");
$ipSystemStats = snmpwalk_cache_oid($device, "ipSystemStats", NULL, "IP-MIB");
$ipSystemStats = $ipSystemStats[$device[device_id]];
if($ipSystemStats) {
+1 -1
View File
@@ -3,7 +3,7 @@
/// HOST-RESOURCES-MIB - Memory Objects
if(!is_array($storage_cache['hrstorage'])) {
$storage_cache['hrstorage'] = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$storage_cache['hrstorage'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if ($debug) { print_r($storage_cache); }
} else { if($debug) { echo("Cached!"); } }
+2 -2
View File
@@ -51,9 +51,9 @@ if($device[os] != "Snom") {
if($proto == "ip" || $proto == "tcp" || $proto == "udp")
{
$data = snmp_get_multi($device ,$snmpstring);
$data = snmp_get_multi($device, $snmpstring);
} else {
$data_array = snmpwalk_cache_oid($proto, $device, array());
$data_array = snmpwalk_cache_oid($device, $proto, array());
}
$rrdupdate = "N";
-23
View File
@@ -12,27 +12,4 @@ if (strstr($hardware,"No Such Object available"))
$hardware = $sysDescr;
}
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/powerconnect-cpu.rrd";
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m RADLAN-rndMng -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd .= " RADLAN-rndMng::rlCpuUtilDuringLastSecond.0";
$cpu_usage = trim(shell_exec($cpu_cmd));
if (!is_file($cpurrd)) {
$rrdcreate = shell_exec($config['rrdtool'] ." create $cpurrd --step 300 DS:LOAD:GAUGE:600:-1:100 RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:1:2000 \
RRA:AVERAGE:0.5:6:2000 \
RRA:AVERAGE:0.5:24:2000 \
RRA:AVERAGE:0.5:288:2000 \
RRA:MAX:0.5:1:2000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:2000 \
RRA:MAX:0.5:288:2000 \
RRA:MIN:0.5:1:2000 \
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
rrdtool_update($cpurrd, "N:$cpu_usage");
?>
-25
View File
@@ -15,29 +15,4 @@ $version = str_replace("\"","", $version);
$features = str_replace("\"","", $features);
$hardware = str_replace("\"","", $hardware);
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/radlan-cpu.rrd";
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m RADLAN-rndMng -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd .= " RADLAN-rndMng::rlCpuUtilDuringLastSecond.0";
$cpu_usage = trim(shell_exec($cpu_cmd));
if (!is_file($cpurrd)) {
$rrdcreate = shell_exec($config['rrdtool'] ." create $cpurrd --step 300 DS:LOAD:GAUGE:600:-1:100 RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:1:2000 \
RRA:AVERAGE:0.5:6:2000 \
RRA:AVERAGE:0.5:24:2000 \
RRA:AVERAGE:0.5:288:2000 \
RRA:MAX:0.5:1:2000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:2000 \
RRA:MAX:0.5:288:2000 \
RRA:MIN:0.5:1:2000 \
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
rrdtool_update($cpurrd, "N:$cpu_usage");
?>
+28 -28
View File
@@ -28,50 +28,50 @@
$ifmib_oids = array('ifEntry', 'ifXEntry');
echo("Caching Oids: ");
foreach ($ifmib_oids as $oid) { echo("$oid "); $array = snmp_cache_oid($oid, $device, $array, "IF-MIB");}
foreach ($ifmib_oids as $oid) { echo("$oid "); $array = snmpwalk_cache_oid($device, $oid, $array, "IF-MIB");}
if($config['enable_ports_etherlike']) { echo("dot3Stats "); $array = snmp_cache_oid("dot3StatsEntry", $device, $array, "EtherLike-MIB"); }
if($config['enable_ports_etherlike']) { echo("dot3Stats "); $array = snmpwalk_cache_oid($device, "dot3StatsEntry", $array, "EtherLike-MIB"); }
if($config['enable_ports_adsl']) {
$device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0);
}
if($device['adsl_count'] > "0") {
echo("ADSL ");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.1.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.2.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.3.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.4.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.5.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.2", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.3", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.4", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.5", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.6", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.7", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.6.1.8", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.1", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.2", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.3", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.4", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.5", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.6", $device, $array, "ADSL-LINE-MIB");
$array = snmp_cache_oid(".1.3.6.1.2.1.10.94.1.1.7.1.7", $device, $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.1.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.2.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.3.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.4.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.5.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.2", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.3", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.4", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.5", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.6", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.7", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.6.1.8", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.1", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.2", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.3", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.4", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.5", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.6", $array, "ADSL-LINE-MIB");
$array = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.7", $array, "ADSL-LINE-MIB");
}
echo("\n");
#foreach ($etherlike_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "EtherLike-MIB"); }
#foreach ($cisco_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "OLD-CISCO-INTERFACES-MIB"); }
#foreach ($pagp_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "CISCO-PAGP-MIB"); }
#foreach ($etherlike_oids as $oid) { $array = snmpwalk_cache_oid($device, $oid, $array, "EtherLike-MIB"); }
#foreach ($cisco_oids as $oid) { $array = snmpwalk_cache_oid($device, $oid, $array, "OLD-CISCO-INTERFACES-MIB"); }
#foreach ($pagp_oids as $oid) { $array = snmpwalk_cache_oid($device, $oid, $array, "CISCO-PAGP-MIB"); }
if($device['os_group'] == "ios") {
$array = snmp_cache_portIfIndex ($device, $array);
$array = snmp_cache_portName ($device, $array);
$data_oids[] = "portName";
#$array = snmp_cache_oid("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");
#$array = snmp_cache_oid("vlanTrunkPortEncapsulationOperType", $device, $array, "CISCO-VTP-MIB");
#$array = snmp_cache_oid("vlanTrunkPortNativeVlan", $device, $array, "CISCO-VTP-MIB");
#$array = snmpwalk_cache_oid($device, "vmVlan", $array, "CISCO-VLAN-MEMBERSHIP-MIB");
#$array = snmpwalk_cache_oid($device, "vlanTrunkPortEncapsulationOperType", $array, "CISCO-VTP-MIB");
#$array = snmpwalk_cache_oid($device, "vlanTrunkPortNativeVlan", $array, "CISCO-VTP-MIB");
}
$polled = time();
+1 -1
View File
@@ -3,7 +3,7 @@
### HOST-RESOURCES-MIB - Storage Objects
if(!is_array($storage_cache['hrstorage'])) {
$storage_cache['hrstorage'] = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$storage_cache['hrstorage'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if ($debug) { print_r($storage_cache); }
}
+1 -1
View File
@@ -8,7 +8,7 @@ if(mysql_affected_rows()) {
$diskio_cache = array();
$diskio_cache = snmpwalk_cache_oid("diskIOEntry", $device, $diskio_cache);
$diskio_cache = snmpwalk_cache_oid($device, "diskIOEntry", $diskio_cache);
$diskio_cache = $diskio_cache[$device['device_id']];
+1 -1
View File
@@ -37,7 +37,7 @@
$cpu = `$cpu_cmd`;
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $UsageUser, $UsageSystem) = explode("\n", $cpu);
$ss = snmpwalk_cache_oid("systemStats", $device, array());
$ss = snmpwalk_cache_oid($device, "systemStats", array());
$ss = $ss[$device['device_id']][0];
## Create CPU RRD if it doesn't already exist
+27
View File
@@ -115,6 +115,26 @@ $rewrite_junose_hardware = array(
'juniSsx1440' => 'SSX-1440',
);
$rewrite_ftos_hardware = array (
'.1.3.6.1.4.1.6027.1.1.1'=> 'E1200',
'.1.3.6.1.4.1.6027.1.1.2'=> 'E600',
'.1.3.6.1.4.1.6027.1.1.3'=> 'E300',
'.1.3.6.1.4.1.6027.1.1.4'=> 'E610',
'.1.3.6.1.4.1.6027.1.1.5'=> 'E1200i',
'.1.3.6.1.4.1.6027.1.2.1'=> 'C300',
'.1.3.6.1.4.1.6027.1.2.2'=> 'C150',
'.1.3.6.1.4.1.6027.1.3.1'=> 'S50',
'.1.3.6.1.4.1.6027.1.3.2'=> 'S50E',
'.1.3.6.1.4.1.6027.1.3.3'=> 'S50V',
'.1.3.6.1.4.1.6027.1.3.4'=> 'S25P-AC',
'.1.3.6.1.4.1.6027.1.3.5'=> 'S2410CP',
'.1.3.6.1.4.1.6027.1.3.6'=> 'S2410P',
'.1.3.6.1.4.1.6027.1.3.7'=> 'S50N-AC',
'.1.3.6.1.4.1.6027.1.3.8'=> 'S50N-DC',
'.1.3.6.1.4.1.6027.1.3.9'=> 'S25P-DC',
'.1.3.6.1.4.1.6027.1.3.9'=> 'S25V',
'.1.3.6.1.4.1.6027.1.3.9'=> 'S25N'
);
$rewrite_extreme_hardware = array (
'.1.3.6.1.4.1.1916.2.26' => 'Alpine 3802',
@@ -751,6 +771,13 @@ function rewrite_extreme_hardware ($hardware)
return ($hardware);
}
function rewrite_ftos_hardware ($hardware)
{
global $rewrite_ftos_hardware;
$hardware = $rewrite_ftos_hardware[$hardware];
return ($hardware);
}
function rewrite_ironware_hardware ($hardware)
{
+2 -2
View File
@@ -11,7 +11,7 @@ function rrdtool_create($rrdfile, $rrdupdate)
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
if ($debug || TRUE) { echo($command."\n"); }
if ($debug) { echo($command."\n"); }
return shell_exec($command);
@@ -47,7 +47,7 @@ function rrdtool($command, $file, $options)
$command .= " --daemon " . $config['rrdcached'];
}
if ($debug || TRUE) { echo($command."\n"); }
if ($debug) { echo($command."\n"); }
return shell_exec($command);
}
+20 -43
View File
@@ -45,7 +45,7 @@ function snmp_get ($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
$data = trim(shell_exec($cmd));
$runtime_stats['snmpget']++;
if($debug) { echo("$data\n"); }
if (is_string($data) && (preg_match("/No Such (Object|Instance)/i", $data) || preg_match("/No more variables left/i", $data)))
if (is_string($data) && (preg_match("/No Such Instance/i", $data) || preg_match("/No Such Object/i", $data) || preg_match("/No more variables left/i", $data)))
{ $data = false; } else { return $data; }
}
@@ -74,7 +74,7 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
{ $data = false; } else { return $data; }
}
function snmp_cache_cip($oid, $device, $array, $mib = 0)
function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
{
global $config;
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
@@ -114,7 +114,8 @@ function snmp_cache_cip($oid, $device, $array, $mib = 0)
return $array;
}
function snmp_cache_ifIndex($device) {
function snmp_cache_ifIndex($device)
{
global $config;
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
@@ -143,22 +144,22 @@ function snmp_cache_ifIndex($device) {
return $array;
}
function snmpwalk_cache_oid($poll_oid, $device, $array, $mib = NULL, $mibdir = NULL) {
global $config; global $debug;
$data = snmp_walk($device, $poll_oid, "-OQUs", $mib, $mibdir);
$device_id = $device['device_id'];
function snmpwalk_cache_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir);
foreach(explode("\n", $data) as $entry) {
list($oid,$value) = explode("=", $entry);
$oid = trim($oid); $value = trim($value);
list($oid, $index) = explode(".", $oid);
if (!strstr($value, "at this OID") && isset($oid) && isset($index)) {
$array[$device_id][$index][$oid] = $value;
$array[$device[device_id]][$index][$oid] = $value;
}
}
return $array;
}
function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) {
function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir);
foreach(explode("\n", $data) as $entry) {
list($oid,$value) = explode("=", $entry);
@@ -179,7 +180,8 @@ function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir =
}
function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) {
function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir);
foreach(explode("\n", $data) as $entry) {
list($oid,$value) = explode("=", $entry);
@@ -193,7 +195,8 @@ function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir =
return $array;
}
function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) {
function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir);
foreach(explode("\n", $data) as $entry) {
list($oid,$value) = explode("=", $entry);
@@ -209,7 +212,8 @@ function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = NULL, $mibdir =
function snmpwalk_cache_twopart_oid($oid, $device, $array, $mib = 0) {
function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib = 0)
{
global $config;
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
@@ -237,7 +241,7 @@ function snmpwalk_cache_twopart_oid($oid, $device, $array, $mib = 0) {
return $array;
}
function snmpwalk_cache_threepart_oid($oid, $device, $array, $mib = 0) {
function snmpwalk_cache_threepart_oid($device, $oid, $array, $mib = 0) {
global $config, $debug;
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
@@ -296,36 +300,9 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib = 0) {
return $array;
}
function snmp_cache_oid($oid, $device, $array, $mib = 0) {
global $config;
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
$snmpcommand = $config['snmpwalk'];
}
else
{
$snmpcommand = $config['snmpbulkwalk'];
}
$cmd = $snmpcommand . " -O UQs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -M ".$config['install_dir']."/mibs/";
#$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
$data = trim(shell_exec($cmd));
$device_id = $device['device_id'];
#echo("Caching: $oid\n");
foreach(explode("\n", $data) as $entry) {
list ($this_oid, $this_value) = preg_split("/=/", $entry);
list ($this_oid, $this_index) = explode(".", $this_oid);
$this_index = trim($this_index);
$this_oid = trim($this_oid);
$this_value = trim($this_value);
if(!strstr($this_value, "at this OID") && $this_index) {
$array[$device_id][$this_index][$this_oid] = $this_value;
}
$array[$device_id][$oid] = '1';
}
function snmp_cache_oid($oid, $device, $array, $mib = 0)
{
$array = snmpwalk_cache_oid($device, $oid, $array, $mib);
return $array;
}
+5 -1
View File
@@ -136,7 +136,9 @@ $config['os']['powerconnect']['icon'] = "dell";
$config['os']['radlan']['text'] = "Radlan";
$config['os']['radlan']['ifname'] = 1;
$config['os']['radlan']['type'] = "network";
$config['os']['radlan']['overgraph'][0] = "device_cpu";
$config['os']['radlan']['overgraph'][1] = "device_bits";
$config['os']['radlan']['overtext'] = "CPU & Traffic";
$config['os']['powervault']['text'] = "Dell PowerVault";
$config['os']['powervault']['icon'] = "dell";
@@ -146,6 +148,8 @@ $config['os']['drac']['icon'] = "dell";
$config['os']['bcm963']['text'] = "Broadcom BCM963xxx";
$config['os']['bcm963']['icon'] = "broadcom";
$config['os']['bcm963']['overgraph'][] = "device_bits";
$config['os']['bcm963']['overtext'] = "Traffic";
$config['os']['netopia']['text'] = "Motorola Netopia";
$config['os']['netopia']['type'] = "network";