mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add generic device, hackeryfix hr-mib memory
git-svn-id: http://www.observium.org/svn/observer/trunk@882 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
$community = $device['community'];
|
||||
|
||||
echo("Brocade FDP: ");
|
||||
|
||||
if($device['os'] == "ironware") {
|
||||
echo(" Brocade FDP: ");
|
||||
$fdp_array = snmpwalk_cache_twopart_oid("snFdpCacheEntry", $device, array(), "FOUNDRY-SN-SWITCH-GROUP-MIB");
|
||||
$fdp_array = $fdp_array[$device['device_id']];
|
||||
if($fdp_array) {
|
||||
@@ -27,12 +27,13 @@ if($fdp_array) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo("\n");
|
||||
|
||||
|
||||
echo("CISCO-CDP-MIB: ");
|
||||
|
||||
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 = $cdp_array[$device['device_id']];
|
||||
@@ -54,9 +55,10 @@ if($cdp_array) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if($debug) {echo("$cdp_links");}
|
||||
}
|
||||
|
||||
echo("\nLLDP-MIB: ");
|
||||
|
||||
echo(" LLDP-MIB: ");
|
||||
|
||||
unset($lldp_array);
|
||||
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, array(), "LLDP-MIB");
|
||||
|
||||
@@ -145,7 +145,7 @@ function getHostOS($device)
|
||||
}
|
||||
closedir($dir_handle);
|
||||
|
||||
if ($os) { return $os; } else { return FALSE; }
|
||||
if ($os) { return $os; } else { return "generic"; }
|
||||
}
|
||||
|
||||
function billpermitted($bill_id)
|
||||
|
||||
@@ -34,6 +34,5 @@ if (!is_file($hrSystem_rrd)) {
|
||||
rrdtool_update($hrSystem_rrd, "N:$hrSystemNumUsers:$hrSystemProcesses:$uptime");
|
||||
|
||||
include("hr-mib_storage.inc.php"); // Run HOST-RESOURCES-MIB Storage
|
||||
#include("hr-mib_processor.inc.php"); // Run HOST-RESOURCES-MIB ProcessorLoad
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
echo("hrDevice : ");
|
||||
|
||||
$hrDevice_oids = array('hrDeviceStatus','hrDeviceErrors','hrProcessorLoad');
|
||||
|
||||
foreach ($hrDevice_oids as $oid) { echo("$oid "); $hrDevice_array = snmp_cache_oid($oid, $device, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
|
||||
|
||||
$sql = "SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' AND `hrDeviceType` = 'hrDeviceProcessor'";
|
||||
$query = mysql_query($sql);
|
||||
while ($hrDevice = mysql_fetch_array($query)) {
|
||||
$this_hrDevice = $hrDevice_array[$device[device_id]][$hrDevice[hrDeviceIndex]];
|
||||
|
||||
$update_query = "UPDATE `hrDevice` SET";
|
||||
$update_query .= " `hrDeviceStatus` = '".mres($this_hrDevice['hrDeviceStatus'])."'";
|
||||
$update_query .= ", `hrDeviceErrors` = '".mres($this_hrDevice['hrDeviceErrors'])."'";
|
||||
$update_query .= ", `hrProcessorLoad` = '".mres($this_hrDevice['hrProcessorLoad'])."'";
|
||||
$update_query .= " WHERE hrDevice_id = '".$hrDevice['hrDevice_id']."'";
|
||||
@mysql_query($update_query); $mysql++; echo(".");
|
||||
|
||||
$procrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrProcessor-" . $hrDevice['hrDeviceIndex'] . ".rrd");
|
||||
|
||||
if (!is_file($procrrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $procrrd \
|
||||
--step 300 \
|
||||
DS:usage:GAUGE:600:-273:1000 \
|
||||
RRA:AVERAGE:0.5:1:1200 \
|
||||
RRA:MIN:0.5:12:2400 \
|
||||
RRA:MAX:0.5:12:2400 \
|
||||
RRA:AVERAGE:0.5:12:2400");
|
||||
}
|
||||
|
||||
if ($debug) echo($this_hrDevice['hrProcessorLoad'] . "% ");
|
||||
|
||||
rrdtool_update ($procrrd, "N:".$this_hrDevice['hrProcessorLoad']);
|
||||
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
@@ -89,5 +89,4 @@ rrdtool_update($cpurrd, "N:$cpuUser:$cpuSystem:$cpuNice:$cpuIdle");
|
||||
list ($load1, $load5, $load10) = explode ("\n", $load_raw);
|
||||
|
||||
rrdtool_update($loadrrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:$memShared:$memBuffer:$memCached");
|
||||
|
||||
rrdtool_update($memrrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:".($memShared+0).":".($memBuffer+0).":".($memCached+0));
|
||||
|
||||
@@ -42,6 +42,7 @@ $os_text['catos'] = "Cisco CatOS";
|
||||
$os_text['nxos'] = "Cisco NX-OS";
|
||||
$os_text['asa'] = "Cisco ASA";
|
||||
$os_text['pix'] = "Cisco PIX";
|
||||
$os_text['generic'] = "Generic Device";
|
||||
$os_text['ironware'] = "Brocade IronWare";
|
||||
$os_text['freebsd'] = "FreeBSD";
|
||||
$os_text['openbsd'] = "OpenBSD";
|
||||
|
||||
Reference in New Issue
Block a user