function getValues($port)
{
    global $config, $device;
    if ($device['snmpver'] == "1") {
        $oids = "IF-MIB::ifInOctets." . $port['ifIndex'] . " IF-MIB::ifOutOctets." . $port['ifIndex'];
    } else {
        $oids = "IF-MIB::ifHCInOctets." . $port['ifIndex'] . " IF-MIB::ifHCOutOctets." . $port['ifIndex'];
    }
    $data = snmp_get_multi($port, $oids, "-OQUs", "IF-MIB");
    $data = $data[$port['ifIndex']];
    if (is_numeric($data['ifHCInOctets']) && is_numeric($data['ifHCOutOctets'])) {
        return array('in' => $data['ifHCInOctets'], 'out' => $data['ifHCOutOctets']);
    } elseif (is_numeric($data['ifInOctets']) && is_numeric($data['ifOutOctets'])) {
        return array('in' => $data['ifInOctets'], 'out' => $data['ifOutOctets']);
    } else {
        return FALSE;
    }
}
Example #2
0
/**
 * Poll a table or oids from SNMP and build an RRD based on an array of arguments.
 *
 * Current limitations:
 *  - single MIB and RRD file for all graphs
 *  - single table per MIB
 *  - if set definition 'call_function', than poll used specific function for snmp walk/get,
 *    else by default used snmpwalk_cache_oid()
 *  - allowed oids only with simple numeric index (oid.0, oid.33), NOT allowed (oid.1.2.23)
 *  - only numeric data
 *
 * Example of (full) args array:
 *  array(
 *   'file'          => 'someTable.rrd',              // [MANDATORY] RRD filename, but if not set used MIB_table.rrd as filename
 *   'call_function' => 'snmpwalk_cache_oid'          // [OPTIONAL] Which function to use for snmp poll, bu default snmpwalk_cache_oid()
 *   'mib'           => 'SOMETHING-MIB',              // [OPTIONAL] MIB or list of MIBs separated by a colon
 *   'mib_dir'       => 'something',                  // [OPTIONAL] OS MIB directory or array of directories
 *   'graphs'        => array('one','two'),           // [OPTIONAL] List of graph_types that this table provides
 *   'table'         => 'someTable',                  // [RECOMENDED] Table name for OIDs
 *   'numeric'       => '.1.3.6.1.4.1.555.4.1.1.48',  // [OPTIONAL] Numeric table OID
 *   'ds_rename'     => array('http' => ''),          // [OPTIONAL] Array for renaming OIDs to DSes
 *   'oids'          => array(                        // List of OIDs you can use as key: full OID name
 *     'someOid' => array(                                 // OID name (You can use OID name, like 'cpvIKECurrSAs')
 *       'descr'     => 'Current IKE SAs',                 // [OPTIONAL] Description of the OID contents
 *       'numeric'   => '.1.3.6.1.4.1.555.4.1.1.48.45',    // [OPTIONAL] Numeric OID
 *       'index'     => '0',                               // [OPTIONAL] OID index, if not set equals '0'
 *       'ds_name'   => 'IKECurrSAs',                      // [OPTIONAL] DS name, if not set used OID name truncated to 19 chars
 *       'ds_type'   => 'GAUGE',                           // [OPTIONAL] DS type, if not set equals 'COUNTER'
 *       'ds_min'    => '0',                               // [OPTIONAL] Min value for DS, if not set equals 'U'
 *       'ds_max'    => '30000'                            // [OPTIONAL] Max value for DS, if not set equals '100000000000'
 *    )
 *  )
 *
 */
function collect_table($device, $oids_def, &$graphs)
{
    $rrd = array();
    $mib = NULL;
    $mib_dirs = NULL;
    $use_walk = isset($oids_def['table']) && $oids_def['table'];
    // Use snmpwalk by default
    $call_function = strtolower($oids_def['call_function']);
    switch ($call_function) {
        case 'snmp_get_multi':
            $use_walk = FALSE;
            break;
        case 'snmpwalk_cache_oid':
        default:
            $call_function = 'snmpwalk_cache_oid';
            if (!$use_walk) {
                // Break because we should use snmpwalk, but walking table not set
                return FALSE;
            }
    }
    if (isset($oids_def['numeric'])) {
        $oids_def['numeric'] = '.' . trim($oids_def['numeric'], '. ');
    }
    // Remove trailing dot
    if (isset($oids_def['mib'])) {
        $mib = $oids_def['mib'];
    }
    if (isset($oids_def['mib_dir'])) {
        $mib_dirs = mib_dirs($oids_def['mib_dir']);
    }
    if (isset($oids_def['file'])) {
        $rrd_file = $oids_def['file'];
    } else {
        if ($mib && isset($oids_def['table'])) {
            // Try to use MIB & tableName as rrd_file
            $rrd_file = strtolower(safename($mib . '_' . $oids_def['table'])) . '.rrd';
        } else {
            print_debug("  WARNING, not have rrd filename.");
            return FALSE;
            // Not have RRD filename
        }
    }
    // Get MIBS/Tables/OIDs permissions
    if ($use_walk) {
        // if use table walk, than check only this table permission (not oids)
        if (dbFetchCell("SELECT COUNT(*) FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ? AND `table_name` = ?\n                    AND (`oid` = '' OR `oid` IS NULL) AND `disabled` = '1'", array($device['device_id'], $mib, $oids_def['table']))) {
            print_debug("  WARNING, table '" . $oids_def['table'] . "' for '{$mib}' disabled and skipped.");
            return FALSE;
            // table disabled, exit
        }
        $oids_ok = TRUE;
    } else {
        // if use multi_get, than get all disabled oids
        $oids_disabled = dbFetchColumn("SELECT `oid` FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ?\n                                   AND (`oid` != '' AND `oid` IS NOT NULL) AND `disabled` = '1'", array($device['device_id'], $mib));
        $oids_ok = empty($oids_disabled);
        // if empty disabled, than set to TRUE
    }
    $search = array();
    $replace = array();
    if (is_array($oids_def['ds_rename'])) {
        foreach ($oids_def['ds_rename'] as $s => $r) {
            $search[] = $s;
            $replace[] = $r;
        }
    }
    // rrd DS limit is 20 bytes (19 chars + NULL terminator)
    $ds_len = 19;
    $oids = array();
    $oids_index = array();
    foreach ($oids_def['oids'] as $oid => $entry) {
        if (is_numeric($entry['numeric']) && isset($oids_def['numeric'])) {
            $entry['numeric'] = $oids_def['numeric'] . '.' . $entry['numeric'];
            // Numeric oid, for future using
        }
        if (!isset($entry['index'])) {
            $entry['index'] = '0';
        }
        if (!isset($entry['ds_type'])) {
            $entry['ds_type'] = 'COUNTER';
        }
        if (!isset($entry['ds_min'])) {
            $entry['ds_min'] = 'U';
        }
        if (!isset($entry['ds_max'])) {
            $entry['ds_max'] = '100000000000';
        }
        if (!isset($entry['ds_name'])) {
            // Convert OID name to DS name
            $ds_name = $oid;
            if (is_array($oids_def['ds_rename'])) {
                $ds_name = str_replace($search, $replace, $ds_name);
            }
        } else {
            $ds_name = $entry['ds_name'];
        }
        if (strlen($ds_name) > $ds_len) {
            $ds_name = truncate($ds_name, $ds_len, '');
        }
        if (isset($oids_def['no_index']) && $oids_def['no_index'] == TRUE) {
            $oids[] = $oid;
        } else {
            $oids[] = $oid . '.' . $entry['index'];
        }
        $oids_index[] = array('index' => $entry['index'], 'oid' => $oid);
        if (!$use_walk) {
            // Check permissions for snmp_get_multi _ONLY_
            // if at least one oid missing in $oids_disabled than TRUE
            $oids_ok = $oids_ok || !in_array($oid, $oids_disabled);
        }
        $rrd['rrd_create'][] = ' DS:' . $ds_name . ':' . $entry['ds_type'] . ':600:' . $entry['ds_min'] . ':' . $entry['ds_max'];
        if ($GLOBALS['debug']) {
            $rrd['ds_list'][] = $ds_name;
        }
        // Make DS lists for compare with RRD file in debug
    }
    if (!$use_walk && !$oids_ok) {
        print_debug("  WARNING, oids '" . implode("', '", array_keys($oids_def['oids'])) . "' for '{$mib}' disabled and skipped.");
        return FALSE;
        // All oids disabled, exit
    }
    switch ($call_function) {
        case 'snmpwalk_cache_oid':
            $data = snmpwalk_cache_oid($device, $oids_def['table'], array(), $mib, $mib_dirs);
            break;
        case 'snmp_get_multi':
            $data = snmp_get_multi($device, $oids, "-OQUs", $mib, $mib_dirs);
            break;
    }
    if (isset($GLOBALS['exec_status']['exitcode']) && $GLOBALS['exec_status']['exitcode'] !== 0) {
        // Break because latest snmp walk/get return not good exitstatus (wrong mib/timeout/error/etc)
        print_debug("  WARNING, latest snmp walk/get return not good exitstatus for '{$mib}', RRD update skipped.");
        return FALSE;
    }
    if (isset($oids_def['no_index']) && $oids_def['no_index'] == TRUE) {
        $data[0] = $data[''];
    }
    foreach ($oids_index as $entry) {
        $index = $entry['index'];
        $oid = $entry['oid'];
        if (is_numeric($data[$index][$oid])) {
            $rrd['ok'] = TRUE;
            // We have any data for current rrd_file
            $rrd['rrd_update'][] = $data[$index][$oid];
        } else {
            $rrd['rrd_update'][] = 'U';
        }
    }
    // Ok, all previous checks done, update RRD, table/oids permissions, $graphs
    if (isset($rrd['ok']) && $rrd['ok']) {
        // Create/update RRD file
        $rrd_create = implode('', $rrd['rrd_create']);
        $rrd_update = 'N:' . implode(':', $rrd['rrd_update']);
        rrdtool_create($device, $rrd_file, $rrd_create);
        rrdtool_update($device, $rrd_file, $rrd_update);
        foreach ($oids_def['graphs'] as $graph) {
            $graphs[$graph] = TRUE;
            // Set all graphs to TRUE
        }
        // Compare DSes form RRD file with DSes from array
        if (OBS_DEBUG) {
            $graph_template = "\$config['graph_types']['device']['GRAPH_CHANGE_ME'] = array(\n";
            $graph_template .= "  'file'      => '{$rrd_file}',\n";
            $graph_template .= "  'ds'        => array(\n";
            $rrd_file_info = rrdtool_file_info(get_rrd_path($device, $rrd_file));
            foreach ($rrd_file_info['DS'] as $ds => $nothing) {
                $ds_list[] = $ds;
                $graph_template .= "    '{$ds}' => array('label' => '{$ds}'),\n";
            }
            $graph_template .= "  )\n);";
            $in_args = array_diff($rrd['ds_list'], $ds_list);
            if ($in_args) {
                print_message("%rWARNING%n, in file '%W" . $rrd_file_info['filename'] . "%n' different DS lists. NOT have: " . implode(', ', $in_args));
            }
            $in_file = array_diff($ds_list, $rrd['ds_list']);
            if ($in_file) {
                print_message("%rWARNING%n, in file '%W" . $rrd_file_info['filename'] . "%n' different DS lists. Excess: " . implode(', ', $in_file));
            }
            // Print example for graph template using rrd_file and ds list
            print_message($graph_template);
        }
    } else {
        if ($use_walk) {
            // Table NOT exist on device!
            // Disable polling table (only if table not enabled manually in DB)
            if (!dbFetchCell("SELECT COUNT(*) FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ?\n                     AND `table_name` = ? AND (`oid` = '' OR `oid` IS NULL)", array($device['device_id'], $mib, $oids_def['table']))) {
                dbInsert(array('device_id' => $device['device_id'], 'mib' => $mib, 'table_name' => $oids_def['table'], 'disabled' => '1'), 'devices_mibs');
            }
            print_debug("  WARNING, table '" . $oids_def['table'] . "' for '{$mib}' disabled.");
        } else {
            // OIDs NOT exist on device!
            // Disable polling oids (only if table not enabled manually in DB)
            foreach (array_keys($oids_def['oids']) as $oid) {
                if (!dbFetchCell("SELECT COUNT(*) FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ?\n                       AND `oid` = ?", array($device['device_id'], $mib, $oid))) {
                    dbInsert(array('device_id' => $device['device_id'], 'mib' => $mib, 'oid' => $oid, 'disabled' => '1'), 'devices_mibs');
                }
            }
            print_debug("  WARNING, oids '" . implode("', '", array_keys($oids_def['oids'])) . "' for '{$mib}' disabled.");
        }
    }
    // Return obtained snmp data
    return $data;
}
<?php

if (preg_match('/^Cisco IOS Software, .+? Software \\([^\\-]+-([\\w\\d]+)-\\w\\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result)) {
    $features = $regexp_result[1];
    $version = $regexp_result[2];
} elseif (false) {
    # Placeholder
    # Other regexp for other type of string
}
echo "\n" . $poll_device['sysDescr'] . "\n";
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0") {
    if (!empty($data[1]['entPhysicalSoftwareRev'])) {
        $version = $data[1]['entPhysicalSoftwareRev'];
    }
    if (!empty($data[1]['entPhysicalName'])) {
        $hardware = $data[1]['entPhysicalName'];
    }
    if (!empty($data[1]['entPhysicalModelName'])) {
        $hardware = $data[1]['entPhysicalModelName'];
    }
}
#   if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
#   if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
#   if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
#   $ciscomodel = str_replace("\"","",$ciscomodel);
#   if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if (empty($hardware)) {
    $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB");
}
Example #4
0
function get_main_serial($device)
{
    if ($device['os_group'] == 'cisco') {
        $serial_output = snmp_get_multi($device, 'entPhysicalSerialNum.1 entPhysicalSerialNum.1001', '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
        if (!empty($serial_output[1]['entPhysicalSerialNum'])) {
            return $serial_output[1]['entPhysicalSerialNum'];
        } else {
            if (!empty($serial_output[1001]['entPhysicalSerialNum'])) {
                return $serial_output[1001]['entPhysicalSerialNum'];
            }
        }
    }
}
Example #5
0
 * (at your option) any later version.
 *
 * See COPYING for more details.
 */
unset($poll_device);
$snmpdata = snmp_get_multi($device, 'sysUpTime.0 sysLocation.0 sysContact.0 sysName.0 sysObjectID.0', '-OQnUst', 'SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
$poll_device = $snmpdata[0];
$poll_device['sysName'] = strtolower($poll_device['sysName']);
$poll_device['sysDescr'] = snmp_get($device, 'sysDescr.0', '-OvQ', 'SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
if (!empty($agent_data['uptime'])) {
    list($uptime) = explode(' ', $agent_data['uptime']);
    $uptime = round($uptime);
    echo "Using UNIX Agent Uptime ({$uptime})\n";
}
if (empty($uptime)) {
    $snmp_data = snmp_get_multi($device, 'snmpEngineTime.0 hrSystemUptime.0', '-OQnUst', 'HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
    $uptime_data = $snmp_data[0];
    $snmp_uptime = (int) $uptime_data['snmpEngineTime'];
    $hrSystemUptime = $uptime_data['hrSystemUptime'];
    if (!empty($hrSystemUptime) && !strpos($hrSystemUptime, 'No') && $device['os'] != 'windows') {
        // Move uptime into agent_uptime
        $agent_uptime = $uptime;
        $uptime = floor($hrSystemUptime / 100);
        echo 'Using hrSystemUptime (' . $uptime . "s)\n";
    } else {
        $uptime = floor($poll_device['sysUpTime'] / 100);
        echo 'Using SNMP Agent Uptime (' . $uptime . "s)\n  ";
    }
    //end if
}
//end if
<?php

/* Observium Network Management and Monitoring System
 * Copyright (C) 2006-2014, Observium Developers - http://www.observium.org
 *
 * @package    observium
 * @subpackage poller
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
unset($poll_device, $cache['devices']['uptime'][$device['device_id']]);
$snmpdata = snmp_get_multi($device, "sysUpTime.0 sysLocation.0 sysContact.0 sysName.0", "-OQUs", "SNMPv2-MIB", mib_dirs());
$polled = time();
$poll_device = $snmpdata[0];
$poll_device['sysDescr'] = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
$poll_device['sysObjectID'] = snmp_get($device, "sysObjectID.0", "-Oqvn", "SNMPv2-MIB", mib_dirs());
if (strpos($poll_device['sysObjectID'], 'Wrong Type') !== FALSE) {
    // Wrong Type (should be OBJECT IDENTIFIER): "1.3.6.1.4.1.25651.1.2"
    list(, $poll_device['sysObjectID']) = explode(':', $poll_device['sysObjectID']);
    $poll_device['sysObjectID'] = '.' . trim($poll_device['sysObjectID'], ' ."');
}
$poll_device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
$poll_device['sysName'] = strtolower($poll_device['sysName']);
if (isset($agent_data['uptime'])) {
    list($agent_data['uptime']) = explode(' ', $agent_data['uptime']);
}
if (is_numeric($agent_data['uptime'])) {
    $uptime = round($agent_data['uptime']);
    $uptime_msg = "Using UNIX Agent Uptime";
} else {
Example #7
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
Example #8
0
$hardware = rewrite_ceraos_hardware($ceragon_type, $device);
// function in ./includes/rewrites.php
if (stristr('IP10', $hardware)) {
    $serial = snmp_get($device, 'genEquipUnitIDUSerialNumber.0', '-Oqv', 'MWRM-UNIT-MIB');
} else {
    $serial = snmp_get($device, 'genEquipInventorySerialNumber.127', '-Oqv', 'MWRM-UNIT-MIB');
}
$multi_get_array = snmp_get_multi($device, 'genEquipMngSwIDUVersionsRunningVersion.1 genEquipUnitLatitude.0 genEquipUnitLongitude.0', '-OQU', 'MWRM-RADIO-MIB');
d_echo($multi_get_array);
$version = $multi_get_array[1]['MWRM-UNIT-MIB::genEquipMngSwIDUVersionsRunningVersion'];
$latitude = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLatitude'];
$longitude = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLongitude'];
$ifIndex_array = array();
$ifIndex_array = explode("\n", snmp_walk($device, 'ifIndex', '-Oqv', 'IF-MIB'));
d_echo($ifIndex_array);
$snmp_get_oids = "";
foreach ($ifIndex_array as $ifIndex) {
    $snmp_get_oids .= "ifDescr.{$ifIndex} ifName.{$ifIndex} ";
}
$num_radios = 0;
$ifDescr_array = array();
$ifDescr_array = snmp_get_multi($device, $snmp_get_oids, '-OQU', 'IF-MIB');
d_echo($ifDescr_array);
foreach ($ifIndex_array as $ifIndex) {
    d_echo("\$ifDescr_array[{$ifIndex}]['IF-MIB::ifDescr'] = " . $ifDescr_array[$ifIndex]['IF-MIB::ifDescr'] . "\n");
    if (stristr($ifDescr_array[$ifIndex]['IF-MIB::ifDescr'], "Radio")) {
        $num_radios = $num_radios + 1;
    }
}
$features = $num_radios . " radios in unit";
unset($ceragon_type, $multi_get_array, $ifIndex_array, $ifIndex, $ifDescr_array, $ifDescr, $num_radios);
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasIPSecPeakConcurrentSessions.0 = Gauge32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LNumSessions.0 = Gauge32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LCumulateSessions.0 = Counter32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LPeakConcurrentSessions.0 = Gauge32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBNumSessions.0 = Gauge32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBCumulateSessions.0 = Counter32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBPeakConcurrentSessions.0 = Gauge32: 0 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCNumSessions.0 = Gauge32: 7 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCCumulateSessions.0 = Counter32: 53 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCPeakConcurrentSessions.0 = Gauge32: 9 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnNumSessions.0 = Gauge32: 7 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnCumulateSessions.0 = Counter32: 29 Sessions
// CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnPeakConcurrentSessions.0 = Gauge32: 9 Sessions
if ($device['os_group'] == 'cisco') {
    $oid_list = 'crasEmailNumSessions.0 crasIPSecNumSessions.0 crasL2LNumSessions.0 crasLBNumSessions.0 crasSVCNumSessions.0 crasWebvpnNumSessions.0';
    $data = snmp_get_multi($device, $oid_list, '-OUQs', 'CISCO-REMOTE-ACCESS-MONITOR-MIB');
    $data = $data[0];
    $rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('cras_sessions.rrd');
    $rrd_create .= ' DS:email:GAUGE:600:0:U';
    $rrd_create .= ' DS:ipsec:GAUGE:600:0:U';
    $rrd_create .= ' DS:l2l:GAUGE:600:0:U';
    $rrd_create .= ' DS:lb:GAUGE:600:0:U';
    $rrd_create .= ' DS:svc:GAUGE:600:0:U';
    $rrd_create .= ' DS:webvpn:GAUGE:600:0:U';
    $rrd_create .= $config['rrd_rra'];
    if (is_file($rrd_filename) || $data['crasEmailNumSessions'] || $data['crasIPSecNumSessions'] || $data['crasL2LNumSessions'] || $data['crasLBNumSessions'] || $data['crasSVCNumSessions'] || $data['crasWebvpnSessions']) {
        if (!file_exists($rrd_filename)) {
            rrdtool_create($rrd_filename, $rrd_create);
        }
        $fields = array('email' => $data['crasEmailNumSessions'], 'ipsec' => $data['crasIPSecNumSessions'], 'l2l' => $data['crasL2LNumSessions'], 'lb' => $data['crasLBNumSessions'], 'svc' => $data['crasSVCNumSessions'], 'webvpn' => $data['crasWebvpnNumSessions']);
        rrdtool_update($rrd_filename, $fields);
Example #10
0
         foreach ($temp_data as $k => $v) {
             $cbgp_data .= "{$v}\n";
         }
         d_echo("{$cbgp_data}\n");
     } else {
         // FIXME - move to function
         $oids = " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         $oids .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
         d_echo("{$oids}\n");
         $cbgp_data = snmp_get_multi($device, $oids, '-OUQs ', 'CISCO-BGP4-MIB');
         $cbgp_data = array_pop($cbgp_data);
         d_echo("{$cbgp_data}\n");
     }
     //end if
     $cbgpPeerAcceptedPrefixes = $cbgp_data['cbgpPeerAcceptedPrefixes'];
     $cbgpPeerDeniedPrefixes = $cbgp_data['cbgpPeerDeniedPrefixes'];
     $cbgpPeerPrefixAdminLimit = $cbgp_data['cbgpPeerPrefixAdminLimit'];
     $cbgpPeerPrefixThreshold = $cbgp_data['cbgpPeerPrefixThreshold'];
     $cbgpPeerPrefixClearThreshold = $cbgp_data['cbgpPeerPrefixClearThreshold'];
     $cbgpPeerAdvertisedPrefixes = $cbgp_data['cbgpPeerAdvertisedPrefixes'];
     $cbgpPeerSuppressedPrefixes = $cbgp_data['cbgpPeerSuppressedPrefixes'];
     $cbgpPeerWithdrawnPrefixes = $cbgp_data['cbgpPeerWithdrawnPrefixes'];
     unset($cbgp_data);
 }
 //end if
Example #11
0
     **/
 d_echo($oids . "\n");
 if (!empty($oids)) {
     echo 'EQLCONTROLLER-MIB ';
     foreach (explode("\n", $oids) as $data) {
         $data = trim($data);
         if (!empty($data)) {
             list($oid, $descr) = explode(' = ', $data, 2);
             $split_oid = explode('.', $oid);
             $num_index = $split_oid[count($split_oid) - 1];
             $index = $num_index;
             $part_oid = $split_oid[count($split_oid) - 2];
             $num_index = $part_oid . '.' . $num_index;
             $base_oid = '.1.3.6.1.4.1.12740.2.1.7.1.3.1.';
             $oid = $base_oid . $num_index;
             $extra = snmp_get_multi($device, "eqlMemberHealthDetailsFanValue.1.{$num_index} eqlMemberHealthDetailsFanCurrentState.1.{$num_index} eqlMemberHealthDetailsFanHighCriticalThreshold.1.{$num_index} eqlMemberHealthDetailsFanHighWarningThreshold.1.{$num_index} eqlMemberHealthDetailsFanLowCriticalThreshold.1.{$num_index} eqlMemberHealthDetailsFanLowWarningThreshold.1.{$num_index}", '-OQUs', 'EQLMEMBER-MIB', $config['install_dir'] . '/mibs/equallogic');
             $keys = array_keys($extra);
             $temperature = $extra[$keys[0]]['eqlMemberHealthDetailsFanValue'];
             $low_limit = $extra[$keys[0]]['eqlMemberHealthDetailsFanLowCriticalThreshold'];
             $low_warn = $extra[$keys[0]]['eqlMemberHealthDetailsFanLowWarningThreshold'];
             $high_limit = $extra[$keys[0]]['eqlMemberHealthDetailsFanHighCriticalThreshold'];
             $high_warn = $extra[$keys[0]]['eqlMemberHealthDetailsFanHighWarningThreshold'];
             $index = 100 + $index;
             if ($extra[$keys[0]]['eqlMemberHealthDetailsFanCurrentState'] != 'unknown') {
                 discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, $low_limit, $low_warn, $high_limit, $high_warn, $temperature);
             }
         }
         //end if
     }
     //end foreach
 }
Example #12
0
<?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 = snmp_get_multi($device, 'rcSysDramSize.0 rcSysDramFree.0', '-OQUs', 'RAPID-CITY');
$mempool['total'] = $cache_mempool[$index]['rcSysDramSize'] * 1024;
$mempool['free'] = $cache_mempool[$index]['rcSysDramFree'];
// EOF
Example #13
0
<?php

if (!starts_with($device['os'], array('Snom', 'asa'))) {
    echo ' UDP';
    // These are at the start of large trees that we don't want to walk the entirety of, so we snmpget_multi them
    $oids = array('udpInDatagrams', 'udpOutDatagrams', 'udpInErrors', 'udpNoPorts');
    $rrd_def = array();
    $snmpstring = '';
    foreach ($oids as $oid) {
        $oid_ds = substr($oid, 0, 19);
        $rrd_def[] = " DS:{$oid_ds}:COUNTER:600:U:1000000";
        // Limit to 1MPPS?
        $snmpstring .= ' UDP-MIB::' . $oid . '.0';
    }
    $data = snmp_get_multi($device, $snmpstring, '-OQUs', 'UDP-MIB');
    $fields = array();
    foreach ($oids as $oid) {
        if (is_numeric($data[0][$oid])) {
            $value = $data[0][$oid];
        } else {
            $value = 'U';
        }
        $fields[$oid] = $value;
    }
    if (isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams'])) {
        $tags = compact('rrd_def');
        data_update($device, 'netstats-udp', $tags, $fields);
        $graphs['netstat_udp'] = true;
    }
}
//end if
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
$mib = 'PEAKFLOW-SP-MIB';
$cache_mempool = snmp_get_multi($device, "devicePhysicalMemory.0 devicePhysicalMemoryInUse.0", "-OQUs", $mib);
$mempool['total'] = $cache_mempool[$index]['devicePhysicalMemory'];
$mempool['used'] = $cache_mempool[$index]['devicePhysicalMemoryInUse'];
// EOF
Example #15
0
<?php

// HOST-RESOURCES-MIB
//  Generic System Statistics
$oid_list = "hrSystemProcesses.0 hrSystemNumUsers.0";
$hrSystem = snmp_get_multi($device, $oid_list, "-OUQs", "HOST-RESOURCES-MIB");
echo "HR Stats:";
if (is_numeric($hrSystem[0]['hrSystemProcesses'])) {
    $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd";
    if (!is_file($rrd_file)) {
        rrdtool_create($rrd_file, "--step 300 \\\n    DS:procs:GAUGE:600:0:U " . $config['rrd_rra']);
    }
    rrdtool_update($rrd_file, "N:" . $hrSystem[0]['hrSystemProcesses']);
    $graphs['hr_processes'] = TRUE;
    echo " Processes";
}
if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) {
    $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd";
    if (!is_file($rrd_file)) {
        rrdtool_create($rrd_file, "--step 300 \\\n    DS:users:GAUGE:600:0:U " . $config['rrd_rra']);
    }
    rrdtool_update($rrd_file, "N:" . $hrSystem[0]['hrSystemNumUsers']);
    $graphs['hr_users'] = TRUE;
    echo " Users";
}
echo "\n";
<?php

if ($device['os'] != 'Snom') {
    echo ' IP-FORWARD';
    // Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
    $oids = array('ipCidrRouteNumber');
    unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
    $rrd_def = array();
    $snmpstring = '';
    foreach ($oids as $oid) {
        $oid_ds = substr($oid, 0, 19);
        $rrd_create[] = "DS:{$oid_ds}:GAUGE:600:U:1000000";
        // Limit to 1MPPS?
        $snmpstring .= ' IP-FORWARD-MIB::' . $oid . '.0';
    }
    $data = snmp_get_multi($device, $snmpstring, '-OQUs', 'IP-FORWARD-MIB');
    $fields = array();
    foreach ($oids as $oid) {
        if (is_numeric($data[0][$oid])) {
            $value = $data[0][$oid];
        } else {
            $value = 'U';
        }
        $fields[$oid] = $value;
    }
    if (isset($data[0]['ipCidrRouteNumber'])) {
        $tags = compact('rrd_def');
        data_update($device, 'netstats-ip_forward', $tags, $fields);
        $graphs['netstat_ip_forward'] = true;
    }
}
Example #17
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 #18
0
<?php

/*
 * Observium Network Management and Monitoring System
 * Copyright (C) 2006-2011, Observium Developers - http://www.observium.org
 *
 * 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.
 *
 * See COPYING for more details.
 */
unset($poll_device);
$snmpdata = snmp_get_multi($device, 'sysUpTime.0 sysLocation.0 sysContact.0 sysName.0', '-OQUs', 'SNMPv2-MIB');
$poll_device = $snmpdata[0];
$poll_device['sysDescr'] = snmp_get($device, 'sysDescr.0', '-Oqv', 'SNMPv2-MIB');
$poll_device['sysObjectID'] = snmp_get($device, 'sysObjectID.0', '-Oqvn', 'SNMPv2-MIB');
$poll_device['sysName'] = strtolower($poll_device['sysName']);
if (!empty($agent_data['uptime'])) {
    list($uptime) = explode(' ', $agent_data['uptime']);
    $uptime = round($uptime);
    echo "Using UNIX Agent Uptime ({$uptime})\n";
}
if (empty($uptime)) {
    $snmp_uptime = (int) snmp_get($device, 'snmpEngineTime.0', '-OUqv', 'SNMP-FRAMEWORK-MIB');
    $hrSystemUptime = snmp_get($device, 'hrSystemUptime.0', '-Oqv', 'HOST-RESOURCES-MIB');
    if (!empty($hrSystemUptime) && !strpos($hrSystemUptime, 'No') && $device['os'] != 'windows') {
        echo 'Using hrSystemUptime (' . $hrSystemUptime . ")\n";
        $agent_uptime = $uptime;
        // Move uptime into agent_uptime
// SNMP
$netstats_poll['snmp']['mib'] = 'SNMPv2-MIB';
$netstats_poll['snmp']['graphs'] = array('netstat_snmp_stats', 'netstat_snmp_packets');
$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';
function snmpget_entity_oids($oids, $index, $device, $array, $mib = NULL)
{
    global $config;
    foreach ($oids as $oid) {
        $oid_string .= " {$oid}.{$index}";
    }
    $array = snmp_get_multi($device, $oids, "-Ovq", $mib, mib_dirs());
    return $array;
}
function isSNMPable($device)
{
    global $config;
    $time_start = microtime(true);
    $pos = snmp_get_multi($device, 'sysObjectID.0 sysUpTime.0', '-OQUst', 'SNMPv2-MIB', mib_dirs());
    // sysObjectID and sysUpTime
    $time_end = microtime(true);
    if (is_array($pos[0]) && count($pos[0])) {
        $time_snmp = $time_end - $time_start;
        $time_snmp *= 1000;
        // SNMP response time in milliseconds.
        /// Note, it's full SNMP get/response time (not only UDP request).
        $time_snmp = number_format($time_snmp, 2, '.', '');
        return $time_snmp;
    }
    return 0;
}
Example #22
0
     **/
 d_echo($oids . "\n");
 if (!empty($oids)) {
     echo 'EQLCONTROLLER-MIB ';
     foreach (explode("\n", $oids) as $data) {
         $data = trim($data);
         if (!empty($data)) {
             list($oid, $descr) = explode(' = ', $data, 2);
             $split_oid = explode('.', $oid);
             $num_index = $split_oid[count($split_oid) - 1];
             $index = $num_index;
             $part_oid = $split_oid[count($split_oid) - 2];
             $num_index = $part_oid . '.' . $num_index;
             $base_oid = '.1.3.6.1.4.1.12740.2.1.8.1.3.1.';
             $oid = $base_oid . $num_index;
             $extra = snmp_get_multi($device, "eqlMemberHealthDetailsPowerSupplyCurrentState.3.329840783.{$index}", '-OQUse', 'EQLMEMBER-MIB', $config['install_dir'] . '/mibs/equallogic');
             $keys = array_keys($extra);
             $temperature = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyValue'];
             $low_limit = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyLowCriticalThreshold'];
             $low_warn = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyLowWarningThreshold'];
             $high_limit = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyHighCriticalThreshold'];
             $high_warn = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyHighWarningThreshold'];
             $index = 100 + $index;
             if ($extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyCurrentState'] != 'unknown') {
                 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, 'snmp', $descr, 1, 1, $low_limit, $low_warn, $high_limit, $high_warn, $temperature);
             }
         }
         //end if
     }
     //end foreach
 }
Example #23
0
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
/*
 * Fetch the VMware product version.
 *
 *  VMWARE-SYSTEM-MIB::vmwProdName.0 = STRING: VMware ESXi
 *  VMWARE-SYSTEM-MIB::vmwProdVersion.0 = STRING: 4.1.0
 *  VMWARE-SYSTEM-MIB::vmwProdBuild.0 = STRING: 348481
 *
 *  version:   ESXi 4.1.0
 *  features:  build-348481
 */
$data = snmp_get_multi($device, "VMWARE-SYSTEM-MIB::vmwProdName.0 VMWARE-SYSTEM-MIB::vmwProdVersion.0 VMWARE-SYSTEM-MIB::vmwProdBuild.0", "-OQUs", "+VMWARE-ROOT-MIB:VMWARE-SYSTEM-MIB", mib_dirs("vmware"));
$version = preg_replace("/^VMware /", "", $data[0]["vmwProdName"]) . " " . $data[0]["vmwProdVersion"];
$features = "build-" . $data[0]["vmwProdBuild"];
if (is_array($entPhysical)) {
    $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: ";
/*
<?php

// Cisco Small Business
# CISCOSB-rndMng::rlCpuUtilEnable.0 = INTEGER: true(1)
# CISCOSB-rndMng::rlCpuUtilDuringLast5Minutes.0 = INTEGER: 4
echo " CISCOSB-rndMng ";
$data = snmp_get_multi($device, 'rlCpuUtilEnable.0 rlCpuUtilDuringLast5Minutes.0', "-OQUs", "CISCOSB-rndMng", mib_dirs(array('ciscosb')));
$descr = "CPU";
$index = 0;
$oid = ".1.3.6.1.4.1.9.6.1.101.1.9.{$index}";
$usage = $data[0]['rlCpuUtilDuringLast5Minutes'];
if ($data[0]['rlCpuUtilEnable'] == 'true') {
    discover_processor($valid['processor'], $device, $oid, $index, "ciscosb", $descr, "1", $usage, NULL, NULL);
}
// EOF
Example #25
0
<?php

$oids = "entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB");
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != "") {
    $version = $data[1]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != "") {
    $hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != "") {
    $hardware = $data[1]['entPhysicalModelName'];
}
if (empty($hardware)) {
    $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB");
}
 * @subpackage poller
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
/**

RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemName.0 = <removed>
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemIPAddr.0 = 192.168.x.x
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemMacAddr.0 = 8c:c:90:xx:xx:xx
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemUptime.0 = 46:2:37:16.77
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemModel.0 = zd1112
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemLicensedAPs.0 = 12
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemMaxSta.0 = 1250
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemSerialNumber.0 = <removed>
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemVersion.0 = 9.8.1.0 build 101
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemCountryCode.0 = "US"
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemAdminName.0 = ********
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemAdminPassword.0 = ********
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemStatus.0 = noredundancy
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemPeerConnectedStatus.0 = disconnected
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemNEId.0 =
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemManufacturer.0 = Ruckus Wireless
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemSoftwareName.0 = zd3k_9.8.1.0 build 101.img
RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemMgmtVlanID.0 = 1
*/
$data = snmp_get_multi($device, "ruckusZDSystemModel.0 ruckusZDSystemSerialNumber.0 ruckusZDSystemVersion.0 ", "-OQUs", "RUCKUS-ZD-SYSTEM-MIB", mib_dirs("ruckus"));
$data = $data[0];
$serial = $data['ruckusZDSystemSerialNumber'];
$hardware = $data['ruckusZDSystemModel'];
$version = $data['ruckusZDSystemVersion'];
unset($data);
Example #27
0
<?php

/*
 * LibreNMS Cisco wireless controller information module
 *
 * Copyright (c) 2016 Tuomas Riihimäki <*****@*****.**>
 * 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.
 */
global $config;
$oids = 'entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1';
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB');
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') {
    $version = $data[1]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') {
    $hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
    $hardware = $data[1]['entPhysicalModelName'];
}
if (empty($hardware)) {
    $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
$stats = snmpwalk_cache_oid($device, "bsnAPEntry", $stats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$radios = snmpwalk_cache_oid($device, "bsnAPIfEntry", $radios, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$APstats = snmpwalk_cache_oid($device, 'bsnApIfNoOfUsers', $APstats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb');
$loadParams = snmpwalk_cache_oid($device, "bsnAPIfLoadChannelUtilization", $loadParams, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
Example #28
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
//AIRESPACE-SWITCHING-MIB::agentInventorySysDescription.0 = STRING: Cisco Controller
//AIRESPACE-SWITCHING-MIB::agentInventoryMachineModel.0 = STRING: AIR-CT5508-K9
//AIRESPACE-SWITCHING-MIB::agentInventorySerialNumber.0 = STRING: FCW1546L0D6
//AIRESPACE-SWITCHING-MIB::agentInventoryProductName.0 = STRING: Cisco Controller
//AIRESPACE-SWITCHING-MIB::agentInventoryProductVersion.0 = STRING: 7.6.100.0
$data = snmp_get_multi($device, 'agentInventoryMachineModel.0 agentInventoryProductVersion.0 agentInventorySerialNumber.0', '-OQUs', 'AIRESPACE-SWITCHING-MIB');
if (is_array($data[0])) {
    $hardware = $data[0]['agentInventoryMachineModel'];
    $version = $data[0]['agentInventoryProductVersion'];
    $serial = $data[0]['agentInventorySerialNumber'];
} else {
    if ($entPhysical['entPhysicalModelName']) {
        $hardware = $entPhysical['entPhysicalModelName'];
        $version = $entPhysical['entPhysicalSoftwareRev'];
        $serial = $entPhysical['entPhysicalSerialNum'];
    }
}
if (empty($hardware) && $poll_device['sysObjectID']) {
    // Try translate instead duplicate get sysObjectID
    $hardware = snmp_translate($poll_device['sysObjectID'], 'SNMPv2-MIB:CISCO-PRODUCTS-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB');
}
Example #29
0
 $ip_cast = 1;
 if ($peer_afi['safi'] == 'multicast') {
     $ip_cast = 2;
 } else {
     if ($peer_afi['safi'] == 'unicastAndMulticast') {
         $ip_cast = 3;
     } else {
         if ($peer_afi['safi'] == 'vpn') {
             $ip_cast = 128;
         }
     }
 }
 $check = snmp_get($device, 'cbgpPeer2AcceptedPrefixes.' . $ip_type . '.' . $ip_len . '.' . $bgp_peer_ident . '.' . $ip_type . '.' . $ip_cast, '', 'CISCO-BGP4-MIB', $config['mibdir']);
 if (!empty($check)) {
     $cgp_peer_identifier = $ip_type . '.' . $ip_len . '.' . $bgp_peer_ident . '.' . $ip_type . '.' . $ip_cast;
     $cbgp_data_tmp = snmp_get_multi($device, ' cbgpPeer2AcceptedPrefixes.' . $cgp_peer_identifier . ' cbgpPeer2DeniedPrefixes.' . $cgp_peer_identifier . ' cbgpPeer2PrefixAdminLimit.' . $cgp_peer_identifier . ' cbgpPeer2PrefixThreshold.' . $cgp_peer_identifier . ' cbgpPeer2PrefixClearThreshold.' . $cgp_peer_identifier . ' cbgpPeer2AdvertisedPrefixes.' . $cgp_peer_identifier . ' cbgpPeer2SuppressedPrefixes.' . $cgp_peer_identifier . ' cbgpPeer2WithdrawnPrefixes.' . $cgp_peer_identifier, '-OQUs', 'CISCO-BGP4-MIB', $config['mibdir']);
     $ident = "{$ip_ver}.\"" . $peer['bgpPeerIdentifier'] . '"' . '.' . $ip_type . '.' . $ip_cast;
     unset($cbgp_data);
     $temp_keys = array_keys($cbgp_data_tmp);
     unset($temp_data);
     $temp_data['cbgpPeer2AcceptedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2AcceptedPrefixes'];
     $temp_data['cbgpPeer2DeniedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2DeniedPrefixes'];
     $temp_data['cbgpPeer2PrefixAdminLimit'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixAdminLimit'];
     $temp_data['cbgpPeer2PrefixThreshold'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixThreshold'];
     $temp_data['cbgpPeer2PrefixClearThreshold'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixClearThreshold'];
     $temp_data['cbgpPeer2AdvertisedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2AdvertisedPrefixes'];
     $temp_data['cbgpPeer2SuppressedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2SuppressedPrefixes'];
     $temp_data['cbgpPeer2WithdrawnPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2WithdrawnPrefixes'];
     foreach ($temp_data as $k => $v) {
         $cbgp_data .= "{$v}\n";
     }
Example #30
0
    echo "{$table} ";
    $cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB");
}
foreach ($cache['apc'] as $index => $entry) {
    $descr = $entry['coolingUnitExtendedDiscreteDescription'];
    $oid = ".1.3.6.1.4.1.318.1.1.27.1.6.2.2.1.4.{$index}";
    $value = $entry['coolingUnitExtendedDiscreteValue'];
    // If we have a state mapped, add status, if not, well... help.
    if ($apc_discrete_map[$entry['coolingUnitExtendedDiscreteIntegerReferenceKey']]) {
        discover_status($device, $oid, "coolingUnitExtendedDiscreteValueAsInteger.{$index}", $apc_discrete_map[$entry['coolingUnitExtendedDiscreteIntegerReferenceKey']], $descr, 1, $value);
    }
}
unset($apc_discrete_map);
#### Legacy mUpsEnvironment Sensors (AP9312TH) #######################################################
echo ' ';
$cache['apc'] = snmp_get_multi($device, "mUpsEnvironAmbientTemperature.0 mUpsEnvironRelativeHumidity.0 mUpsEnvironAmbientTemperature2.0 mUpsEnvironRelativeHumidity2.0", "-OUQs", "PowerNet-MIB");
foreach ($cache['apc'] as $index => $entry) {
    if (is_numeric($entry['mUpsEnvironAmbientTemperature'])) {
        $descr = "Probe 1 Temperature";
        $oid = ".1.3.6.1.4.1.318.1.1.2.1.1.{$index}";
        $value = $entry['mUpsEnvironAmbientTemperature'];
        discover_sensor($valid['sensor'], 'temperature', $device, $oid, "mUpsEnvironAmbientTemperature.{$index}", 'apc', $descr, 1, $value);
    }
    if (is_numeric($entry['mUpsEnvironRelativeHumidity'])) {
        $descr = "Probe 1 Humidity";
        $oid = ".1.3.6.1.4.1.318.1.1.2.1.2.{$index}";
        $value = $entry['mUpsEnvironRelativeHumidity'];
        discover_sensor($valid['sensor'], 'humidity', $device, $oid, "mUpsEnvironRelativeHumidity.{$index}", 'apc', $descr, 1, $value);
    }
    if (is_numeric($entry['mUpsEnvironAmbientTemperature2'])) {
        $descr = "Probe 2 Temperature";