rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.15.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-ssh2-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.20.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.20.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-coolSetP-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.21.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.21.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-coolDiff-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.22.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.22.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-cool2SetP-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.23.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.23.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-heatSetP-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.24.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.24.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-heat2SetP-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.9839.2.1.2.25.0': rename_rrd($device, "sensor-temperature-pcoweb-2.1.2.25.0.rrd", "sensor-temperature-CAREL-ug40cdz-MIB-heatDiff-0.rrd"); echo '.'; break; } } } // EOF
$count = count($oids); foreach ($oids as $index => $entry) { $printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", array($device['device_id'], 'jetdirect', $index)); $marker_descr = "Printed " . nicecase($entry['prtMarkerCounterUnit']); list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index); $options = array('measured_class' => 'printersupply', 'measured_entity' => $printer_supply['supply_id'], 'sensor_unit' => $entry['prtMarkerCounterUnit']); // Lifetime counter (should be always single) $descr = "Total {$marker_descr}"; $oid_name = 'prtMarkerLifeCount'; $oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index; $value = $entry[$oid_name]; if (isset($entry[$oid_name])) { // CLEANME. Compatibility, remove in r8500, but not before CE 0.16.8 // Rename olf rrd filename and old ds name $new_rrd = 'sensor-counter-Printer-MIB-prtMarkerLifeCount-' . $index; $renamed = rename_rrd($device, 'pagecount', $new_rrd); if ($renamed) { rrdtool_rename_ds($device, $new_rrd, 'pagecount', 'sensor'); } discover_sensor($valid['sensor'], 'counter', $device, $oid, $index, $mib . '-' . $oid_name, $descr, 1, $value, $options); } // PowerOn counter $descr = "PowerOn {$marker_descr}"; if ($prt_supplies[$index]['prtMarkerSuppliesDescription']) { $descr .= ' - ' . snmp_hexstring($prt_supplies[$index]['prtMarkerSuppliesDescription']); } $oid_name = 'prtMarkerPowerOnCount'; $oid = '.1.3.6.1.2.1.43.10.2.1.5.' . $index; $value = $entry[$oid_name]; discover_sensor($valid['sensor'], 'counter', $device, $oid, $index, $mib . '-' . $oid_name, $descr, 1, $value, $options); // prtMarkerStatus
["dfCompressSavedPercent"]=> "0" ["df64DedupeSaved"]=> "0" ["dfDedupeSavedPercent"]=> "0" ["df64TotalSaved"]=> "0" ["dfTotalSavedPercent"]=> "0" ["df64TotalReservedKBytes"]=> "263724" } */ foreach ($cache_discovery['netapp-mib'] as $index => $storage) { $fstype = $storage['dfType']; $descr = $storage['dfFileSys']; if (!empty($storage['dfVserver'])) { // Add server info on cluster devices $descr .= ' - ' . $storage['dfVserver']; // CLEANME, remove in r7500, but not before CE 0.16.1 rename_rrd($device, 'storage-netapp-mib-' . $storage['dfFileSys'] . '.rrd', 'storage-netapp-mib-' . $descr . '.rrd'); } $deny = FALSE; if (!$deny) { if (is_numeric($storage['df64TotalKBytes'])) { $size = $storage['df64TotalKBytes'] * 1024; $used = $storage['df64UsedKBytes'] * 1024; $hc = 1; } else { $size = $storage['dfKBytesTotal'] * 1024; $used = $storage['dfKBytesUsed'] * 1024; $hc = 0; } if (is_numeric($index)) { discover_storage($valid['storage'], $device, $index, $fstype, 'NETAPP-MIB', $descr, 1024, $size, $used, array('storage_hc' => $hc)); }
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage update * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $devices = dbFetchRows("SELECT * FROM `devices` WHERE os='routeros'"); foreach ($devices as $device) { $sensors = dbFetchRows("SELECT * FROM `sensors` WHERE device_id=?", array($device['device_id'])); foreach ($sensors as $sensor) { switch ($sensor['sensor_oid']) { case '1.3.6.1.4.1.14988.1.1.3.10.0': rename_rrd($device, "sensor-temperature-routeros-0.rrd", "sensor-temperature-MIKROTIK-MIB-mtxrHlTemperature-0.rrd"); echo '.'; break; case '1.3.6.1.4.1.14988.1.1.3.8.0': rename_rrd($device, "sensor-voltage-routeros-0.rrd", "sensor-voltage-MIKROTIK-MIB-mtxrHlVoltage-0.rrd"); echo '.'; break; } } } // EOF
$precision = 1; if (isset($entry['scale']) && is_numeric($entry['scale']) && $entry['scale'] != 1) { // FIXME, currently we support only int precision, need convert all to float scale! $precision = round(1 / $entry['scale'], 0); } $usage = snmp_get($device, $entry['oid'], '-OQUvs', $mib); $usage = snmp_fix_numeric($usage); if (is_numeric($usage)) { if (empty($entry['oid_num'])) { // Use snmptranslate if oid_num not set $entry['oid_num'] = snmp_translate($entry['oid'], $mib); } if (isset($entry['rename_rrd'])) { $old_rrd = 'processor-' . $entry['rename_rrd']; $new_rrd = 'processor-' . $entry_name . '-' . $index; rename_rrd($device, $old_rrd, $new_rrd); unset($old_rrd, $new_rrd); } discover_processor($valid['processor'], $device, $entry['oid_num'], $index, $entry_name, $descr, $precision, $usage, NULL, NULL, $idle); $entry['found'] = TRUE; } } unset($processors_array, $processor, $dot_index, $descr, $i); // Clean up if (isset($entry['stop_if_found']) && $entry['stop_if_found'] && $entry['found']) { break; } // Stop loop if processor found } } }
* * @package observium * @subpackage update * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $devices = dbFetchRows("SELECT * FROM `devices` WHERE os='papouch'"); foreach ($devices as $device) { $sensors = dbFetchRows("SELECT * FROM `sensors` WHERE device_id=?", array($device['device_id'])); foreach ($sensors as $sensor) { switch ($sensor['sensor_oid']) { case '.1.3.6.1.4.1.18248.1.1.1.0': rename_rrd($device, "sensor-temperature-papouch-tme-1.rrd", "sensor-temperature-TMESNMP2-MIB-int_temperature-0.rrd"); echo '.'; break; case '.1.3.6.1.4.1.18248.20.1.2.1.1.2.1': rename_rrd($device, "sensor-temperature-papouch-th2e-1.rrd", "sensor-temperature-the_v01-MIB-inChValue-1.rrd"); echo '.'; break; case '.1.3.6.1.4.1.18248.20.1.2.1.1.2.2': rename_rrd($device, "sensor-humidity-papouch-th2e-1.rrd", "sensor-humidity-the_v01-MIB-inChValue-2.rrd"); echo '.'; break; case '.1.3.6.1.4.1.18248.20.1.2.1.1.2.3': rename_rrd($device, "sensor-temperature-papouch-th2e-3.rrd", "sensor-temperature-the_v01-MIB-inChValue-3.rrd"); echo '.'; break; } } } // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $value = snmp_get($device, 'jnxYellowAlarmState.0', '-Oqv', 'JUNIPER-ALARM-MIB'); if ($value !== '') { $descr = 'Yellow Alarm'; $oid = '.1.3.6.1.4.1.2636.3.4.2.2.1.0'; rename_rrd($device, 'status-juniper-alarm-state-jnxYellowAlarmState.0', 'status-juniper-yellow-state-jnxYellowAlarmState.0'); discover_sensor($valid['sensor'], 'state', $device, $oid, 'jnxYellowAlarmState.0', 'juniper-yellow-state', $descr, NULL, $value, array('entPhysicalClass' => 'other')); } $value = snmp_get($device, 'jnxRedAlarmState.0', '-Oqv', 'JUNIPER-ALARM-MIB'); if ($value !== '') { $descr = 'Red Alarm'; $oid = '.1.3.6.1.4.1.2636.3.4.2.3.1.0'; discover_sensor($valid['sensor'], 'state', $device, $oid, 'jnxRedAlarmState.0', 'juniper-alarm-state', $descr, NULL, $value, array('entPhysicalClass' => 'other')); } // 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
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // CPU Memory // // agentSwitchCpuProcessMemFree.0 = INTEGER: 343320 // agentSwitchCpuProcessMemAvailable.0 = INTEGER: 1034740 $free = snmp_get($device, 'agentSwitchCpuProcessMemFree.0', '-OUvq', $mib); $total = snmp_get($device, 'agentSwitchCpuProcessMemAvailable.0', '-OUvq', $mib); $used = $total - $free; if (is_numeric($free)) { rename_rrd($device, 'mempool-dell-vendor-mib-0', 'mempool-dnos-switching-mib-0.rrd'); discover_mempool($valid['mempool'], $device, 0, $mib, 'System Memory', 1024, $total, $used); } unset($total, $used, $free); // EOF
rrdtool_rename_ds($device, $supply_rrd, 'drum', 'level'); } } else { if (stristr($supply['supply_descr'], 'transfer') !== FALSE) { $old_rrd = 'transferroller.rrd'; rename_rrd($device, $old_rrd, $supply_rrd); } } break; case 'wastetoner': $old_rrd = 'wastebox.rrd'; rename_rrd($device, $old_rrd, $supply_rrd); break; case 'fuser': $old_rrd = 'fuser.rrd'; rename_rrd($device, $old_rrd, $supply_rrd); break; } // END CLEANME echo $supplyperc . " %\n"; rrdtool_update_ng($device, 'toner', array('level' => $supplyperc), $supply['supply_index']); if ($supplyperc > $supply['supply_value']) { log_event('Printer supply ' . $supply['supply_descr'] . ' (type ' . nicecase($supply['supply_type']) . ') was replaced (new level: ' . $supplyperc . '%)', $device, 'toner', $supply['supply_id']); } dbUpdate(array('supply_value' => $supplyperc, 'supply_capacity' => $supply['supply_capacity']), 'printersupplies', '`supply_id` = ?', array($supply['supply_id'])); check_entity('printersupply', $supply, array('supply_value' => $supplyperc)); $graphs['printersupplies'] = TRUE; } // Old stuff, to replace? $oid = get_dev_attrib($device, 'pagecount_oid'); if ($oid) {
if (isset($ups_array[$phase]['upsOutputCurrent'])) { $oid = ".1.3.6.1.2.1.33.1.4.4.1.3.{$index}"; # UPS-MIB:upsOutputCurrent.$index discover_sensor($valid['sensor'], 'current', $device, $oid, "upsOutputEntry." . $index, 'ups-mib', $descr, $scale_current, $ups_array[$phase]['upsOutputCurrent']); } ## Output power if (isset($ups_array[$phase]['upsOutputPower'])) { $oid = ".1.3.6.1.2.1.33.1.4.4.1.4.{$index}"; # UPS-MIB:upsOutputPower.$index //discover_sensor($valid['sensor'], 'apower', $device, $oid, "upsOutputEntry.".$index, 'ups-mib', $descr, 1, $ups_array[$phase]['upsOutputPower']); discover_sensor($valid['sensor'], 'power', $device, $oid, "upsOutputEntry." . $index, 'ups-mib', $descr, 1, $ups_array[$phase]['upsOutputPower']); } if (isset($ups_array[$phase]['upsOutputPercentLoad'])) { $oid = ".1.3.6.1.2.1.33.1.4.4.1.5.{$index}"; # UPS-MIB:upsOutputPercentLoad.$index rename_rrd($device, "sensor-capacity-ups-mib-upsOutputPercentLoad.{$index}", "sensor-load-ups-mib-upsOutputPercentLoad.{$index}"); discover_sensor($valid['sensor'], 'load', $device, $oid, "upsOutputPercentLoad.{$index}", 'ups-mib', $descr, 1, $ups_array[$phase]['upsOutputPercentLoad']); } # Bypass if ($ups_array[0]['upsBypassNumLines'] > 0) { $descr = "Bypass"; if ($ups_array[0]['upsBypassNumLines'] > 1) { $descr .= " Phase {$index}"; } ## Bypass voltage if (isset($ups_array[$phase]['upsBypassVoltage'])) { $oid = ".1.3.6.1.2.1.33.1.5.3.1.2.{$index}"; # UPS-MIB:upsBypassVoltage.$index discover_sensor($valid['sensor'], 'voltage', $device, $oid, "upsBypassEntry." . $index, 'ups-mib', $descr, 1, $ups_array[$phase]['upsBypassVoltage']); } ## Bypass current
$tunnel['cipSecTunInOctets'] = $tunnel['cipSecTunHcInOctets']; $tunnel['cipSecTunInDecompOctets'] = $tunnel['cipSecTunHcInDecompOctets']; $tunnel['cipSecTunOutOctets'] = $tunnel['cipSecTunHcOutOctets']; $tunnel['cipSecTunOutUncompOctets'] = $tunnel['cipSecTunHcOutUncompOctets']; } else { $table_row[] = "%rno%n"; } if ($ike_exist) { //$rrd_index = $local_address . '-' . $peer_address . '-' . $tunnel_endpt_hash; $rrd_index = $db_index . '-' . $tunnel_endpt_hash; // FIXME, remove later //rename_rrd($device, 'ipsectunnel-'.$tunnel['cikeTunLocalName'], 'ipsectunnel-'.$rrd_index); rename_rrd($device, 'ipsectunnel-' . $peer_address, 'ipsectunnel-' . $rrd_index); if ($rrd_change_hash) { // rename if tunnel endpoints changed rename_rrd($device, 'ipsectunnel-' . $rrd_index, 'ipsectunnel-' . $db_index . '-' . $rrd_change_hash); $rrd_index = $db_index . '-' . $rrd_change_hash; } rrdtool_update_ng($device, 'cipsec-tunnels', array('TunInOctets' => $tunnel['cipSecTunInOctets'], 'TunInDecompOctets' => $tunnel['cipSecTunInDecompOctets'], 'TunInPkts' => $tunnel['cipSecTunInPkts'], 'TunInDropPkts' => $tunnel['cipSecTunInDropPkts'], 'TunInReplayDropPkts' => $tunnel['cipSecTunInReplayDropPkts'], 'TunInAuths' => $tunnel['cipSecTunInAuths'], 'TunInAuthFails' => $tunnel['cipSecTunInAuthFails'], 'TunInDecrypts' => $tunnel['cipSecTunInDecrypts'], 'TunInDecryptFails' => $tunnel['cipSecTunInDecryptFails'], 'TunOutOctets' => $tunnel['cipSecTunOutOctets'], 'TunOutUncompOctets' => $tunnel['cipSecTunOutUncompOctets'], 'TunOutPkts' => $tunnel['cipSecTunOutPkts'], 'TunOutDropPkts' => $tunnel['cipSecTunOutDropPkts'], 'TunOutAuths' => $tunnel['cipSecTunOutAuths'], 'TunOutAuthFails' => $tunnel['cipSecTunOutAuthFails'], 'TunOutEncrypts' => $tunnel['cipSecTunOutEncrypts'], 'TunOutEncryptFails' => $tunnel['cipSecTunOutEncryptFails']), $rrd_index); $graphs['ipsec_tunnels'] = TRUE; } $table_rows[] = $table_row; unset($table_row); unset($tunnels_db[$db_index][$tunnel_endpt_hash]); $valid['ipsec_tunnels'][$db_index][$db_insert['tunnel_endhash']] = 1; } print_cli_table($table_rows, $table_headers); unset($table_rows, $table_headers); foreach ($tunnels_db as $entry) { foreach ($entry as $tunnel) { //echo "will delete tunnel: ".$tunnel['local_addr']."/".$tunnel['peer_addr']." with id:".$tunnel['tunnel_id']."". PHP_EOL;
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
$descr = 'Over Load'; $oid_name = 'upsmgOutputOverLoad'; $oid_num = '.1.3.6.1.4.1.705.1.7.10.0'; $type = 'mge-status-state'; $value = $entry[$oid_name]; rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}"); discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, array('entPhysicalClass' => 'other')); } // MG-SNMP-UPS-MIB::upsmgOutputOverTemp.0 = INTEGER: no(2) if (isset($entry['upsmgOutputOverTemp'])) { $descr = 'Over Temperature'; $oid_name = 'upsmgOutputOverTemp'; $oid_num = '.1.3.6.1.4.1.705.1.7.11.0'; $type = 'mge-status-state'; $value = $entry[$oid_name]; rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}"); discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, array('entPhysicalClass' => 'other')); } // MG-SNMP-UPS-MIB::upsmgOutputOnBuck.0 = INTEGER: 2 $scale = 0.1; $cache['mge'] = array(); $cache['mge'] = snmpwalk_cache_multi_oid($device, "upsmgOutputPhaseTable", $cache['mge'], "MG-SNMP-UPS-MIB"); $upsmgOutputPhaseNum = snmp_get($device, "upsmgOutputPhaseNum.0", "-Oqv", "MG-SNMP-UPS-MIB"); foreach ($cache['mge'] as $index => $entry) { $descr = "Output"; if ($upsmgOutputPhaseNum > 1) { $descr .= " Phase {$index}"; } if ($index > $upsmgOutputPhaseNum) { break; }
print_cli_data_field($mib); foreach ($config['mibs'][$mib]['status'] as $oid => $oid_data) { print_cli($oid . ' ['); foreach ($oid_data['indexes'] as $index => $entry) { $entry['oid'] = $oid; if (empty($entry['oid_num'])) { // Use snmptranslate if oid_num not set $entry['oid_num'] = snmp_translate($oid . '.' . $index, $mib); } $value = snmp_get($device, $entry['oid_num'], '-OQUvsn'); if (is_numeric($value)) { // Fetch description from oid if specified if (isset($entry['oid_descr'])) { $entry['descr'] = snmp_get($device, $entry['oid_descr'], '-OQUvs'); } rename_rrd($device, "status-" . $entry['type'] . '-' . $index, "status-" . $entry['type'] . '-' . "{$oid}.{$index}"); discover_status($device, $entry['oid_num'], "{$oid}.{$index}", $entry['type'], $entry['descr'], $value, array('entPhysicalClass' => $entry['measured'])); } } print_cli('] '); } print_cli('] '); } } if (OBS_DEBUG > 1 && count($valid['sensor'])) { print_vars($valid['sensor']); } foreach (array_keys($config['sensor_types']) as $type) { check_valid_sensors($device, $type, $valid['sensor']); } if (OBS_DEBUG > 1 && count($valid['status'])) {
force_discovery($entry); echo '.'; break; case 'nos': rename_rrd($entry, 'processor-nos-0.rrd', 'processor-swCpuUsage-0.rrd'); force_discovery($entry); echo '.'; break; case 'timetra-system-mib': rename_rrd($entry, 'processor-timetra-system-mib-0.rrd', 'processor-sgiCpuUsage-0.rrd'); force_discovery($entry); echo '.'; break; case 'screenos': rename_rrd($entry, 'processor-screenos-0.rrd', 'processor-nsResCpuLast5Min-0.rrd'); force_discovery($entry); echo '.'; break; case 'juniperive': rename_rrd($entry, 'processor-juniperive-0.rrd', 'processor-iveCpuUtil-0.rrd'); force_discovery($entry); echo '.'; break; case 'gbnplatformoam-mib_cpuidle': rename_rrd($entry, 'processor-gbnplatformoam-mib_cpuidle-0.rrd', 'processor-cpuIdle-0.rrd'); force_discovery($entry); echo '.'; break; } } // EOF