Ejemplo n.º 1
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// CLEANME rename code can go in r6000
echo " Sentry3-MIB ";
$scale = 0.01;
$scale_voltage = 0.1;
$sentry3_InfeedEntry = snmpwalk_cache_twopart_oid($device, 'InfeedEntry', array(), 'Sentry3-MIB');
$sentry3_OutletEntry = snmpwalk_cache_threepart_oid($device, 'OutletEntry', array(), 'Sentry3-MIB');
foreach ($sentry3_InfeedEntry as $tower => $feeds) {
    foreach ($feeds as $feed => $entry) {
        $descr = str_replace('_', ', ', $entry['infeedName']);
        $index = "{$tower}.{$feed}";
        //infeedLoadValue
        $oid = '.1.3.6.1.4.1.1718.3.2.2.1.7.' . $index;
        if (isset($entry['infeedLoadValue']) && $entry['infeedLoadValue'] >= 0) {
            $limits = array('limit_high' => $entry['infeedCapacity'], 'limit_high_warn' => $entry['infeedLoadHighThresh']);
            $value = $entry['infeedLoadValue'];
            ## Rename code for older revisions
            $old_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-{$tower}.rrd");
            $new_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-infeedLoad.{$index}.rrd");
            if (is_file($old_rrd)) {
                rename($old_rrd, $new_rrd);
                print_message('Moved RRD');
Ejemplo n.º 2
0
<?php

if ($device['os_group'] == "cisco") {
    echo "Cisco CEF Switching Path: ";
    $cefs = array();
    $cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
    $polled = time();
    $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'];
    }
    if ($debug) {
        print_r($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";
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$amap_array = snmpwalk_cache_threepart_oid($device, "aipAMAPportConnectionTable", array(), "ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
if ($amap_array) {
    foreach (array_keys($amap_array) as $key) {
        $amap = array_shift(array_shift($amap_array[$key]));
        $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $amap['aipAMAPLocalIfindex']));
        $remote_device_id = FALSE;
        if (is_valid_hostname($amap['aipAMAPRemHostname'])) {
            if (isset($GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']])) {
                // This hostname already checked, skip discover
                $remote_device_id = $GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']];
            } else {
                $remote_device = dbFetchRow("SELECT `device_id`, `hostname` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($amap['aipAMAPRemHostname'], $amap['aipAMAPRemHostname']));
                $remote_device_id = $remote_device['device_id'];
                if (!$remote_device_id && !is_bad_xdp($amap['aipAMAPRemHostname'], $amap['aipAMAPRemDeviceType'])) {
                    $remote_device_id = discover_new_device($amap['aipAMAPRemHostname'], 'xdp', 'AMAP', $device, $port);
                }
                // Cache remote device ID for other protocols
                $GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']] = $remote_device_id;
Ejemplo n.º 4
0
<?php

echo 'Cisco CEF Switching Path: ';
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingPath', $cefs);
if ($debug) {
    print_r($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 => $path_name) {
                echo ' | |-' . $path . ': ' . $path_name['cefSwitchingPath'] . "\n";
                $cef_exists[$device['device_id']][$entity][$afi][$path] = 1;
                if (dbFetchCell('SELECT COUNT(*) from `cef` WHERE device_id = ? AND entPhysicalIndex = ?, AND afi=? AND cef_index=?', array($device['device_id'], $entity, $afi, $path)) != '1') {
                    dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_path' => $path), 'cef');
                    echo '+';
                }
Ejemplo n.º 5
0
<?php

if ($device['os_group'] == 'cisco') {
    echo 'Cisco CEF Switching Path: ';
    $cefs = array();
    $cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingStatsEntry', $cefs, 'CISCO-CEF-MIB');
    $polled = time();
    $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'];
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// DELL-NETWORKING-CHASSIS-MIB
//DELL-NETWORKING-CHASSIS-MIB::dellNetCpuUtil5Min.stack.1.1 = Gauge32: 14 percent
$processors_array = snmpwalk_cache_threepart_oid($device, 'dellNetCpuUtil5Min', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
//print_vars($processors_array);
foreach ($processors_array as $type => $entry1) {
    // Hrm, this is possible for multiple types?
    $first_unit = array_shift(array_keys($entry1));
    foreach ($entry1 as $unit => $entry2) {
        $processors_count = count($entry2);
        foreach ($entry2 as $processor => $entry) {
            $dot_index = ".{$type}.{$unit}.{$processor}";
            $descr = 'Unit ' . strval($unit - $first_unit);
            if ($processors_count > 1) {
                $descr .= " Processor {$processor}";
            }
            $oid_table = 'dellNetCpuUtilTable';
            $oid_name = 'dellNetCpuUtil5Min';
            $oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.4.1.5{$dot_index}";
            $usage = $entry[$oid_name];
Ejemplo n.º 7
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
/// Collect data about inputs :
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTable', array(), 'EATON-EPDU-MIB');
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTotal', $inputs, 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputVoltageTable', array(), 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputCurrentTable', $inputs_o, 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputPowerTable', $inputs_o, 'EATON-EPDU-MIB');
foreach ($inputs as $unit_id => $unit_data) {
    //echo "Unit $unit_id".PHP_EOL;
    foreach ($unit_data as $input_id => $input_data) {
        //echo "  Input $input_id".PHP_EOL;
        $input_oid = $unit_id . "." . $input_id;
        if (isset($input_data['inputFrequency'])) {
            discover_sensor($valid['sensor'], 'frequency', $device, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3." . $input_oid, "inputFrequency.{$input_oid}", 'eaton-epdu-mib', "Unit {$unit_id} Input {$input_id} Frequency", "0.1", $input_data['inputFrequency']);
        }
        if (isset($input_data['inputFrequencyStatus'])) {
            discover_status($device, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4." . $input_oid, "inputFrequencyStatus." . $input_oid, 'inputFrequencyStatus', "Unit {$unit_id} Input {$input_id} Frequency Status", $input_data['inputFrequencyStatus'], array('entPhysicalClass' => 'input'));
        }
        if (isset($input_data['inputTotalVA']) && is_numeric($input_data['inputTotalVA'])) {
            $descr = "Unit {$unit_id} Input {$input_id}";
            $oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.3." . $input_oid;
            $value = $input_data['inputTotalVA'];
Ejemplo n.º 8
0
                if ($remote_device_id) {
                    $if = $cdp['cdpCacheDevicePort'];
                    $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
                } else {
                    $remote_interface_id = "0";
                }
                if ($interface['interface_id'] && $cdp['cdpCacheDeviceId'] && $cdp['cdpCacheDevicePort']) {
                    discover_link($interface['interface_id'], 'cdp', $remote_interface_id, $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDevicePort'], $cdp['cdpCachePlatform'], $cdp['cdpCacheVersion']);
                }
            }
        }
    }
}
echo " LLDP-MIB: ";
unset($lldp_array);
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, array(), "LLDP-MIB");
$lldp_array = $lldp_array[$device['device_id']];
if ($lldp_array) {
    $lldp_links = "";
    foreach (array_keys($lldp_array) as $key) {
        $lldp_if_array = $lldp_array[$key];
        foreach (array_keys($lldp_if_array) as $entry_key) {
            $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '" . $device['device_id'] . "' AND `ifIndex` = '" . $entry_key . "'"));
            $lldp_instance = $lldp_if_array[$entry_key];
            foreach (array_keys($lldp_instance) as $entry_instance) {
                $lldp = $lldp_instance[$entry_instance];
                $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '" . $lldp['lldpRemSysName'] . "' OR `hostname`='" . $lldp['lldpRemSysName'] . "'"), 0);
                if ($remote_device_id) {
                    $if = $lldp['lldpRemPortDesc'];
                    $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
                } else {
Ejemplo n.º 9
0
<?php

if ($device['os_group'] == "cisco") {
    echo "Cisco CEF Switching Path: ";
    $cefs = array();
    $cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB", mib_dirs(array("cisco")));
    $polled = time();
    $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'];
    }
    if ($debug) {
        print_r($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";
Ejemplo n.º 10
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo " LLDP-MIB ";
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", mib_dirs());
if ($lldp_array) {
    $dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB", mib_dirs());
    foreach (array_keys($lldp_array) as $key) {
        $lldp_if_array = $lldp_array[$key];
        foreach (array_keys($lldp_if_array) as $entry_key) {
            if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
                $ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
            } else {
                $ifIndex = $entry_key;
            }
            $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $ifIndex));
            $lldp_instance = $lldp_if_array[$entry_key];
            foreach (array_keys($lldp_instance) as $entry_instance) {
                $lldp = $lldp_instance[$entry_instance];
                $remote_device_id = FALSE;
                if (is_valid_hostname($lldp['lldpRemSysName'])) {
Ejemplo n.º 11
0
if ($value != '') {
    $oid = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
    $descr = "Output Status";
    $value = state_string_to_numeric('powernet-upsbasicoutput-state', $value);
    discover_sensor($valid['sensor'], 'state', $device, $oid, "upsBasicOutputStatus.0", 'powernet-upsbasicoutput-state', $descr, NULL, $value, array('entPhysicalClass' => 'power'));
}
#### ATS #############################################################################################
$inputs = snmp_get($device, "atsNumInputs.0", "-Ovq", "PowerNet-MIB", mib_dirs('apc'));
$outputs = snmp_get($device, "atsNumOutputs.0", "-Ovq", "PowerNet-MIB", mib_dirs('apc'));
// Check if we have values for these, if not, try other code paths below.
if ($inputs || $outputs) {
    echo " ";
    $cache['apc'] = array();
    foreach (array("atsInputTable", "atsOutputTable", "atsInputPhaseTable", "atsOutputPhaseTable") as $table) {
        echo "{$table} ";
        $cache['apc'] = snmpwalk_cache_threepart_oid($device, $table, $cache['apc'], "PowerNet-MIB", mib_dirs('apc'), TRUE);
    }
    foreach (array("atsInputTable", "atsOutputTable") as $table) {
        echo "{$table} ";
        $cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB", mib_dirs('apc'), TRUE);
    }
    // Not tested with threephase, but I don't see any on the APC product list anyway, so...
    // FIXME - Not monitored:
    // [atsOutputLoad] => 364 (VA)
    // [atsOutputPercentLoad] => 9 (%)
    // [atsOutputPercentPower] => 9 (%)
    foreach ($cache['apc'] as $index => $entry) {
        $descr = $entry['atsInputName'];
        $oid = ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.{$index}.1.1";
        $value = $entry[1][1]['atsInputVoltage'];
        if ($value != '' && $value != -1) {
Ejemplo n.º 12
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo "Cisco CEF Switching Path: ";
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingPath", $cefs, NULL, mib_dirs(array("cisco")));
if ($debug) {
    print_vars($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'];
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// DELL-NETWORKING-CHASSIS-MIB
//DELL-NETWORKING-CHASSIS-MIB::dellNetCpuUtilMemUsage.stack.1.1 = Gauge32: 41 percent
//DELL-NETWORKING-CHASSIS-MIB::dellNetProcessorMemSize.stack.1.1 = INTEGER: 2029
$mempool_array = snmpwalk_cache_threepart_oid($device, 'dellNetCpuUtilMemUsage', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
if (is_array($mempool_array)) {
    $mempool_array = snmpwalk_cache_threepart_oid($device, 'dellNetProcessorMemSize', $mempool_array, $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
    if (OBS_DEBUG > 1 && count($mempool_array)) {
        print_vars($mempool_array);
    }
    foreach ($mempool_array as $type => $entry1) {
        // Hrm, this is possible for multiple types?
        $first_unit = array_shift(array_keys($entry1));
        foreach ($entry1 as $unit => $entry2) {
            $mempool_count = count($entry2);
            foreach ($entry2 as $mempool => $entry) {
                $index = "{$type}.{$unit}.{$mempool}";
                $dot_index = ".{$index}";
                $descr = 'Unit ' . strval($unit - $first_unit);
                if ($mempool_count > 1) {
                    $descr .= " Memory {$mempool}";
                }
Ejemplo n.º 14
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'];
 }
 $cef_pfxs_query = dbFetchRows('SELECT * FROM `cef_prefix` WHERE `device_id` = ?', array($device['device_id']));
 foreach ($cef_pfxs_query as $pfx) {
     $cef_pfxs_db[$pfx['entPhysicalIndex']][$pfx['afi']] = $pfx['cef_pfx_id'];
 }
 unset($cefs_query, $cef_pfxs_query);
 $device_context = $device;
 if (!count($cefs_db)) {
     // Set retries to 0 for speedup first walking, only if previously polling also empty (DB empty)
     $device_context['snmp_retries'] = 0;
 }
 $cefs = snmpwalk_cache_threepart_oid($device_context, 'cefSwitchingStatsEntry', array(), 'CISCO-CEF-MIB');
 unset($device_context);
 if ($GLOBALS['snmp_status']) {
     $cef_pfxs = snmpwalk_cache_twopart_oid($device, 'cefFIBSummaryEntry', array(), 'CISCO-CEF-MIB');
     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');
     }
     $polled = time();
 }
Ejemplo n.º 15
0
    return;
}
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwAssociatedInterface', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwLocalSiteId', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwID
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwTunnelName', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwDescr
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwTunnelType', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPsnType
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnRemotePeIdAddrType', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPeerAddrType
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnRemotePeIdAddress', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPeerAddr
//$pws = snmpwalk_cache_oid($device, 'pwLocalIfMtu',     $pws, 'JUNIPER-VPN-MIB');
//$pws = snmpwalk_cache_oid($device, 'pwRemoteIfMtu',    $pws, 'JUNIPER-VPN-MIB');
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwRemoteSiteId', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwMplsPeerLdpID
if (OBS_DEBUG > 1) {
    echo 'PWS_WALK: ' . count($pws) . "\n";
    print_vars($pws);
}
foreach ($pws as $pw_type => $entry) {
    foreach ($entry as $pw_name => $entry2) {
        foreach ($entry2 as $pw_ifIndex => $pw) {
            //if (strlen($pw['jnxVpnPwRowStatus']) && $pw['jnxVpnPwRowStatus'] != 'active') { continue; } // Skip inactive (active, notinService, notReady, createAndGo, createAndWait, destroy)
            // Get full index
            $pw_index = snmp_translate('jnxVpnPwRowStatus.' . $pw_type . '."' . $pw_name . '".' . $pw_ifIndex, 'JUNIPER-VPN-MIB');
            $pw_index = str_replace('.1.3.6.1.4.1.2636.3.26.1.4.1.4.', '', $pw_index);
            $peer_addr = hex2ip($pw['jnxVpnRemotePeIdAddress']);
            $peer_addr_version = get_ip_version($peer_addr);
            $peer_addr_type = $pw['jnxVpnRemotePeIdAddrType'];
Ejemplo n.º 16
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", NULL, OBS_SNMP_ALL | OBS_SNMP_CONCAT);
if ($lldp_array) {
    if (OBS_DEBUG > 1) {
        print_vars($lldp_array);
    }
    $dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB");
    $lldp_local_array = snmpwalk_cache_oid($device, "lldpLocalSystemData", array(), "LLDP-MIB");
    foreach ($lldp_array as $key => $lldp_if_array) {
        foreach ($lldp_if_array as $entry_key => $lldp_instance) {
            if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
                $ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
            } else {
                $ifIndex = $entry_key;
            }
            // Get the port using BRIDGE-MIB
            $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ? AND `ifDescr` NOT LIKE 'Vlan%'", array($device['device_id'], $ifIndex));
            // If BRIDGE-MIB failed, get the port using pure LLDP-MIB
            if (!$port) {
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo " ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB ";
$amap_array = snmpwalk_cache_threepart_oid($device, "aipAMAPportConnectionTable", array(), "ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB", mib_dirs('aos'), TRUE);
if ($amap_array) {
    foreach (array_keys($amap_array) as $key) {
        $amap = array_shift(array_shift($amap_array[$key]));
        $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $amap['aipAMAPLocalIfindex']));
        $remote_device = dbFetchRow("SELECT `device_id`, `hostname` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($amap['aipAMAPRemHostname'], $amap['aipAMAPRemHostname']));
        $remote_device_id = $remote_device['device_id'];
        if (!$remote_device_id && is_valid_hostname($amap['aipAMAPRemHostname']) && !is_bad_xdp($amap['aipAMAPRemHostname'])) {
            $remote_device_id = discover_new_device($amap['aipAMAPRemHostname'], 'xdp', 'AMAP', $device, $port);
        }
        if ($remote_device_id) {
            $remote_port_id = $amap['aipAMAPRemSlot'] * 1000 + $amap['aipAMAPRemPort'];
        }
        if (!is_bad_xdp($amap['aipAMAPRemHostname']) && is_numeric($port['port_id']) && isset($amap['aipAMAPRemHostname'])) {
            discover_link($valid_link, $port['port_id'], 'amap', $remote_port_id, $amap['aipAMAPRemHostname'], $amap['aipAMAPRemSlot'] . "/" . $amap['aipAMAPRemPort'], $amap['aipAMAPRemDeviceType'], $amap['aipAMAPRemDevModelName']);
        }
    }
Ejemplo n.º 18
0
if ($value !== '') {
    $oid = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
    $descr = "Output Status";
    discover_sensor($valid['sensor'], 'state', $device, $oid, "upsBasicOutputStatus.0", 'powernet-upsbasicoutput-state', $descr, NULL, $value, array('entPhysicalClass' => 'power'));
}
#### ATS #############################################################################################
$inputs = snmp_get($device, "atsNumInputs.0", "-Ovq", "PowerNet-MIB");
$outputs = snmp_get($device, "atsNumOutputs.0", "-Ovq", "PowerNet-MIB");
// Check if we have values for these, if not, try other code paths below.
if ($inputs || $outputs) {
    echo ' ';
    $cache['apc'] = array();
    foreach (array("atsInputTable", "atsOutputTable", "atsInputPhaseTable", "atsOutputPhaseTable") as $table) {
        echo "{$table} ";
        // FIXME, not sure, that here required numeric index, seems as the remains of old snmp code with caching (added in r4685)
        $cache['apc'] = snmpwalk_cache_threepart_oid($device, $table, $cache['apc'], "PowerNet-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
    }
    foreach (array("atsInputTable", "atsOutputTable") as $table) {
        echo "{$table} ";
        // FIXME, not sure, that here required numeric index, seems as the remains of old snmp code with caching (added in r4685)
        $cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
    }
    // Not tested with threephase, but I don't see any on the APC product list anyway, so...
    // FIXME - Not monitored:
    // [atsOutputLoad] => 364 (VA)
    // [atsOutputPercentLoad] => 9 (%)
    // [atsOutputPercentPower] => 9 (%)
    foreach ($cache['apc'] as $index => $entry) {
        $descr = $entry['atsInputName'];
        $oid = ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.{$index}.1.1";
        $value = $entry[1][1]['atsInputVoltage'];
 $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'];
 }
 $cef_pfxs_query = dbFetchRows("SELECT * FROM `cef_prefix` WHERE `device_id` = ?", array($device['device_id']));
 foreach ($cef_pfxs_query as $pfx) {
     $cef_pfxs_db[$pfx['entPhysicalIndex']][$pfx['afi']] = $pfx['cef_pfx_id'];
 }
 unset($cefs_query, $cef_pfxs_query);
 $device_context = $device;
 if (!count($cefs_db)) {
     // Set retries to 0 for speedup first walking, only if previously polling also empty (DB empty)
     $device_context['snmp_retries'] = 0;
 }
 $cefs = snmpwalk_cache_threepart_oid($device_context, "cefSwitchingStatsEntry", array(), "CISCO-CEF-MIB", mib_dirs(array("cisco")));
 unset($device_context);
 if ($GLOBALS['snmp_status']) {
     $cef_pfxs = snmpwalk_cache_twopart_oid($device, "cefFIBSummaryEntry", array(), "CISCO-CEF-MIB", mib_dirs(array("cisco")));
     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");
     }
     $polled = time();
 }
Ejemplo n.º 20
0
                $if = $lldp['lldpRemPortDesc'];
                $id = $lldp['lldpRemPortId'];
                $remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $remote_device_id));
            } else {
                $remote_port_id = '0';
            }
            if (is_numeric($interface['port_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) {
                discover_link($interface['port_id'], 'lldp', $remote_port_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], null, $lldp['lldpRemSysDesc'], $device['device_id'], $remote_device_id);
            }
        }
        //end foreach
    }
    //end if
} elseif ($config['autodiscovery']['xdp'] === true) {
    echo ' LLDP-MIB: ';
    $lldp_array = snmpwalk_cache_threepart_oid($device, 'lldpRemoteSystemsData', array(), 'LLDP-MIB');
    d_echo($lldp_array);
    $dot1d_array = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', array(), 'BRIDGE-MIB');
    d_echo($dot1d_array);
    if ($lldp_array) {
        $lldp_links = '';
        foreach (array_keys($lldp_array) as $key) {
            $lldp_if_array = $lldp_array[$key];
            d_echo($lldp_if_array);
            foreach (array_keys($lldp_if_array) as $entry_key) {
                if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex'])) {
                    $ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
                } else {
                    $ifIndex = $entry_key;
                }
                $interface = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex));
Ejemplo n.º 21
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
echo "Cisco CEF Switching Path: ";
$cefs = snmpwalk_cache_threepart_oid($device, "cefSwitchingPath", array(), 'CISCO-CEF-MIB');
if (OBS_DEBUG > 1) {
    print_vars($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";