mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Better ServerIron support
This commit is contained in:
		@@ -1,15 +1,11 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == "serveriron") {
 | 
			
		||||
    echo("nos: ");
 | 
			
		||||
if ($device['os'] == 'serveriron') {
 | 
			
		||||
    echo 'ServerIron Dynamic: ';
 | 
			
		||||
 | 
			
		||||
    $used 	= snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
 | 
			
		||||
    $total 	= "100";
 | 
			
		||||
    $free		= ($total - $used);
 | 
			
		||||
    $percent = snmp_get($device, 'snAgGblDynMemUtil.0', '-OvQ', 'FOUNDRY-SN-AGENT-MIB');
 | 
			
		||||
 | 
			
		||||
    $percent	= $used; 
 | 
			
		||||
 | 
			
		||||
    if (is_numeric($used)) {
 | 
			
		||||
        discover_mempool($valid_mempool, $device, 0, "serveriron", "Memory", "1", NULL, NULL);
 | 
			
		||||
    if (is_numeric($percent)) {
 | 
			
		||||
        discover_mempool($valid_mempool, $device, 0, 'ServerIron', 'Dynamic Memory', '1', null, null);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,39 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == "serveriron") {
 | 
			
		||||
    echo("serveriron : ");
 | 
			
		||||
if ($device['os'] == 'serveriron') {
 | 
			
		||||
    echo 'ServerIron : ';
 | 
			
		||||
    $processors_array = snmpwalk_cache_triple_oid($device, 'snAgentCpuUtilEntry', $processors_array, 'FOUNDRY-SN-AGENT-MIB');
 | 
			
		||||
    d_echo($processors_array);
 | 
			
		||||
 | 
			
		||||
    $descr = "CPU";
 | 
			
		||||
    $usage = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq");
 | 
			
		||||
    foreach ($processors_array as $index => $entry) {
 | 
			
		||||
        if (($entry['snAgentCpuUtilValue'] || $entry['snAgentCpuUtil100thPercent']) && $entry['snAgentCpuUtilInterval'] == '300') {
 | 
			
		||||
            // $entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex'];
 | 
			
		||||
            if ($entry['snAgentCpuUtil100thPercent']) {
 | 
			
		||||
                $usage_oid = '.1.3.6.1.4.1.1991.1.1.2.11.1.1.6.'.$index;
 | 
			
		||||
                $usage     = $entry['snAgentCpuUtil100thPercent'];
 | 
			
		||||
                $precision = 100;
 | 
			
		||||
            }
 | 
			
		||||
            else if ($entry['snAgentCpuUtilValue']) {
 | 
			
		||||
                $usage_oid = '.1.3.6.1.4.1.1991.1.1.2.11.1.1.4.'.$index;
 | 
			
		||||
                $usage     = $entry['snAgentCpuUtilValue'];
 | 
			
		||||
                $precision = 100;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
    if (is_numeric($usage)) {
 | 
			
		||||
        discover_processor($valid['processor'], $device, "1.3.6.1.4.1.1588.2.1.1.1.26.1", "0", "serveriron", $descr, "1", $usage, NULL, NULL);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
            list($slot, $instance, $interval) = explode('.', $index);
 | 
			
		||||
 | 
			
		||||
unset ($processors_array);
 | 
			
		||||
            $descr_oid   = 'snAgentConfigModuleDescription.'.$entry['snAgentCpuUtilSlotNum'];
 | 
			
		||||
            $descr       = snmp_get($device, $descr_oid, '-Oqv', 'FOUNDRY-SN-AGENT-MIB');
 | 
			
		||||
            $descr       = str_replace('"', '', $descr);
 | 
			
		||||
            list($descr) = explode(' ', $descr);
 | 
			
		||||
 | 
			
		||||
            $descr = 'Slot '.$entry['snAgentCpuUtilSlotNum'].' '.$descr;
 | 
			
		||||
            $descr = $descr.' ['.$instance.']';
 | 
			
		||||
 | 
			
		||||
            if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
 | 
			
		||||
                discover_processor($valid['processor'], $device, $usage_oid, $index, 'serveriron', $descr, $precision, $usage, $entPhysicalIndex, null);
 | 
			
		||||
            }
 | 
			
		||||
        }//end if
 | 
			
		||||
    }//end foreach
 | 
			
		||||
}//end if
 | 
			
		||||
 | 
			
		||||
unset($processors_array);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
// Somewhat of an uggly hack since Server doesn't support fetching total memory of the device over SNMP
 | 
			
		||||
// Given OID returns usage in percent so we set total to 100 in order to get a proper graph
 | 
			
		||||
$mempool['total'] 	= "100";
 | 
			
		||||
$mempool['used'] 	= snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
 | 
			
		||||
$mempool['free'] 	= ($mempool['total'] - $mempool['used']); 
 | 
			
		||||
// Simple hard-coded poller for Brocade Ironware Dynamic Memory (old style)
 | 
			
		||||
// Yes, it really can be this simple.
 | 
			
		||||
$mempool['total'] = snmp_get($device, 'snAgGblDynMemTotal.0', '-OvQ', 'FOUNDRY-SN-AGENT-MIB');
 | 
			
		||||
$mempool['free']  = snmp_get($device, 'snAgGblDynMemFree.0', '-OvQ', 'FOUNDRY-SN-AGENT-MIB');
 | 
			
		||||
$mempool['used']  = ($mempool['total'] - $mempool['free']);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
$proc = trim(snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq"),'"');
 | 
			
		||||
		Reference in New Issue
	
	Block a user