Example #1
0
function snmp_translate($oid, $mib = NULL, $mibdir = NULL)
{
    // $rewrite_oids set in rewrites.php
    global $rewrite_oids, $config, $debug;
    if ($mib) {
        // If $mib::$oid known in $rewrite_oids use this value instead shell command snmptranslate.
        if (isset($rewrite_oids[$mib][$oid])) {
            if ($debug) {
                echo "TRANSLATE (REWRITE):[" . $rewrite_oids[$mib][$oid] . "]\n";
            }
            return $rewrite_oids[$mib][$oid];
        }
        $oid = "{$mib}::{$oid}";
    }
    $cmd = $config['snmptranslate'];
    if ($options) {
        $cmd .= ' ' . $options;
    } else {
        $cmd .= ' -On';
    }
    if ($mib) {
        $cmd .= ' -m ' . $mib;
    }
    if ($mibdir) {
        $cmd .= ' -M ' . $mibdir;
    } else {
        $cmd .= ' -M ' . mib_dirs();
    }
    $cmd .= ' ' . $oid;
    if (!$debug) {
        $cmd .= ' 2>/dev/null';
    }
    $data = trim(external_exec($cmd));
    if ($data && !strstr($data, 'Unknown')) {
        if ($debug) {
            echo "TRANSLATE (CMD): {$oid} [" . $data . "]";
        }
        return $data;
    } else {
        return '';
    }
}
<?php

// Ignore this discovery module if we have already discovered things in CISCO-ENHANCED-MEMPOOL-MIB. Dirty duplication.
if (!isset($valid['mempool']['cisco-enhanced-mempool-mib'])) {
    $mib = 'CISCO-MEMORY-POOL-MIB';
    echo " {$mib} ";
    $mempool_array = snmpwalk_cache_oid($device, 'ciscoMemoryPool', NULL, $mib, mib_dirs('cisco'));
    if (is_array($mempool_array)) {
        foreach ($mempool_array as $index => $entry) {
            if (is_numeric($entry['ciscoMemoryPoolUsed']) && is_numeric($index)) {
                $descr = $entry['ciscoMemoryPoolName'];
                $used = $entry['ciscoMemoryPoolUsed'];
                $free = $entry['ciscoMemoryPoolFree'];
                $total = $used + $free;
                discover_mempool($valid['mempool'], $device, $index, $mib, $descr, 1, $total, $used);
            }
        }
    }
    unset($mempool_array, $index, $descr, $total, $used, $free);
}
// EOF
Example #3
0
<?php

# NETSWITCH-MIB::hpGlobalMemSlotIndex.1 = INTEGER: 1
# NETSWITCH-MIB::hpGlobalMemSlabCnt.1 = Counter32: 3966
# NETSWITCH-MIB::hpGlobalMemFreeSegCnt.1 = Counter32: 166
# NETSWITCH-MIB::hpGlobalMemAllocSegCnt.1 = Counter32: 3803
# NETSWITCH-MIB::hpGlobalMemTotalBytes.1 = INTEGER: 11337704
# NETSWITCH-MIB::hpGlobalMemFreeBytes.1 = INTEGER: 9669104
# NETSWITCH-MIB::hpGlobalMemAllocBytes.1 = INTEGER: 1668728
if (!is_array($mempool_cache['hpGlobal'])) {
    $mempool_cache['hpGlobal'] = snmpwalk_cache_oid($device, "hpGlobal", NULL, "NETSWITCH-MIB", mib_dirs('hp'));
    if ($debug) {
        print_r($mempool_cache);
    }
} else {
    if ($debug) {
        echo "Cached!";
    }
}
$entry = $mempool_cache['hpGlobal'][$mempool[mempool_index]];
$mempool['units'] = "1";
$mempool['used'] = $entry['hpGlobalMemAllocBytes'];
$mempool['total'] = $entry['hpGlobalMemTotalBytes'];
$mempool['free'] = $entry['hpGlobalMemFreeBytes'];
Example #4
0
<?php

///
//  Hardcoded discovery of cpu usage on HP Procurve devices.
///
//  STATISTICS-MIB::hpSwitchCpuStat.0 = INTEGER: 10
if ($device['os'] == "procurve") {
    echo "Procurve : ";
    $descr = "Processor";
    $usage = snmp_get($device, ".1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "-OQUvs", "STATISTICS-MIB", mib_dirs('hp'));
    if (is_numeric($usage)) {
        discover_processor($valid['processor'], $device, "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "0", "procurve-fixed", $descr, "1", $usage, NULL, NULL);
    }
}
unset($processors_array);
Example #5
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
#NS-ROOT-MIB::sysHardwareVersionDesc.0 = STRING: "7000 v1 6*EZ+2*EM"
#NS-ROOT-MIB::sysBuildVersion.0 = STRING: "NetScaler NS8.1: Build 69.4, Date: Jan 28 2010, 02:00:43  "
$hardware = str_replace("\"", "", snmp_get($device, "sysHardwareVersionDesc.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
$version = str_replace("\"", "", snmp_get($device, "sysBuildVersion.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
$serial = str_replace("\"", "", snmp_get($device, "sysHardwareSerialNumber.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
list($version, $features) = explode(":", $version);
list(, $version) = explode(" ", $version);
list($features) = explode(",", trim($features));
// EOF
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Yes, that's the Kenel version.
$version = "Kernel " . trim(snmp_get($device, "entKenelVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
$version .= " / Apps " . trim(snmp_get($device, "entAppVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
$serial = trim(snmp_get($device, "entSN.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
// There doesn't seem to be a real hardware identification.. sysName will have to do?
$hardware = str_replace("EnGenius ", "", snmp_get($device, "sysName.0", "-OQv")) . " v" . trim(snmp_get($device, "entHwVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" .');
$mode = snmp_get($device, "entSysMode.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao'));
switch ($mode) {
    case 0:
        $features = "Router mode";
        break;
    case 1:
        $features = "Universal repeater mode";
        break;
    case 2:
        $features = "Access Point mode";
        break;
    case 3:
        $features = "Client Bridge mode";
        break;
    case 4:
        $features = "Client router mode";
Example #7
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$hardware = trim(snmp_get($device, "spManufName.0", "-OQv", "SPAGENT-MIB", mib_dirs('akcp')), '"');
$hardware .= ' ' . trim(snmp_get($device, "spProductName.0", "-OQv", "SPAGENT-MIB", mib_dirs('akcp')), '" ');
// EOF
function createHost($hostname, $snmp_community = NULL, $snmp_version, $snmp_port = 161, $snmp_transport = 'udp', $snmp_v3 = array())
{
    $hostname = trim(strtolower($hostname));
    $device = array('hostname' => $hostname, 'sysName' => $hostname, 'status' => '1', 'snmp_community' => $snmp_community, 'snmp_port' => $snmp_port, 'snmp_transport' => $snmp_transport, 'snmp_version' => $snmp_version);
    // Add snmp v3 auth params
    foreach (array('authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $v3_key) {
        if (isset($snmp_v3['snmp_' . $v3_key])) {
            // Or $snmp_v3['snmp_authlevel']
            $device['snmp_' . $v3_key] = $snmp_v3['snmp_' . $v3_key];
        } else {
            if (isset($snmp_v3[$v3_key])) {
                // Or $snmp_v3['authlevel']
                $device['snmp_' . $v3_key] = $snmp_v3[$v3_key];
            }
        }
    }
    // This is compatibility code after refactor in r6306, for keep devices up before DB updated
    if (get_db_version() < 189) {
        // FIXME. Remove this in r7000
        $device['snmpver'] = $device['snmp_version'];
        unset($device['snmp_version']);
        foreach (array('transport', 'port', 'timeout', 'retries', 'community', 'authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $old_key) {
            if (isset($device['snmp_' . $old_key])) {
                // Convert to old device snmp keys
                $device[$old_key] = $device['snmp_' . $old_key];
                unset($device['snmp_' . $old_key]);
            }
        }
    }
    $device['os'] = get_device_os($device);
    $device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
    $device['sysName'] = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['location'] = snmp_get($device, "sysLocation.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['sysContact'] = snmp_get($device, "sysContact.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    if ($device['os']) {
        $device_id = dbInsert($device, 'devices');
        if ($device_id) {
            log_event("设备添加: {$hostname}", $device_id, 'device', $device_id, 5);
            // severity 5, for logging user/console info
            if (is_cli()) {
                print_success("正在使用自动发现功能 " . $device['hostname'] . " (id = " . $device_id . ")");
                $device['device_id'] = $device_id;
                // Discover things we need when linking this to other hosts.
                discover_device($device, $options = array('m' => 'ports'));
                discover_device($device, $options = array('m' => 'ipv4-addresses'));
                discover_device($device, $options = array('m' => 'ipv6-addresses'));
                log_event("snmpEngineID -> " . $device['snmpEngineID'], $device, 'device', $device['device_id']);
                // Reset `last_discovered` for full rediscover device by cron
                dbUpdate(array('last_discovered' => 'NULL'), 'devices', '`device_id` = ?', array($device_id));
                array_push($GLOBALS['devices'], $device_id);
            }
            return $device_id;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
 */
echo " GUDEADS-EPC8X-MIB ";
// GUDEADS-EPC8X-MIB::epc8TempSensor.1 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8TempSensor.2 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8HygroSensor.1 = INTEGER: -9999 10th of percentage humidity
// GUDEADS-EPC8X-MIB::epc8HygroSensor.2 = INTEGER: -9999 10th of percentage humidity
$cache['epc8x'] = snmpwalk_cache_multi_oid($device, "epc8SensorTable", array(), "GUDEADS-EPC8X-MIB", mib_dirs('gude'));
$scale = 0.1;
foreach ($cache['epc8x'] as $index => $entry) {
    $oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.2.{$index}";
    $descr = "Temp Sensor {$index}";
    $value = $entry['epc8TempSensor'];
    if ($value != '' && $value != -9999) {
        discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'epc8TempSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
    }
    $oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.3.{$index}";
    $descr = "Hygro Sensor {$index}";
    $value = $entry['epc8HygroSensor'];
    if ($value != '' && $value != -9999) {
        discover_sensor($valid['sensor'], 'humidity', $device, $oid, 'epc8HygroSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
    }
}
// GUDEADS-EPC8X-MIB::epc8Irms.0 = INTEGER: 3121 mA
$oid = ".1.3.6.1.4.1.28507.1.1.3.1.0";
$descr = "Output";
$value = snmp_get($device, "epc8Irms.0", "-Oqv", "GUDEADS-EPC8X-MIB", mib_dirs('gude'));
$scale = 0.001;
if ($value != '' && $value != -9999) {
    discover_sensor($valid['sensor'], 'current', $device, $oid, 'epc8Irms.0', 'epc8x', $descr, $scale, $value * $scale);
}
// EOF
echo " FOUNDRY-SN-AGENT-MIB ";
$processors_array = snmpwalk_cache_triple_oid($device, "snAgentCpuUtilEntry", $processors_array, "FOUNDRY-SN-AGENT-MIB", mib_dirs('foundry'));
if ($debug) {
    print_vars($processors_array);
}
foreach ($processors_array as $index => $entry) {
    if ((isset($entry['snAgentCpuUtilValue']) || isset($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;
        } elseif ($entry['snAgentCpuUtilValue']) {
            $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index;
            $usage = $entry['snAgentCpuUtilValue'];
            $precision = 100;
        }
        list($slot, $instance, $interval) = explode(".", $index);
        $descr_oid = "snAgentConfigModuleDescription." . $entry['snAgentCpuUtilSlotNum'];
        $descr = snmp_get($device, $descr_oid, "-Oqv", "FOUNDRY-SN-AGENT-MIB", mib_dirs('foundry'));
        $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, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL);
        }
    }
}
unset($processors_array);
// EOF
<?php

//  Hardcoded discovery of cpu usage on WatchGuard devices.
//
//  WATCHGUARD-SYSTEM-STATISTICS-MIB::wgSystemCpuUtil5.0 = COUNTER: 123
echo " WATCHGUARD-SYSTEM-STATISTICS-MIB ";
$descr = "Processor";
$usage = snmp_get($device, ".1.3.6.1.4.1.3097.6.3.78.0", "-OQUvs", "WATCHGUARD-SYSTEM-STATISTICS-MIB", $config['mib_dir'] . ':' . mib_dirs('watchguard'));
if (is_numeric($usage)) {
    discover_processor($valid['processor'], $device, "1.3.6.1.4.1.3097.6.3.78.0", "0", "firebox-fixed", $descr, "100", $usage, NULL, NULL);
}
// EOF
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// This could do with a decent rewrite using SNMP multi functions, instead of trim() and str_replace() voodoo.
echo " FOUNDRY-SN-AGENT-MIB ";
$oids = trim(snmp_walk($device, "snAgentTempSensorDescr", "-Osqn", "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry')));
$oids = str_replace(".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.", "", $oids);
foreach (explode("\n", $oids) as $data) {
    $data = trim($data);
    if ($data != "") {
        list($oid) = explode(" ", $data);
        $temperature_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.{$oid}";
        $descr_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.{$oid}";
        $descr = snmp_get($device, $descr_oid, "-Oqv", "");
        $temperature = snmp_get($device, $temperature_oid, "-Oqv", "");
        if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" && $temperature != "0") {
            $descr = str_replace("\"", "", $descr);
            $descr = str_replace("temperature", "", $descr);
            $descr = str_replace("temperature", "", $descr);
            $descr = str_replace("sensor", "Sensor", $descr);
            $descr = str_replace("Line module", "Slot", $descr);
            $descr = str_replace("Switch Fabric module", "Fabric", $descr);
Example #13
0
function createHost($host, $community = NULL, $snmpver, $port = 161, $transport = 'udp', $v3 = array())
{
    $host = trim(strtolower($host));
    $device = array('hostname' => $host, 'sysName' => $host, 'community' => $community, 'port' => $port, 'transport' => $transport, 'status' => '1', 'snmpver' => $snmpver);
    $device = array_merge($device, $v3);
    $device['os'] = get_device_os($device);
    $device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
    $device['sysName'] = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['location'] = snmp_get($device, "sysLocation.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['sysContact'] = snmp_get($device, "sysContact.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    if ($device['os']) {
        $device_id = dbInsert($device, 'devices');
        if ($device_id) {
            log_event("Device added: {$host}", $device_id, 'device');
            if (is_cli()) {
                print_success("Now discovering " . $device['hostname'] . " (id = " . $device_id . ")");
                $device['device_id'] = $device_id;
                // Discover things we need when linking this to other hosts.
                discover_device($device, $options = array('m' => 'ports'));
                discover_device($device, $options = array('m' => 'ipv4-addresses'));
                discover_device($device, $options = array('m' => 'ipv6-addresses'));
                log_event("snmpEngineID -> " . $device['snmpEngineID'], $device, 'system');
                // Reset `last_discovered` for full rediscover device by cron
                dbUpdate(array('last_discovered' => 'NULL'), 'devices', '`device_id` = ?', array($device_id));
                array_push($GLOBALS['devices'], $device_id);
            }
            return $device_id;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$mib = 'HOST-RESOURCES-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
if (is_array($mempool_array)) {
    foreach ($mempool_array as $index => $entry) {
        $descr = $entry['hrStorageDescr'];
        $units = $entry['hrStorageAllocationUnits'];
        $total = $entry['hrStorageSize'] * $units;
        $used = $entry['hrStorageUsed'] * $units;
        $deny = TRUE;
        switch ($entry['hrStorageType']) {
            case 'hrStorageVirtualMemory':
            case 'hrStorageRam':
            case 'hrStorageOther':
            case 'hrStorageTypes.20':
            case 'nwhrStorageDOSMemory':
            case 'nwhrStorageMemoryAlloc':
            case 'nwhrStorageMemoryPermanent':
            case 'nwhrStorageCacheBuffers':
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutOctWraps.0 = Counter32: 126 Integral units
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutUncompOctets.0 = Counter32: 3486168696 Octets
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalHcOutUncompOctets.0 = Counter64: 544652047992 Octets
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutUncompOctWraps.0 = Counter32: 126 Integral units
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutPkts.0 = Counter32: 828696339 Packets
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutDrops.0 = Counter32: 4520 Packets
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutAuths.0 = Counter32: 828696339 Events
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutAuthFails.0 = Counter32: 0 Failures
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutEncrypts.0 = Counter32: 828696318 Packets
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutEncryptFails.0 = Counter32: 0 Failures
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalProtocolUseFails.0 = Counter32: 0 Failures
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalNoSaFails.0 = Counter32: 5 Failures
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalSysCapFails.0 = Counter32: 0 Failures
// FIXME. Candidate for migrate to graphs module with table_collect()
if (is_device_mib($device, 'CISCO-IPSEC-FLOW-MONITOR-MIB')) {
    $data = snmpwalk_cache_oid($device, "cipSecGlobalStats", NULL, "CISCO-IPSEC-FLOW-MONITOR-MIB", mib_dirs('cisco'));
    $data = $data[0];
    // Use HC Counters if they exist
    if (is_numeric($data['cipSecGlobalHcInOctets'])) {
        $data['cipSecGlobalInOctets'] = $data['cipSecGlobalHcInOctets'];
    }
    if (is_numeric($data['cipSecGlobalHcOutOctets'])) {
        $data['cipSecGlobalOutOctets'] = $data['cipSecGlobalHcOutOctets'];
    }
    if (is_numeric($data['cipSecGlobalHcInDecompOctets'])) {
        $data['cipSecGlobalInDecompOctets'] = $data['cipSecGlobalHcInDecompOctets'];
    }
    if (is_numeric($data['cipSecGlobalHcOutUncompOctets'])) {
        $data['cipSecGlobalOutUncompOctets'] = $data['cipSecGlobalHcOutUncompOctets'];
    }
    $rrd_filename = "cipsec_flow.rrd";
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Note. $cache_discovery['ucd-snmp-mib'] - is cached 'UCD-SNMP-MIB::dskEntry' (see ucd-snmp-mib.inc.php in current directory)
$mib = 'HOST-RESOURCES-MIB';
if (!isset($cache_discovery['host-resources-mib'])) {
    $cache_discovery['host-resources-mib'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
    if (OBS_DEBUG && count($cache_discovery['host-resources-mib'])) {
        print_vars($cache_discovery['host-resources-mib']);
    }
}
if (count($cache_discovery['host-resources-mib'])) {
    echo " {$mib} ";
    foreach ($cache_discovery['host-resources-mib'] as $index => $storage) {
        $hc = 0;
        $mib = 'HOST-RESOURCES-MIB';
        $fstype = $storage['hrStorageType'];
        $descr = $storage['hrStorageDescr'];
        $units = $storage['hrStorageAllocationUnits'];
        $deny = FALSE;
        switch ($fstype) {
            case 'hrStorageVirtualMemory':
//.1.3.6.1.4.1.32050.2.1.27.5.0 = 303
//.1.3.6.1.4.1.32050.2.1.27.5.1 = -8
//.1.3.6.1.4.1.32050.2.1.27.5.2 = 529
//.1.3.6.1.4.1.32050.2.1.27.5.3 = 531
//.1.3.6.1.4.1.32050.2.1.27.5.4 = 0
//.1.3.6.1.4.1.32050.2.1.27.5.5 = 1000
//.1.3.6.1.4.1.32050.2.1.27.5.6 = -1000
//.1.3.6.1.4.1.32050.2.1.27.6.0 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.1 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.2 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.3 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.4 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.5 = 1000
//.1.3.6.1.4.1.32050.2.1.27.6.6 = -1000
$index_analog = '.1.3.6.1.4.1.32050.2.1.27';
$packetflux_analog = snmpwalk_numericoids($device, $index_analog, array(), 'SNMPv2', mib_dirs());
$oids_analog[0] = array('class' => 'temperature', 'divisor' => 10);
$oids_analog[1] = array('class' => 'voltage', 'divisor' => 10000);
$oids_analog[2] = array('class' => 'voltage', 'divisor' => 10);
$oids_analog[3] = array('class' => 'voltage', 'divisor' => 10);
$oids_analog[4] = array('class' => 'current', 'divisor' => 1000);
$oids_analog[5] = array('class' => 'temperature', 'divisor' => 10);
// What is this?
$oids_analog[6] = array('class' => 'temperature', 'divisor' => 10);
// What is this?
foreach ($oids_analog as $index => $entry) {
    $oid = "{$index_analog}.5.{$index}";
    if (is_numeric($packetflux_analog[$oid])) {
        list($descr) = explode(' (', $packetflux_analog["{$index_analog}.2.{$index}"]);
        $class = $oids_analog[$index]['class'];
        $divisor = $oids_analog[$index]['divisor'];
Example #18
0
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo " GEIST-MIB-V3 ";
$productTitle = snmp_get($device, 'productTitle.0', '-OQv', 'GEIST-MIB-V3', mib_dirs('geist'));
if ($productTitle) {
    // Insert chassis as index 1, everything hangs off of this.
    $system_index = 1;
    $inventory[$system_index] = array('entPhysicalDescr' => $productTitle, 'entPhysicalClass' => 'chassis', 'entPhysicalName' => 'Chassis', 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 0, 'entPhysicalParentRelPos' => -1, 'entPhysicalMfgName' => 'Geist');
    discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
    $relPos = 1;
    // Note: sensors without example SNMP output have not been tested.
    $geist_sensors = array(array('descr' => 'Climate Monitor', 'prefix' => 'climate', 'oid' => 2, 'class' => 'sensor'), array('descr' => 'Power Monitor', 'prefix' => 'powMon', 'oid' => 3, 'class' => 'powerSupply', 'avail' => 1), array('descr' => 'Temperature Sensor', 'prefix' => 'tempSensor', 'oid' => 4, 'class' => 'sensor'), array('descr' => 'AF/HTD Sensor', 'prefix' => 'airFlowSensor', 'oid' => 5, 'class' => 'airflowSensor'), array('descr' => 'DELTA 3 Channel Controller', 'prefix' => 'ctrl3ChDELTA', 'oid' => 6, 'class' => 'sensor'), array('descr' => 'Door Sensor', 'prefix' => 'doorSensor', 'oid' => 7, 'class' => 'sensor'), array('descr' => 'Water Sensor', 'prefix' => 'waterSensor', 'oid' => 8, 'class' => 'sensor'), array('descr' => 'Current Sensor', 'prefix' => 'currentSensor', 'oid' => 9, 'class' => 'sensor'), array('descr' => 'Millivolt Sensor', 'prefix' => 'millivoltSensor', 'oid' => 10, 'class' => 'sensor'), array('descr' => '3 Channel Power Sensor', 'prefix' => 'power3ChSensor', 'oid' => 11, 'class' => 'sensor'), array('descr' => 'Outlet', 'prefix' => 'outlet', 'oid' => 12, 'class' => 'outlet'), array('descr' => 'Fan Controller Monitor', 'prefix' => 'vsfc', 'oid' => 13, 'class' => 'sensor'), array('descr' => '3 Channel Power Monitor', 'prefix' => 'ctrl3Ch', 'oid' => 14, 'class' => 'sensor'), array('descr' => 'Amperage Controller', 'prefix' => 'analogSensor', 'oid' => 15, 'class' => 'powerSupply'), array('descr' => 'Controlled outlet', 'prefix' => 'ctrlOutlet', 'oid' => 16, 'class' => 'outlet', 'avail' => 1), array('descr' => 'Dew Point Sensor', 'prefix' => 'dewpointSensor', 'oid' => 17, 'class' => 'sensor'), array('descr' => 'Digital Sensor', 'prefix' => 'digitalSensor', 'oid' => 18, 'class' => 'sensor'), array('descr' => 'DSTS Controller Sensor', 'prefix' => 'dstsSensor', 'oid' => 19, 'class' => 'sensor'), array('descr' => 'City Power Sensor', 'prefix' => 'cpmSensor', 'oid' => 20, 'class' => 'sensor'), array('descr' => 'Smoke Alarm Sensor', 'prefix' => 'smokeAlarm', 'oid' => 21, 'class' => 'sensor'), array('descr' => '-48VDC Sensor', 'prefix' => 'neg48VdcSensor', 'oid' => 22, 'class' => 'sensor'), array('descr' => '+30VDC Sensor', 'prefix' => 'pos30VdcSensor', 'oid' => 23, 'class' => 'sensor'), array('descr' => 'Analog Sensor', 'prefix' => 'analogSensor', 'oid' => 24, 'class' => 'sensor'), array('descr' => '3 Channel IEC Power Monitor', 'prefix' => 'ctrl3ChIEC', 'oid' => 25, 'class' => 'powerSupply'), array('descr' => 'Climate Relay Monitor', 'prefix' => 'climateRelay', 'oid' => 26, 'class' => 'sensor'), array('descr' => 'Controlled Relay', 'prefix' => 'ctrlRelay', 'oid' => 27, 'class' => 'relay', 'avail' => 1), array('descr' => 'Airspeed Switch Sensor', 'prefix' => 'airSpeedSwitchSensor', 'oid' => 28, 'class' => 'sensor'), array('descr' => 'DM16/48 Current Sensor', 'prefix' => 'powerDM', 'oid' => 29, 'class' => 'sensor'), array('descr' => 'I/O Expander', 'prefix' => 'ioExpander', 'oid' => 30, 'class' => 'sensor'), array('descr' => 'T3HD Sensor', 'prefix' => 't3hdSensor', 'oid' => 31, 'class' => 'sensor'), array('descr' => 'THD Sensor', 'prefix' => 'thdSensor', 'oid' => 32, 'class' => 'sensor'), array('descr' => '+60VDC Sensor', 'prefix' => 'pos60VdcSensor', 'oid' => 33, 'class' => 'sensor'), array('descr' => '3Phase Outlet Control', 'prefix' => 'ctrl2CirTot', 'oid' => 34, 'class' => 'outlet'), array('descr' => 'SC10 Sensor', 'prefix' => 'sc10Sensor', 'oid' => 35, 'class' => 'sensor'));
    foreach ($geist_sensors as $sensor) {
        $cache['geist'][$sensor['prefix'] . 'Table'] = snmpwalk_cache_multi_oid($device, $sensor['prefix'] . 'Table', array(), "GEIST-MIB-V3", mib_dirs('geist'));
        foreach ($cache['geist'][$sensor['prefix'] . 'Table'] as $index => $entry) {
            // Index can only be int in the database, so we create our own from, this sensor is at 21239.2.$oid.
            $system_index = $sensor['oid'] * 256 + $index;
            if ($sensor['avail'] || $entry[$sensor['prefix'] . 'Avail']) {
                $inventory[$system_index] = array('entPhysicalDescr' => $sensor['descr'], 'entPhysicalClass' => $sensor['class'], 'entPhysicalName' => $entry[$sensor['prefix'] . 'Name'], 'entPhysicalSerialNum' => $entry[$sensor['prefix'] . 'Serial'], 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 1, 'entPhysicalParentRelPos' => $relPos, 'entPhysicalMfgName' => 'Geist');
                discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
                $relPos++;
            }
        }
    }
}
unset($geist_sensors);
// EOF
            list($type_msg, $ten_ms) = explode(":", $hrSystemUptime);
            $uptime = $ten_ms / 100;
            echo "Found Wrong type: interpreting as seconds instead of timeticks ({$uptime} seconds)\n";
            $uptime_msg = "Using integer SNMP Agent hrSystemUptime";
        } else {
            // HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65
            $uptime = timeticks_to_sec($hrSystemUptime);
            $uptime_msg = "Using SNMP Agent hrSystemUptime";
        }
    } else {
        // SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
        $uptime = timeticks_to_sec($poll_device['sysUpTime']);
        $uptime_msg = "Using SNMP Agent sysUpTime";
        // Last check snmpEngineTime and fix if needed uptime (sysUpTime 68 year rollover issue)
        // SNMP-FRAMEWORK-MIB::snmpEngineTime.0 = INTEGER: 72393514 seconds
        $snmpEngineTime = snmp_get($device, "snmpEngineTime.0", "-OUqv", "SNMP-FRAMEWORK-MIB", mib_dirs());
        if ($device['os'] == 'aos' && strlen($snmpEngineTime) > 8) {
            // Some Alcatel have bug with snmpEngineTime
            // http://jira.observium.org/browse/OBSERVIUM-763
            $snmpEngineTime = 0;
        } else {
            if (is_numeric($snmpEngineTime) && $snmpEngineTime > 0 && $snmpEngineTime > $uptime) {
                $polled = time();
                $uptime = $snmpEngineTime;
                $uptime_msg = "Using SNMP Agent snmpEngineTime";
            }
        }
    }
}
print_debug("{$uptime_msg} ({$uptime} seconds)");
if (is_numeric($uptime)) {
Example #20
0
if (is_numeric($discover['dbm'][0]['remCurrentRSL'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.3.0';
    $limits = array('limit_high' => $discover['dbm'][0]['remMaxRSL'], 'limit_low' => $discover['dbm'][0]['remMinRSL']);
    discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'remCurrentRSL.0', 'exaltcomproducts', "Received Signal Level (Far end radio)", 1, $discover['dbm'][0]['remCurrentRSL'], $limits);
}
//ExaltComProducts::locLinkState.0 = INTEGER: almNORMAL(0)
//ExaltComProducts::locErrorDuration.0 = INTEGER: 30 Seconds
//ExaltComProducts::locErrorDurationStr.0 = STRING: 30 seconds.
//ExaltComProducts::locUnavailDuration.0 = INTEGER: 0 Seconds
//ExaltComProducts::locUnavailDurationStr.0 = STRING: 0 seconds.
//ExaltComProducts::remLinkState.0 = INTEGER: almNORMAL(0)
//ExaltComProducts::remErrorDuration.0 = INTEGER: 3 Seconds
//ExaltComProducts::remErrorDurationStr.0 = STRING: 3 seconds.
//ExaltComProducts::remUnavailDuration.0 = INTEGER: 0 Seconds
//ExaltComProducts::remUnavailDurationStr.0 = STRING: 0 seconds.
$discover['state'] = snmp_get_multi($device, 'locLinkState.0 locErrorDuration.0 locUnavailDuration.0 remLinkState.0 remErrorDuration.0 remUnavailDuration.0', '-OQUs', 'ExaltComProducts', mib_dirs('exalt'));
$sensor_state_type = 'exaltcomproducts-state';
$options = array('entPhysicalClass' => 'linkstate');
if (!empty($discover['state'][0]['locLinkState'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.1.0';
    $value = state_string_to_numeric($sensor_state_type, $discover['state'][0]['locLinkState']);
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'locLinkState.0', $sensor_state_type, "Link Status (Internal)", NULL, $value, $options);
}
if (!empty($discover['state'][0]['remLinkState'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.1.0';
    $value = state_string_to_numeric($sensor_state_type, $discover['state'][0]['remLinkState']);
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'remLinkState.0', $sensor_state_type, "Link Status (Far end radio)", NULL, $value, $options);
}
if (is_numeric($discover['state'][0]['locErrorDuration']) && is_numeric($discover['state'][0]['locUnavailDuration'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.5.0';
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'locErrorDuration.0', 'exaltcomproducts', "Errored Seconds (Internal)", 1, $discover['state'][0]['locErrorDuration']);
Example #21
0
    $hw = $entPhysical['entPhysicalDescr'];
    if (!empty($entPhysical['entPhysicalSerialNum'])) {
        $serial = $entPhysical['entPhysicalSerialNum'];
    }
}
$hardware = rewrite_unix_hardware($poll_device['sysDescr'], $hw);
// FIXME Below doesn't seem to belong here, but in a vminfo vmware poller module ...
/*
 * CONSOLE: Start the VMware discovery process.
 */
echo "VMware VM: ";
/*
 * Get a list of all the known Virtual Machines for this host.
 */
$db_info_list = dbFetchRows("SELECT * FROM vminfo WHERE device_id = ?", array($device["device_id"]));
$vm_data = snmpwalk_cache_oid($device, "vmwVmTable", array(), "VMWARE-VMINFO-MIB", mib_dirs(array("vmware")));
foreach ($db_info_list as $db_info) {
    /*
     * Fetch the Virtual Machine information.
     *
     *  VMWARE-VMINFO-MIB::vmwVmDisplayName.224 = STRING: My First VM
     *  VMWARE-VMINFO-MIB::vmwVmGuestOS.224 = STRING: windows7Server64Guest
     *  VMWARE-VMINFO-MIB::vmwVmMemSize.224 = INTEGER: 8192 megabytes
     *  VMWARE-VMINFO-MIB::vmwVmState.224 = STRING: poweredOn
     *  VMWARE-VMINFO-MIB::vmwVmVMID.224 = INTEGER: 224
     *  VMWARE-VMINFO-MIB::vmwVmCpus.224 = INTEGER: 2
     */
    $vm_info = $vm_data[$db_info["vmwVmVMID"]];
    #  $vm_info["vmwVmDisplayName"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmDisplayName." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB","+" . $config['install_dir'] . "/mibs/vmware:" . $config['install_dir'] . "/mibs");
    #  $vm_info["vmwVmGuestOS"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmGuestOS."   . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB","+" . $config['install_dir'] . "/mibs/vmware:" . $config['install_dir'] . "/mibs");
    #  $vm_info["vmwVmMemSize"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmMemSize."   . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB","+" . $config['install_dir'] . "/mibs/vmware:" . $config['install_dir'] . "/mibs");
$netstats_poll['snmp']['oids'] = array('snmpInPkts', 'snmpOutPkts', 'snmpInBadVersions', 'snmpInBadCommunityNames', 'snmpInBadCommunityUses', 'snmpInASNParseErrs', 'snmpInTooBigs', 'snmpInNoSuchNames', 'snmpInBadValues', 'snmpInReadOnlys', 'snmpInGenErrs', 'snmpInTotalReqVars', 'snmpInTotalSetVars', 'snmpInGetRequests', 'snmpInGetNexts', 'snmpInSetRequests', 'snmpInGetResponses', 'snmpInTraps', 'snmpOutTooBigs', 'snmpOutNoSuchNames', 'snmpOutBadValues', 'snmpOutGenErrs', 'snmpOutGetRequests', 'snmpOutGetNexts', 'snmpOutSetRequests', 'snmpOutGetResponses', 'snmpOutTraps', 'snmpSilentDrops', 'snmpProxyDrops');
foreach ($netstats_poll as $type => $netstats) {
    $oids = $netstats['oids'];
    if (isset($netstats['oids_t'])) {
        $oids_string = implode('.0 ', $netstats['oids_t']) . '.0';
        $data = snmp_get_multi($device, $oids_string, '-OQUs', $netstats['mib'], mib_dirs());
        // get testing oids
        if (!count($data)) {
            continue;
        }
        $data_array = $data[0];
        $oids_string = implode('.0 ', array_diff($oids, $netstats['oids_t'])) . '.0';
        $data = snmp_get_multi($device, $oids_string, '-OQUs', $netstats['mib'], mib_dirs());
        $data_array += $data[0];
    } else {
        $data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib'], mib_dirs());
        if (!count($data)) {
            continue;
        }
        $data_array = $data[0];
    }
    echo strtoupper($type) . ' ';
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/netstats-' . $type . '.rrd';
    $rrd_create = '';
    $rrd_update = 'N';
    foreach ($oids as $oid) {
        $oid_ds = truncate($oid, 19, '');
        $rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295';
        // Counter32 max value 2^32 = 4294967295
        $value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U';
        $rrd_update .= ':' . $value;
<?php

//  Hardcoded discovery of device CPU usage on Alcatel-Lucent Omniswitches.
echo " ALCATEL-IND1-HEALTH-MIB ";
$descr = "Device CPU";
$usage = snmp_get($device, "1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0", "-OQUvs", "ALCATEL-IND1-HEALTH-MIB", mib_dirs('aos'));
if (is_numeric($usage)) {
    discover_processor($valid['processor'], $device, "1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0", "0", "aos-system", $descr, "1", $usage, NULL, NULL);
}
// EOF
Example #24
0
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage webinterface
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// FIXME - fewer includes!
include_once "../includes/defaults.inc.php";
include_once "../config.php";
include_once "../includes/definitions.inc.php";
include_once "../includes/common.inc.php";
include_once "../includes/dbFacile.php";
include_once "../includes/rewrites.inc.php";
include_once "includes/functions.inc.php";
include_once "includes/authenticate.inc.php";
include_once "../includes/snmp.inc.php";
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) {
    $port = get_port_by_id($_GET['id']);
    $device = device_by_id_cache($port['device_id']);
    $title = generate_device_link($device);
    $title .= " :: Port  " . generate_port_link($port);
    $auth = TRUE;
}
$time = time();
$HC = $port['port_64bit'] ? 'HC' : '';
$data = snmp_get_multi($device, "if{$HC}InOctets." . $port['ifIndex'] . " if{$HC}OutOctets." . $port['ifIndex'], "-OQUs", "IF-MIB", mib_dirs());
printf("%lf|%s|%s\n", time(), $data[$port['ifIndex']]["if{$HC}InOctets"], $data[$port['ifIndex']]["if{$HC}OutOctets"]);
// EOF
<?php

$mib = 'JUNIPER-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_multi_oid($device, "jnxOperatingBuffer", NULL, $mib, mib_dirs('junos'));
if (is_array($mempool_array)) {
    $mempool_array = snmpwalk_cache_multi_oid($device, "jnxOperatingMemory", $mempool_array, $mib, mib_dirs('junos'));
    $mempool_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $mempool_array, $mib, mib_dirs('junos'));
    $mempool_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $mempool_array, $mib, mib_dirs('junos'));
    foreach ($mempool_array as $index => $entry) {
        $descr = $entry['jnxOperatingDescr'];
        if (stripos($descr, "sensor") !== FALSE || stripos($descr, "fan") !== FALSE) {
            continue;
        }
        if ($entry['jnxOperatingDRAMSize']) {
            $precision = 1;
            $total = $entry['jnxOperatingDRAMSize'];
            // Size in bytes
        } elseif ($entry['jnxOperatingMemory']) {
            $precision = 1024 * 1024;
            $total = $entry['jnxOperatingMemory'] * $precision;
            // Size in megabytes
        } else {
            continue;
        }
        $percent = $entry['jnxOperatingBuffer'];
        $used = $total * $percent / 100;
        if (!strstr($descr, "No") && !strstr($percent, "No") && $descr != "") {
            discover_mempool($valid['mempool'], $device, $index, $mib, $descr, $precision, $total, $used);
        }
    }
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Huawei VRP  mempools
$mib = 'HUAWEI-ENTITY-EXTENT-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", NULL, $mib, mib_dirs('huawei'));
if (is_array($mempool_array)) {
    $mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempool_array, $mib, mib_dirs('huawei'));
    $mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityBomEnDesc", $mempool_array, $mib, mib_dirs('huawei'));
    foreach ($mempool_array as $index => $entry) {
        if (is_numeric($entry['hwEntityMemUsage']) && $entry['hwEntityMemSize'] > 0) {
            $descr = rewrite_entity_name($entry['hwEntityBomEnDesc']);
            $percent = $entry['hwEntityMemUsage'];
            if (!strstr($descr, "No") && !strstr($percent, "No") && $descr != "") {
                $total = $entry['hwEntityMemSize'];
                $used = $total * $percent / 100;
                discover_mempool($valid['mempool'], $device, $index, $mib, $descr, 1, $total, $used);
            }
        }
    }
}
unset($mempool_array, $index, $descr, $total, $used, $percent);
// EOF
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
echo " SPAGENT-MIB ";
echo "Caching OIDs: ";
$akcp_array = array();
echo "sensorProbeTempTable ";
$akcp_array = snmpwalk_cache_multi_oid($device, "sensorProbeTempTable", $akcp_array, "SPAGENT-MIB", mib_dirs('akcp'));
echo "sensorProbeHumidityTable ";
$akcp_array = snmpwalk_cache_multi_oid($device, "sensorProbeHumidityTable", $akcp_array, "SPAGENT-MIB", mib_dirs('akcp'));
echo "sensorProbeSwitchTable ";
$akcp_array = snmpwalk_cache_multi_oid($device, "sensorProbeSwitchTable", $akcp_array, "SPAGENT-MIB", mib_dirs('akcp'));
foreach ($akcp_array as $index => $entry) {
    if ($entry['sensorProbeTempStatus']) {
        # Temp sensor
        # FIXME do we need to take note of this? [sensorProbeTempOffset] => 0
        $descr = $entry['sensorProbeTempDescription'];
        $oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.{$index}";
        # SPAGENT-MIB:sensorProbeTempDegree.$index
        $value = $entry['sensorProbeTempDegree'];
        $limits = array('limit_high' => $entry['sensorProbeTempHighCritical'], 'limit_low' => $entry['sensorProbeTempLowCritical'], 'limit_high_warn' => $entry['sensorProbeTempHighWarning'], 'limit_low_warn' => $entry['sensorProbeTempLowWarning']);
        $scale_temp = 1;
        if ($entry['sensorProbeTempDegreeType'] == 'fahr') {
            $scale_temp = 5 / 9;
            //$value      = f2c($value);
            foreach (array('limit_high', 'limit_low', 'limit_high_warn', 'limit_low_warn') as $param) {
                $limits[$param] = f2c($limits[$param]);
<?php

$mib = 'NETSCREEN-RESOURCE-MIB';
echo " {$mib} ";
$used = snmp_get($device, "nsResMemAllocate.0", "-OvQ", $mib, mib_dirs('netscreen'));
$free = snmp_get($device, "nsResMemLeft.0", "-OvQ", $mib, mib_dirs('netscreen'));
if (is_numeric($free) && is_numeric($used)) {
    $total = $free + $used;
    discover_mempool($valid['mempool'], $device, 0, $mib, "Memory", 1, $total, $used);
}
unset($total, $used, $free);
// EOF
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$mib = 'JUNIPER-SRX5000-SPU-MONITORING-MIB';
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $cache_mempool, $mib, mib_dirs('junos'));
$mempool['perc'] = $cache_mempool[$index]['jnxJsSPUMonitoringMemoryUsage'];
// EOF
Example #30
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$mib = 'CISCO-PROCESS-MIB';
foreach (array('cpmCPUMemoryUsed', 'cpmCPUMemoryFree') as $oid) {
    $cache_mempool = snmpwalk_cache_multi_oid($device, $oid, $cache_mempool, $mib, mib_dirs('cisco'));
}
$index = $mempool['mempool_index'];
$mempool['used'] = $cache_mempool[$index]['cpmCPUMemoryUsed'];
$mempool['free'] = $cache_mempool[$index]['cpmCPUMemoryFree'];
$mempool['total'] = $mempool['used'] + $mempool['free'];
// EOF