<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // Force rediscover os if os definition changed if (!isset($config['os'][$device['os']])) { print_debug('OS name change detected, forced os rediscover.'); force_discovery($device, 'os'); } // Cache hardware/version/serial info from ENTITY-MIB (if possible use inventory module data) if (is_device_mib($device, 'ENTITY-MIB') && (in_array($device['os_group'], array('unix', 'cisco')) || in_array($device['os'], array('acme', 'nos', 'ibmnos', 'acsw', 'fabos', 'wlc', 'h3c', 'hh3c', 'hpuww')))) { // Get entPhysical tables for some OS and OS groups if ($config['discovery_modules']['inventory']) { $entPhysical = dbFetchRow('SELECT * FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalContainedIn` = ?', array($device['device_id'], '0')); } else { switch (TRUE) { case $device['os_group'] == 'cisco' || in_array($device['os'], array('acme', 'h3c', 'hh3c')): $oids = 'entPhysicalDescr.1 entPhysicalSerialNum.1 entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1'; break; case $device['os'] == 'qnap': $oids = 'entPhysicalDescr.1 entPhysicalName.1 entPhysicalSerialNum.1 entPhysicalFirmwareRev.1'; break; case $device['os'] == 'ibmnos':
* Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $index = $storage['storage_index']; if (!is_array($cache_storage['NIMBLE-MIB'])) { foreach (array('volSizeLow', 'volSizeHigh', 'volUsageLow', 'volUsageHigh', 'volOnline') as $param) { $cache_storage['NIMBLE-MIB'] = snmpwalk_cache_oid($device, $param, $cache_storage['NIMBLE-MIB'], 'NIMBLE-MIB'); } if (OBS_DEBUG > 1 && count($cache_storage['NIMBLE-MIB'])) { print_vars($cache_storage['NIMBLE-MIB']); } } $entry = $cache_storage['NIMBLE-MIB'][$index]; // FIXME, probably need additional field for storages like OperStatus up/down $ignore = in_array($entry['volOnline'], array('0', 'false')) ? 1 : 0; if ($storage['storage_ignore'] != $ignore) { force_discovery($device, 'storage'); } $storage['units'] = 1048576; // Hardcode units. In MIB is written that bytes, but really Mbytes $storage['size'] = snmp_size64_high_low($entry['volSizeHigh'], $entry['volSizeLow']) * $storage['units']; $storage['used'] = snmp_size64_high_low($entry['volUsageHigh'], $entry['volUsageLow']) * $storage['units']; $storage['free'] = $storage['size'] - $storage['used']; unset($index, $entry, $ignore); // EOF
$cache_storage = array(); } // This cache used also in storage module $table_rows = array(); $sql = "SELECT * FROM `mempools`"; $sql .= " LEFT JOIN `mempools-state` USING (`mempool_id`)"; $sql .= " WHERE `device_id` = ?"; foreach (dbFetchRows($sql, array($device['device_id'])) as $mempool) { $mib_lower = strtolower($mempool['mempool_mib']); $file = $config['install_dir'] . "/includes/polling/mempools/" . $mib_lower . ".inc.php"; if (is_file($file)) { $cache_mempool = NULL; $index = $mempool['mempool_index']; include $file; } else { force_discovery($device, 'mempools'); continue; } // FIXME. rename precision to scale if (!$mempool['mempool_precision']) { $mempool['mempool_precision'] = 1; } if (isset($mempool['total']) && isset($mempool['used'])) { $mempool['perc'] = round($mempool['used'] / $mempool['total'] * 100, 2); $mempool['total'] *= $mempool['mempool_precision']; $mempool['used'] *= $mempool['mempool_precision']; } else { if (isset($mempool['total']) && isset($mempool['free'])) { $mempool['used'] = $mempool['total'] - $mempool['free']; $mempool['perc'] = round($mempool['used'] / $mempool['total'] * 100, 2); $mempool['total'] *= $mempool['mempool_precision'];
$c_table_row[] = $cbgpPeerDeniedPrefixes; $c_table_row[] = $cbgpPeerAdvertisedPrefixes; $c_table_rows[] = $c_table_row; unset($c_table_row); } # while } # os_group=cisco | vendors } // End While loop on peers if (count($table_rows)) { echo PHP_EOL; $headers = array('%WPeer IP%n', '%WASN%n', '%WAS%n', '%WAdmin%n', '%WState%n', '%WLocal IP%n', '%WEstablished Time%n', '%WLast Update%n'); print_cli_table($table_rows, $headers, "Sessions"); $headers = array('%WPeer IP%n', '%WASN%n', '%WAFI/SAFI%n', '%WAccepted Pfx%n', '%WDenied Pfx%n', '%WAdvertised Pfx%n'); print_cli_table($c_table_rows, $headers, "Address Families"); } foreach ($p_list as $peer_ip => $entry) { // Check if new peers found $force_discovery = $force_discovery || !empty($entry); } if ($force_discovery) { // Force rediscover bgp peers print_debug("BGP peers list for this device changed, force rediscover BGP."); force_discovery($device, 'bgp-peers'); } } // End check for BGP support // Clean unset($bgp_peers, $vendor_peers, $vendor_mib, $cisco_version, $cisco_peers, $c_prefixes); // EOF
check_entity('sla', $sla, $metrics); //echo("SLA " . $sla['sla_index'] . ": " . $sla['rtt_type'] . " " . $sla['sla_owner'] . " " . $sla['sla_tag']. "... "); //echo($sla_state['rtt_value'] . 'ms at ' . format_unixtime($sla_state['rtt_unixtime']) . ', Sense code - "' . $sla_state['rtt_sense'] . '"'); $table_row = array(); $table_row[] = "SLA " . $sla['sla_index']; $table_row[] = $sla['sla_mib']; $table_row[] = $sla['rtt_type']; $table_row[] = $sla['sla_owner']; $table_row[] = $sla['sla_tag']; $table_row[] = $sla_state['rtt_sense']; $table_row[] = $sla_state['rtt_value'] . 'ms'; $table_rows[] = $table_row; unset($table_row); } else { echo 'NaN'; $rrd_value = 'U'; } rrdtool_create($device, $rrd_filename, $rrd_ds); rrdtool_update($device, $rrd_filename, 'N:' . $rrd_value); unset($rrd_ds, $rrd_value, $rrd_filename); } } echo PHP_EOL; $headers = array('%WLabel%n', '%WMIB%n', '%WType%n', '%WOwner%n', '%WTag%n', '%WSense%n', '%WResponse%n'); print_cli_table($table_rows, $headers); if ($sla_db_count != $sla_snmp_count) { // Force rediscover slas print_debug("SLA total count for this device changed (DB: {$sla_db_count}, SNMP: {$sla_snmp_count}), force rediscover SLAs."); force_discovery($device, 'sla'); } // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage update * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // This is is a fix for incorrect rrd file rename after r7839 foreach (dbFetchRows("SELECT * FROM `devices` WHERE `os` = ? OR `os` = ?;", array('nos', 'fabos')) as $entry) { $status = rename_rrd($entry, 'processor-swCpuOrMemoryUsage-1.rrd', 'processor-swCpuUsage-0.rrd'); if ($status) { echo '.'; force_discovery($entry); } } // EOF
// Update SQL State if (is_numeric($pw['pwUptime'])) { dbUpdate($metrics, 'pseudowires-state', '`pseudowire_id` = ?', array($pw['pseudowire_id'])); } else { $metrics['pseudowire_id'] = $pw['pseudowire_id']; dbInsert($metrics, 'pseudowires-state'); } // Add table row $table_row = array(); $table_row[] = $pw['pwID']; $table_row[] = $pw['mib']; $table_row[] = $pw['pwType']; $table_row[] = $pw['pwPsnType']; $table_row[] = $pw['peer_addr']; $table_row[] = $metrics['pwOperStatus']; $table_row[] = formatUptime($pw_uptime); $table_rows[] = $table_row; unset($table_row); } } } echo PHP_EOL; $headers = array('%WpwID%n', '%WMIB%n', '%WType%n', '%WPsnType%n', '%WPeer%n', '%WOperStatus%n', '%WUptime%n'); print_cli_table($table_rows, $headers); if ($pseudowires_db_count != $pseudowires_snmp_count) { // Force rediscover Pseudowires print_debug("Pseudowires total count for this device changed (DB: {$pseudowires_db_count}, SNMP: {$pseudowires_snmp_count}), force rediscover Pseudowires."); force_discovery($device, 'pseudowires'); } unset($pseudowires_db, $cache_pseudowires, $pseudowire_polled_time, $pw, $pw_poll, $pw_values, $pw_uptime, $oids, $metrics, $table_rows); // EOF
echo '.'; break; case '1.3.6.1.4.1.2254.2.4.10.1.0': rename_rrd($device, 'sensor-temperature-DeltaUPS-10.1.0.rrd', 'sensor-temperature-DeltaUPS-MIB-dupsEnvTemperature-0.rrd'); echo '.'; break; case '1.3.6.1.4.1.2254.2.4.7.9.0': rename_rrd($device, 'sensor-temperature-DeltaUPS-7.9.0.rrd', 'sensor-temperature-DeltaUPS-MIB-dupsTemperature-0.rrd'); echo '.'; break; case '1.3.6.1.4.1.2254.2.4.7.6.0': rename_rrd($device, 'sensor-voltage-DeltaUPS-7.6.0.rrd', 'sensor-voltage-DeltaUPS-MIB-dupsBatteryVoltage-0.rrd'); echo '.'; break; case '1.3.6.1.4.1.2254.2.4.5.4.0': rename_rrd($device, 'sensor-voltage-DeltaUPS-5.4.0.rrd', 'sensor-voltage-DeltaUPS-MIB-dupsOutputVoltage1-0.rrd'); echo '.'; break; case '1.3.6.1.4.1.2254.2.4.4.3.0': rename_rrd($device, 'sensor-voltage-DeltaUPS-4.3.0.rrd', 'sensor-voltage-DeltaUPS-MIB-dupsInputVoltage1-0.rrd'); echo '.'; break; case '1.3.6.1.4.1.2254.2.4.6.3.0': rename_rrd($device, 'sensor-voltage-DeltaUPS-6.3.0.rrd', 'sensor-voltage-DeltaUPS-MIB-dupsBypassVoltage1-0.rrd'); echo '.'; break; } force_discovery($device, array('sensors')); } } // EOF