Esempio n. 1
0
                if (stripos($entry['jnxOperatingDescr'], 'sensor') || stripos($entry['jnxOperatingDescr'], 'fan')) {
                    continue;
                }
                d_echo($index . ' ' . $entry['jnxOperatingDescr'] . ' -> ' . $entry['jnxOperatingBuffer'] . ' -> ' . $entry['jnxOperatingDRAMSize'] . "\n");
                $usage_oid = '.1.3.6.1.4.1.2636.3.1.13.1.8.' . $index;
                $descr = $entry['jnxOperatingDescr'];
                $usage = $entry['jnxOperatingBuffer'];
                if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
                    discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
                }
            }
            //end if
        }
        //end foreach
    } else {
        $srx_mempools_array = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $srx_mempools_array, 'JUNIPER-SRX5000-SPU-MONITORING-MIB', 'junos');
        if (is_array($srx_mempools_array)) {
            foreach ($srx_mempools_array as $index => $entry) {
                if ($index) {
                    $usage_oid = '.1.3.6.1.4.1.2636.3.39.1.12.1.1.1.5.' . $index;
                    $descr = 'Memory';
                    // No description in the table?
                    $usage = $entry['jnxJsSPUMonitoringMemoryUsage'];
                    discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
                }
            }
        }
    }
}
//end if
unset($mempools_array);
<?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
Esempio n. 3
0
                     $j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
                     break;
                 case 'ipv6':
                     $ip6 = trim(str_replace(' ', '', $entry['jnxBgpM2PeerRemoteAddr']), '"');
                     $ip6 = substr($ip6, 0, 4) . ':' . substr($ip6, 4, 4) . ':' . substr($ip6, 8, 4) . ':' . substr($ip6, 12, 4) . ':' . substr($ip6, 16, 4) . ':' . substr($ip6, 20, 4) . ':' . substr($ip6, 24, 4) . ':' . substr($ip6, 28, 4);
                     $ip6 = Net_IPv6::compress($ip6);
                     $j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
                     break;
                 default:
                     echo "PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n";
                     break;
             }
         }
     }
     //end if
     $j_prefixes = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PrefixCountersTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'] . '/mibs/junos');
     $cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
     $cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
     $cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
     unset($j_prefixes);
     unset($j_bgp);
     unset($j_peerIndexes);
 }
 //end if
 // FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
 $update = 'UPDATE bgpPeers_cbgp SET';
 $peer['c_update']['AcceptedPrefixes'] = $cbgpPeerAcceptedPrefixes;
 $peer['c_update']['DeniedPrefixes'] = $cbgpPeerDeniedPrefixes;
 $peer['c_update']['PrefixAdminLimit'] = $cbgpPeerAdminLimit;
 $peer['c_update']['PrefixThreshold'] = $cbgpPeerPrefixThreshold;
 $peer['c_update']['PrefixClearThreshold'] = $cbgpPeerPrefixClearThreshold;
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$cache_mempool = snmpwalk_cache_multi_oid($device, 'oacSysMemStatistics', $cache_mempool, 'ONEACCESS-SYS-MIB');
$index = $mempool['mempool_index'];
$mempool['total'] = $cache_mempool[$index]['oacSysMemoryTotal'];
$mempool['used'] = $cache_mempool[$index]['oacSysMemoryAllocated'];
$mempool['free'] = $cache_mempool[$index]['oacSysMemoryFree'];
// EOF
Esempio n. 5
0
<?php

/*
 * LibreNMS
 *
 * Copyright (c) 2016 Søren Friis Rosiak <*****@*****.**> 
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
if (strstr($device['hardware'], 'Dell')) {
    $tables = array(array('processorDeviceStatusTable', '.1.3.6.1.4.1.674.10892.1.1100.32.1.5.', 'processorDeviceStatusStatus', 'processorDeviceStatusLocationName', 'MIB-Dell-10892'), array('memoryDeviceTable', '.1.3.6.1.4.1.674.10892.1.1100.50.1.5.', 'memoryDeviceStatus', 'memoryDeviceLocationName', 'MIB-Dell-10892'), array('powerSupplyTable', '.1.3.6.1.4.1.674.10892.1.600.12.1.5.', 'powerSupplyStatus', 'powerSupplyLocationName', 'MIB-Dell-10892'), array('intrusionTable', '.1.3.6.1.4.1.674.10892.1.300.70.1.5.', 'intrusionStatus', 'Intrusion', 'MIB-Dell-10892'), array('controllerTable', '.1.3.6.1.4.1.674.10893.1.20.130.1.1.5.', 'controllerState', 'controllerName', 'StorageManagement-MIB'), array('arrayDiskTable', '.1.3.6.1.4.1.674.10893.1.20.130.4.1.4.', 'arrayDiskState', 'arrayDiskName', 'StorageManagement-MIB'), array('virtualDiskTable', '.1.3.6.1.4.1.674.10893.1.20.140.1.1.4.', 'virtualDiskState', 'virtualDiskDeviceName', 'StorageManagement-MIB'), array('batteryTable', '.1.3.6.1.4.1.674.10893.1.20.130.15.1.4.', 'batteryState', 'batteryName', 'StorageManagement-MIB'));
    foreach ($tables as $tablevalue) {
        $temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), $tablevalue[4]);
        $cur_oid = $tablevalue[1];
        if (is_array($temp)) {
            //Create State Index
            $state_name = $tablevalue[2];
            $state_index_id = create_state_index($state_name);
            //Create State Translation
            if ($state_index_id !== null) {
                if ($state_name == 'processorDeviceStatusStatus' || $state_name == 'memoryDeviceStatus' || $state_name == 'powerSupplyStatus' || $state_name == 'intrusionStatus') {
                    $states = array(array($state_index_id, 'other', 0, 1, 3), array($state_index_id, 'unknown', 0, 2, 3), array($state_index_id, 'ok', 0, 3, 0), array($state_index_id, 'nonCritical', 0, 4, 1), array($state_index_id, 'critical', 0, 5, 2), array($state_index_id, 'nonRecoverable', 0, 6, 2));
                } elseif ($state_name == 'controllerState') {
                    $states = array(array($state_index_id, 'ready', 0, 1, 0), array($state_index_id, 'failed', 0, 2, 2), array($state_index_id, 'online', 0, 3, 0), array($state_index_id, 'offline', 0, 4, 1), array($state_index_id, 'degraded', 0, 6, 2));
                } elseif ($state_name == 'arrayDiskState') {
                    $states = array(array($state_index_id, 'ready', 0, 1, 0), array($state_index_id, 'failed', 0, 2, 2), array($state_index_id, 'online', 0, 3, 0), array($state_index_id, 'offline', 0, 4, 2), array($state_index_id, 'degraded', 0, 5, 2), array($state_index_id, 'recovering', 0, 6, 1), array($state_index_id, 'removed', 0, 7, 1), array($state_index_id, 'non-raid', 0, 8, 3), array($state_index_id, 'notReady', 0, 9, 1), array($state_index_id, 'resynching', 0, 10, 1), array($state_index_id, 'replacing', 0, 11, 1), array($state_index_id, 'spinningDown', 0, 12, 1), array($state_index_id, 'rebuild', 0, 13, 1), array($state_index_id, 'noMedia', 0, 14, 1), array($state_index_id, 'formatting', 0, 15, 1), array($state_index_id, 'diagnostics', 0, 16, 1), array($state_index_id, 'predictiveFailure', 0, 17, 2), array($state_index_id, 'initializing', 0, 18, 1), array($state_index_id, 'foreign', 0, 19, 1), array($state_index_id, 'clear', 0, 20, 1), array($state_index_id, 'unsupported', 0, 21, 2), array($state_index_id, 'incompatible', 0, 22, 2), array($state_index_id, 'readOnly', 0, 23, 2));
                } elseif ($state_name == 'virtualDiskState') {
                    $states = array(array($state_index_id, 'unknown', 0, 0, 3), array($state_index_id, 'ready', 1, 1, 0), array($state_index_id, 'failed', 1, 2, 2), array($state_index_id, 'online', 1, 3, 1), array($state_index_id, 'offline', 1, 4, 2), array($state_index_id, 'degraded', 1, 6, 2), array($state_index_id, 'verifying', 1, 7, 1), array($state_index_id, 'resynching', 1, 15, 1), array($state_index_id, 'regenerating', 1, 16, 1), array($state_index_id, 'failedRedundancy', 1, 18, 2), array($state_index_id, 'rebuilding', 1, 24, 1), array($state_index_id, 'formatting', 1, 26, 1), array($state_index_id, 'reconstructing', 1, 32, 1), array($state_index_id, 'initializing', 1, 35, 1), array($state_index_id, 'backgroundInit', 1, 36, 1), array($state_index_id, 'permanentlyDegraded', 1, 52, 2));
/**
 * 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
Esempio n. 7
0
<?php

$oid = $mempool['mempool_index'];
if (!is_array($mempool_cache['junos'])) {
    $mempool_cache['junos'] = array();
    $mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingBuffer", $mempool_cache['junos'], "JUNIPER-MIB", "+" . $config['install_dir'] . "/mibs/junos");
    $mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $mempool_cache['junos'], "JUNIPER-MIB", "+" . $config['install_dir'] . "/mibs/junos");
    if ($debug) {
        print_r($mempool_cache);
    }
}
$entry = $mempool_cache['junos'][$device[device_id]][$mempool[mempool_index]];
$perc = $entry['jnxOperatingBuffer'];
$mempool['total'] = $entry['jnxOperatingDRAMSize'];
$mempool['used'] = $entry['jnxOperatingDRAMSize'] / 100 * $perc;
$mempool['free'] = $entry['jnxOperatingDRAMSize'] - $mempool['used'];
Esempio n. 8
0
if ($device['os'] == 'ipoman') {
    echo ' IPOMANII-MIB ';
    if (!is_array($cache['ipoman'])) {
        echo 'outletConfigDesc ';
        $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB');
        echo 'outletConfigLocation ';
        $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB');
        echo 'inletConfigDesc ';
        $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, 'inletConfigDesc', $cache['ipoman']['in'], 'IPOMANII-MIB');
    }
    $oids = array();
    echo 'inletConfigFrequencyHigh ';
    $oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyHigh', $oids, 'IPOMANII-MIB');
    echo 'inletConfigFrequencyLow ';
    $oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyLow', $oids, 'IPOMANII-MIB');
    echo 'inletStatusFrequency ';
    $oids = snmpwalk_cache_multi_oid($device, 'inletStatusFrequency', $oids, 'IPOMANII-MIB');
    if (is_array($oids)) {
        foreach ($oids as $index => $entry) {
            $freq_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.' . $index;
            $divisor = 10;
            $descr = trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet {$index}";
            $current = $entry['inletStatusFrequency'] / 10;
            $low_limit = $entry['inletConfigFrequencyLow'];
            $high_limit = $entry['inletConfigFrequencyHigh'];
            discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, null, null, $high_limit, $current);
            // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
        }
    }
}
//end if
Esempio n. 9
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$mib = 'JUNIPER-MIB';
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingBuffer', $cache_mempool, $mib);
if ($mempool['mempool_precision'] == 1) {
    $cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingDRAMSize', $cache_mempool, $mib);
    $mempool['total'] = $cache_mempool[$index]['jnxOperatingDRAMSize'];
} else {
    $cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingMemory', $cache_mempool, $mib);
    $mempool['total'] = $cache_mempool[$index]['jnxOperatingMemory'];
}
$mempool['perc'] = $cache_mempool[$index]['jnxOperatingBuffer'];
// EOF
Esempio n. 10
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
Esempio n. 11
0
// accessPXIdentProductNumber.0 = STRING: "AP9361"
// accessPXIdentHardwareRev.0 = STRING: "04"
// accessPXIdentDateOfManufacture.0 = STRING: "04/29/2010"
// accessPXIdentSerialNumber.0 = STRING: "QA1018180304"
// accessPXConfigCardReaderEnableDisableAction.0 = INTEGER: enable(2)
// accessPXConfigAutoRelockTime.0 = INTEGER: 60
// accessPXConfigCardFormat.0 = INTEGER: hidStd26(1)
// accessPXConfigBeaconName.0 = STRING: "Beacon Name"
// accessPXConfigBeaconLocation.0 = STRING: "Beacon Location"
// accessPXConfigBeaconAction.0 = INTEGER: disconnectedReadOnly(4)
// accessPXStatusBeaconName.0 = STRING: "Beacon Name"
// accessPXStatusBeaconLocation.0 = STRING: "Beacon Location"
// accessPXStatusBeaconCurrentState.0 = INTEGER: disconnected(4)
foreach (array("accessPX") as $table) {
    echo "{$table} ";
    $cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB");
}
foreach ($cache['apc'] as $index => $entry) {
    // accessPXIdentAlarmStatus.0 = INTEGER: 3
    if ($entry['accessPXIdentAlarmStatus']) {
        $descr = 'Access PX Alarm Status';
        $oid = ".1.3.6.1.4.1.318.1.1.20.1.1.1.{$index}";
        discover_status($device, $oid, "accessPXIdentAlarmStatus.{$index}", 'powernet-accesspx-state', $descr, $entry['accessPXIdentAlarmStatus']);
    }
    // accessPXConfigFrontDoorLockControl.0 = INTEGER: lock(2)
    // accessPXConfigFrontDoorMaxOpenTime.0 = INTEGER: 10
    // accessPXStatusFrontDoorLock.0 = INTEGER: locked(2)
    // accessPXStatusFrontDoor.0 = INTEGER: closed(2)
    // accessPXStatusFrontDoorHandle.0 = INTEGER: closed(2)
    // accessPXStatusFrontDoorMaxOpenTime.0 = INTEGER: 10
    // accessPXStatusFrontDoorAlarmStatus.0 = INTEGER: 1
Esempio n. 12
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
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);
    }
}
Esempio n. 13
0
if (!is_array($entity_array)) {
    $entity_array = array();
    echo " entPhysicalDescr";
    $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "CISCO-ENTITY-SENSOR-MIB");
    echo " entPhysicalName";
    $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "CISCO-ENTITY-SENSOR-MIB");
}
$oids = array();
echo " entPhySensorType";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorScale";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorScale", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorPrecision";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorPrecision", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorValue";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorValue", $oids, "ENTITY-SENSOR-MIB");
$entitysensor['voltsDC'] = "voltage";
$entitysensor['voltsAC'] = "voltage";
$entitysensor['amperes'] = "current";
$entitysensor['watts'] = "power";
$entitysensor['hertz'] = "freq";
$entitysensor['percentRH'] = "humidity";
$entitysensor['rpm'] = "fanspeed";
$entitysensor['celsius'] = "temperature";
$entitysensor['dBm'] = "dbm";
if (is_array($oids)) {
    foreach ($oids as $index => $entry) {
        #echo("[" . $entry['entPhySensorType'] . "|" . $entry['entPhySensorValue']. "|" . $index . "]");
        if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index)) {
            $entPhysicalIndex = $index;
            $oid = ".1.3.6.1.2.1.99.1.1.1.4." . $index;
Esempio n. 14
0
 *
 */
echo ' CISCO-RTTMON-MIB ';
$sla_states =& $GLOBALS['config']['mibs']['CISCO-RTTMON-MIB']['sla_states'];
// Events from MIB definitions
$sla_oids = array('jitter' => array('rttMonLatestJitterOperRTTMin', 'rttMonLatestJitterOperRTTMax', 'rttMonLatestJitterOperNumOfRTT', 'rttMonLatestJitterOperPacketLossSD', 'rttMonLatestJitterOperPacketLossDS'), 'icmpjitter' => array('rttMonLatestIcmpJitterRTTMin', 'rttMonLatestIcmpJitterRTTMax', 'rttMonLatestIcmpJitterNumRTT', 'rttMonLatestIcmpJitterPktLoss'));
$sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestRttOperEntry", array(), 'CISCO-RTTMON-MIB');
foreach (dbFetchColumn("SELECT DISTINCT `rtt_type` FROM `slas` WHERE `device_id` = ? AND `rtt_type` != ? AND `deleted` = 0 AND `sla_status` = 'active';", array($device['device_id'], 'echo')) as $rtt_type) {
    switch ($rtt_type) {
        case 'jitter':
            // Additional data for Jitter
            $sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestJitterOperEntry", $sla_poll, 'CISCO-RTTMON-MIB');
            break;
        case 'icmpjitter':
            // Additional data for ICMP jitter
            $sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestIcmpJitterOperEntry", $sla_poll, 'CISCO-RTTMON-ICMP-MIB');
            break;
    }
}
// Uptime offset for timestamps
$uptime = timeticks_to_sec($poll_device['sysUpTime']);
$uptime_offset = time() - intval($uptime) / 100;
/// WARNING. System timezone BOMB
foreach ($sla_poll as $sla_index => $entry) {
    if (!isset($entry['rttMonLatestRttOperCompletionTime']) && !isset($entry['rttMonLatestRttOperSense'])) {
        // Skip additional multiindex entries from table
        continue;
    }
    // Convert timestamps to unixtime
    $entry['UnixTime'] = intval(timeticks_to_sec($entry['rttMonLatestRttOperTime']) / 100 + $uptime_offset);
    $sla_state = array('rtt_value' => $entry['rttMonLatestRttOperCompletionTime'], 'rtt_sense' => $entry['rttMonLatestRttOperSense'], 'rtt_unixtime' => $entry['UnixTime']);
Esempio n. 15
0
                if ($debug) {
                    echo $index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingCPU'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n";
                }
                $usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
                $descr = $entry['jnxOperatingDescr'];
                $usage = $entry['jnxOperatingCPU'];
                if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
                    discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
                }
            }
            // End if checks
        }
        // End Foreach
    }
    // End if array
    $srx_processors_array = snmpwalk_cache_multi_oid($device, "jnxJsSPUMonitoringCPUUsage", $srx_processors_array, "JUNIPER-SRX5000-SPU-MONITORING-MIB", '+' . $config['install_dir'] . "/mibs/junos");
    if ($debug) {
        print_r($processors_array);
    }
    if (is_array($srx_processors_array)) {
        foreach ($srx_processors_array as $index => $entry) {
            if (isset($index) && $index >= 0) {
                $usage_oid = ".1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4." . $index;
                $descr = "CPU";
                # No description in the table?
                $usage = $entry['jnxJsSPUMonitoringCPUUsage'];
                discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
            }
        }
    }
}
Esempio n. 16
0
<?php

# We're discovering this MIB
# snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
// JunOSe ATM vps
if ($device['os'] == "junose" && $config['enable_ports_junoseatmvp']) {
    echo "JunOSe ATM vps : ";
    $vp_array = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInCells", $vp_array, "Juniper-UNI-ATM-MIB", $config['install_dir'] . "/mibs/junose");
    $valid_vp = array();
    if ($debug) {
        print_r($vp_array);
    }
    if (is_array($vp_array)) {
        foreach ($vp_array as $index => $entry) {
            list($ifIndex, $vp_id) = explode('.', $index);
            $port_id = dbFetchCell("SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $ifIndex));
            if (is_numeric($port_id) && is_numeric($vp_id)) {
                discover_juniAtmvp($valid_vp, $port_id, $vp_id, NULL);
            }
        }
        // End Foreach
    }
    // End if array
    unset($vp_array);
    // Remove ATM vps which weren't redetected here
    $sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id`  = '" . $device['device_id'] . "' AND J.port_id = P.port_id";
    if ($debug) {
        print_r($valid_vp);
    }
    foreach (dbFetchRows($sql) as $test) {
        $port_id = $test['port_id'];
Esempio n. 17
0
 echo ' IPOMANII-MIB ';
 // Inlet Disabled due to the fact thats it's Kwh instead of just Watt
 if (!is_array($cache['ipoman'])) {
     d_echo('outletConfigDesc ');
     $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB');
     d_echo('outletConfigLocation ');
     $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB');
     // echo("inletConfigDesc ");
     // $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, "inletConfigDesc", $cache['ipoman'], "IPOMANII-MIB");
 }
 // $oids_in = array();
 $oids_out = array();
 // echo("inletStatusWH ");
 // $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB");
 d_echo('outletStatusWH ');
 $oids_out = snmpwalk_cache_multi_oid($device, 'outletStatusWH', $oids_out, 'IPOMANII-MIB');
 // if (is_array($oids_in))
 // {
 // foreach ($oids_in as $index => $entry)
 // {
 // $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.5.' . $index;
 // $divisor = 10;
 // $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
 // $power = $entry['inletStatusWH'] / $divisor;
 //
 // discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $power);
 // // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
 // }
 // }
 if (is_array($oids_out)) {
     foreach ($oids_out as $index => $entry) {
Esempio n. 18
0
<?php

#root@alpha:/home/observium/dev# snmpwalk -v2c -c // -M mibs -m +NS-ROOT-MIB netscaler.test nsCPUTable
#NS-ROOT-MIB::nsCPUname."cpu0" = STRING: "cpu0"
#NS-ROOT-MIB::nsCPUusage."cpu0" = Gauge32: 0
if ($device['os'] == "netscaler") {
    echo " NetScaler ";
    echo " Caching OIDs:";
    if (!is_array($nsaarray)) {
        $nsarray = array();
        echo " nsCPUTable ";
        $nsarray = snmpwalk_cache_multi_oid($device, "nsCPUTable", $nsarray, "NS-ROOT-MIB");
    }
    foreach ($nsarray as $descr => $data) {
        $current = $data['nsCPUusage'];
        $oid = ".1.3.6.1.4.1.5951.4.1.1.41.6.1.2." . string_to_oid($descr);
        $descr = $data['nsCPUname'];
        discover_processor($valid['processor'], $device, $oid, $descr, "netscaler", $descr, "1", $current, NULL, NULL);
    }
    unset($nsarray, $oid, $descr, $current);
}
Esempio n. 19
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
Esempio n. 20
0
<?php

// We're discovering this MIB
// snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
// JunOSe ATM vps
if ($device['os'] == 'junose' && $config['enable_ports_junoseatmvp']) {
    $vp_array = snmpwalk_cache_multi_oid($device, 'juniAtmVpStatsInCells', $vp_array, 'Juniper-UNI-ATM-MIB', 'junose');
    $valid_vp = array();
    d_echo($vp_array);
    if (is_array($vp_array)) {
        foreach ($vp_array as $index => $entry) {
            list($ifIndex, $vp_id) = explode('.', $index);
            $port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex));
            if (is_numeric($port_id) && is_numeric($vp_id)) {
                discover_juniAtmvp($valid_vp, $port_id, $vp_id, null);
            }
        }
        //end foreach
    }
    //end if
    unset($vp_array);
    // Remove ATM vps which weren't redetected here
    $sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id`  = '" . $device['device_id'] . "' AND J.port_id = P.port_id";
    d_echo($valid_vp);
    foreach (dbFetchRows($sql) as $test) {
        $port_id = $test['port_id'];
        $vp_id = $test['vp_id'];
        d_echo($port_id . ' -> ' . $vp_id . "\n");
        if (!$valid_vp[$port_id][$vp_id]) {
            echo '-';
            dbDelete('juniAtmvp', '`juniAtmVp` = ?', array($test['juniAtmvp']));
<?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);
        }
    }
     $oids = array('entPhysicalDescr', 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos');
     if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
         $oids[] = 'entPhysicalAlias';
     }
     foreach ($oids as $oid) {
         $entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB');
         if (!$GLOBALS['snmp_status']) {
             break;
         }
     }
     $entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB');
 }
 if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
     $oids_arista = array('aristaEntSensorThresholdLowWarning', 'aristaEntSensorThresholdLowCritical', 'aristaEntSensorThresholdHighWarning', 'aristaEntSensorThresholdHighCritical');
     foreach ($oids_arista as $oid) {
         $entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ARISTA-ENTITY-SENSOR-MIB');
         if (!$GLOBALS['snmp_status']) {
             break;
         }
     }
 }
 $entitysensor = array('voltsDC' => 'voltage', 'voltsAC' => 'voltage', 'amperes' => 'current', 'watts' => 'power', 'hertz' => 'frequency', 'percentRH' => 'humidity', 'rpm' => 'fanspeed', 'celsius' => 'temperature', 'dBm' => 'dbm');
 foreach ($entity_array as $index => $entry) {
     if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index) && $entry['entPhySensorOperStatus'] != 'unavailable' && $entry['entPhySensorOperStatus'] != 'nonoperational') {
         $ok = TRUE;
         $options = array('entPhysicalIndex' => $index);
         $oid = ".1.3.6.1.2.1.99.1.1.1.4.{$index}";
         $type = $entitysensor[$entry['entPhySensorType']];
         $descr = rewrite_entity_name($entry['entPhysicalDescr']);
         if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
             // Check if entPhysicalDescr equals entPhysicalName,
Esempio n. 23
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$mempool_array = snmpwalk_cache_multi_oid($device, 'jnxOperatingBuffer', NULL, $mib);
if (is_array($mempool_array)) {
    $mempool_array = snmpwalk_cache_multi_oid($device, 'jnxOperatingMemory', $mempool_array, $mib);
    $mempool_array = snmpwalk_cache_multi_oid($device, 'jnxOperatingDRAMSize', $mempool_array, $mib);
    $mempool_array = snmpwalk_cache_multi_oid($device, 'jnxOperatingDescr', $mempool_array, $mib);
    foreach ($mempool_array as $index => $entry) {
        $descr = $entry['jnxOperatingDescr'];
        if (stripos($descr, 'sensor') !== FALSE || stripos($descr, 'fan') !== FALSE || stripos($descr, 'pcmcia') !== FALSE) {
            continue;
        }
        if ($entry['jnxOperatingDRAMSize']) {
            $precision = 1;
            $total = $entry['jnxOperatingDRAMSize'];
            // Size in bytes
        } elseif ($entry['jnxOperatingMemory']) {
            $precision = 1024 * 1024;
            $total = $entry['jnxOperatingMemory'];
            // Size in megabytes
        } else {
            continue;
Esempio n. 24
0
// FIXME should do the deletion etc in a common file perhaps? like for the sensors
/*
 * Try to discover any Virtual Machines.
 */
if ($device['os'] == 'vmware' || $device['os'] == 'linux') {
    /*
     * Variable to hold the discovered Virtual Machines.
     */
    $vmw_vmlist = array();
    /*
     * CONSOLE: Start the VMware discovery process.
     */
    /*
     * Fetch information about Virtual Machines.
     */
    $oids = snmpwalk_cache_multi_oid($device, 'vmwVmTable', $oids, '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+' . $config['mib_dir'] . '/vmware:' . $config['mib_dir']);
    foreach ($oids as $index => $entry) {
        $vmwVmDisplayName = $entry['vmwVmDisplayName'];
        $vmwVmGuestOS = $entry['vmwVmGuestOS'];
        $vmwVmMemSize = $entry['vmwVmMemSize'];
        $vmwVmState = $entry['vmwVmState'];
        $vmwVmCpus = $entry['vmwVmCpus'];
        /*
         * VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
         * might be resolved by VMware in the future making this code obsolete.
         */
        if (preg_match('/^([0-9]+) .*$/', $vmwVmMemSize, $matches)) {
            $vmwVmMemSize = $matches[1];
        }
        /*
         * Check whether the Virtual Machine is already known for this host.
 *   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]);
Esempio n. 26
0
 STE-MIB::sensName.1 = STRING: "Sensor 26518"
 STE-MIB::sensName.2 = STRING: "Sensor 29068"
 STE-MIB::sensState.1 = INTEGER: normal(1)
 STE-MIB::sensState.2 = INTEGER: alarmlo(4)
 STE-MIB::sensString.1 = STRING: "19.6"
 STE-MIB::sensString.2 = STRING: "26.1"
 STE-MIB::sensValue.1 = INTEGER: 196
 STE-MIB::sensValue.2 = INTEGER: 261
 STE-MIB::sensSN.1 = STRING: "289667F30100000F"
 STE-MIB::sensSN.2 = STRING: "268C71130100004D"
 STE-MIB::sensUnit.1 = INTEGER: celsius(1)
 STE-MIB::sensUnit.2 = INTEGER: percent(4)
 STE-MIB::sensID.1 = INTEGER: 26518
 STE-MIB::sensID.2 = INTEGER: 29068
*/
$oids = snmpwalk_cache_multi_oid($device, "sensTable", array(), "STE-MIB");
foreach ($oids as $index => $entry) {
    $oid = ".1.3.6.1.4.1.21796.4.1.3.1.5.{$index}";
    $descr = $entry['sensName'];
    $value = $entry['sensValue'];
    $scale = 0.1;
    // sensUnit: none (0), celsius (1), fahrenheit (2), kelvin (3), percent(4)
    switch ($entry['sensUnit']) {
        case 'celsius':
            $type = 'temperature';
            break;
        case 'percent':
            $type = 'humidity';
            break;
        default:
            continue 2;
Esempio n. 27
0
<?php

if ($device['os'] == 'qnap') {
    echo 'QNAP temperature ';
    // Turbo NAS Temperature
    $turbonas_temperature_oid = '.1.3.6.1.4.1.24681.1.3.6.0';
    // Turbo NAS Disk Temperature
    $disk_temperature_oid = '.1.3.6.1.4.1.24681.1.2.11.1.3.';
    // Get Turbo NAS temperature
    $turbonas_temperature = snmp_get($device, $turbonas_temperature_oid, '-Oqv');
    // Save the Turbo NAS temperature
    discover_sensor($valid['sensor'], 'temperature', $device, $turbonas_temperature_oid, '99', 'snmp', 'System Temperature', '1', '1', null, null, null, null, $turbonas_temperature);
    // Get all disks in the device
    $disks = snmpwalk_cache_multi_oid($device, 'SystemHdTable', array(), 'NAS-MIB');
    // Parse all disks in the device to get the temperatures
    if (is_array($disks)) {
        foreach ($disks as $disk_number => $entry) {
            // Get the disk temperature full oid
            $disk_oid = $disk_temperature_oid . $disk_number;
            // Get the temperature for the disk
            $disk_temperature = $entry['HdTemperature'];
            // Getting the disk information (Number and model)
            $disk_information = $entry['HdDescr'] . ' ' . $entry['HdModel'];
            // Save the temperature for the disk
            discover_sensor($valid['sensor'], 'temperature', $device, $disk_oid, $disk_number, 'snmp', $disk_information, '1', '1', null, null, null, null, $disk_temperature);
        }
    }
}
Esempio n. 28
0
 $cefs_query = dbFetchRows('SELECT * FROM `cef_switching` WHERE `device_id` = ?', array($device['device_id']));
 foreach ($cefs_query as $ceftmp) {
     $cef_id = $device['device_id'] . '-' . $ceftmp['entPhysicalIndex'] . '-' . $ceftmp['afi'] . '-' . $ceftmp['cef_index'];
     $cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
 }
 d_echo($cefs);
 if (is_array($cefs)) {
     if (!is_array($entity_array)) {
         echo 'Caching OIDs: ';
         $entity_array = array();
         echo ' entPhysicalDescr';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalDescr', $entity_array, 'ENTITY-MIB');
         echo ' entPhysicalName';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalName', $entity_array, 'ENTITY-MIB');
         echo ' entPhysicalModelName';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalModelName', $entity_array, 'ENTITY-MIB');
     }
     foreach ($cefs as $entity => $afis) {
         $entity_name = $entity_array[$entity]['entPhysicalName'] . ' - ' . $entity_array[$entity]['entPhysicalModelName'];
         echo "\n{$entity} {$entity_name}\n";
         foreach ($afis as $afi => $paths) {
             echo " |- {$afi}\n";
             foreach ($paths as $path => $cef_stat) {
                 echo ' | |-' . $path . ': ' . $cef_stat['cefSwitchingPath'];
                 $cef_id = $device['device_id'] . '-' . $entity . '-' . $afi . '-' . $path;
                 // if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
                 if (!isset($cefs_db[$cef_id])) {
                     dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching');
                     echo '+';
                 }
                 unset($cefs_db[$cef_id]);
Esempio n. 29
0
 *
 * @package    LibreNMS
 * @link       http://librenms.org
 * @copyright  2016 Tony Murray
 * @author     Tony Murray <*****@*****.**>
 */
if (key_exists('vrf_lite_cisco', $device) && count($device['vrf_lite_cisco']) != 0) {
    $vrfs_lite_cisco = $device['vrf_lite_cisco'];
} else {
    $vrfs_lite_cisco = array(array('context_name' => null));
}
foreach ($vrfs_lite_cisco as $vrf) {
    $context = $vrf['context_name'];
    $device['context_name'] = $context;
    $arp_data = snmpwalk_cache_multi_oid($device, 'ipNetToPhysicalPhysAddress', array(), 'IP-MIB');
    $arp_data = snmpwalk_cache_multi_oid($device, 'ipNetToMediaPhysAddress', $arp_data, 'IP-MIB');
    $sql = "SELECT M.* from ipv4_mac AS M, ports AS I WHERE M.port_id=I.port_id AND I.device_id=? AND M.context_name=?";
    $params = array($device['device_id'], $context);
    $existing_data = dbFetchRows($sql, $params);
    $ipv4_addresses = array();
    foreach ($existing_data as $data) {
        $ipv4_addresses[] = $data['ipv4_address'];
    }
    $arp_table = array();
    $insert_data = array();
    foreach ($arp_data as $ip => $data) {
        if (isset($data['ipNetToPhysicalPhysAddress'])) {
            $raw_mac = $data['ipNetToPhysicalPhysAddress'];
            list($if, $ipv, $ip) = explode('.', $ip, 3);
        } elseif (isset($data['ipNetToMediaPhysAddress'])) {
            $raw_mac = $data['ipNetToMediaPhysAddress'];
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
echo " HPN-ICF-ENTITY-EXT-MIB ";
$oids = array('hpnicfEntityExtStateTable', 'entPhysicalName');
$entity_array = array();
foreach ($oids as $oid) {
    $entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ENTITY-MIB:HPN-ICF-ENTITY-EXT-MIB');
}
foreach ($entity_array as $index => $entry) {
    // HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperature.8 = INTEGER: 50
    // HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperatureThreshold.8 = INTEGER: 85
    // HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCriticalTemperatureThreshold.8 = INTEGER: 95
    // HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtLowerTemperatureThreshold.8 = INTEGER: -30
    // HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtShutdownTemperatureThreshold.8 = INTEGER: 65535
    $options = array('entPhysicalIndex' => $index);
    if ($entry['hpnicfEntityExtTemperature'] != 65535 && $entry['hpnicfEntityExtTemperatureThreshold'] != 65535 && $entry['hpnicfEntityExtLowerTemperatureThreshold'] != 65535) {
        $options['limit_low'] = $entry['hpnicfEntityExtLowerTemperatureThreshold'];
        $options['limit_high_warn'] = $entry['hpnicfEntityExtTemperatureThreshold'];
        if ($entry['hpnicfEntityExtCriticalTemperatureThreshold'] != 65535 && $entry['hpnicfEntityExtCriticalTemperatureThreshold'] >= $entry['hpnicfEntityExtTemperatureThreshold']) {
            $options['limit_high'] = $entry['hpnicfEntityExtCriticalTemperatureThreshold'];
        } else {
            $options['limit_high'] = $entry['hpnicfEntityExtTemperatureThreshold'] + 10;