initial commit; version 22.5.12042

This commit is contained in:
2022-12-12 23:28:25 -05:00
commit af1b03d79f
17653 changed files with 22692970 additions and 0 deletions

View File

@ -0,0 +1,107 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, "rttMonCtrl", [], 'CISCO-RTTMON-MIB', NULL, OBS_SNMP_ALL_HEX);
// Add extended source/target info
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminTargetAddrType.44 = INTEGER: ipv4(1)
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminTargetAddrType.66 = INTEGER: ipv6(2)
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminTargetAddress.44 = Hex-STRING: 55 72 03 FC
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminTargetAddress.66 = Hex-STRING: 2A 02 04 08 77 22 00 41 00 00 00 00 00 00 01 50
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminSourceAddrType.44 = INTEGER: ipv4(1)
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminSourceAddrType.66 = INTEGER: ipv6(2)
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminSourceAddress.44 = Hex-STRING: D9 4F 06 9C
//CISCO-RTTMON-IP-EXT-MIB::crttMonIPEchoAdminSourceAddress.66 = ""
//$oids = snmpwalk_cache_oid($device, "crttMonIPEchoAdminTargetAddrType", $oids, 'CISCO-RTTMON-IP-EXT-MIB');
$oids = snmpwalk_cache_oid($device, "crttMonIPEchoAdminTargetAddress", $oids, 'CISCO-RTTMON-IP-EXT-MIB', NULL, OBS_SNMP_ALL_HEX);
//$oids = snmpwalk_cache_oid($device, "crttMonIPEchoAdminSourceAddrType", $oids, 'CISCO-RTTMON-IP-EXT-MIB');
//$oids = snmpwalk_cache_oid($device, "crttMonIPEchoAdminSourceAddress", $oids, 'CISCO-RTTMON-IP-EXT-MIB');
foreach ($oids as $sla_index => $entry) {
if (!isset($entry['rttMonCtrlAdminStatus']) || // Skip additional multiindex entries from table
$entry['rttMonCtrlOperState'] === 'inactive') { // Skip inactive entries
continue;
}
// FIXME. Temporary hack, while this type of Jitter unsupported by Cisco
switch ($entry['rttMonCtrlAdminRttType']) {
case '34':
// See: https://jira.observium.org/browse/OBS-3053
// https://community.cisco.com/t5/routing/ip-sla-path-jitter-snmp-mib/td-p/2890302
// https://community.cisco.com/t5/switching/ipsla-path-jitter-monitoring/td-p/2131136
// CISCO-RTTMON-MIB::rttMonCtrlAdminRttType.200 = INTEGER: 34
$entry['rttMonCtrlAdminRttType'] = 'pathjitter';
break;
}
$data = array(
'device_id' => $device['device_id'],
'sla_mib' => 'CISCO-RTTMON-MIB',
'sla_index' => $sla_index,
'sla_owner' => trim(snmp_hexstring($entry['rttMonCtrlAdminOwner'])),
'sla_tag' => trim(snmp_hexstring($entry['rttMonCtrlAdminTag'])),
'rtt_type' => $entry['rttMonCtrlAdminRttType'], // Possible: echo, pathEcho, fileIO, script, udpEcho, tcpConnect, http, dns, jitter, dlsw, dhcp,
// ftp, voip, rtp, lspGroup, icmpjitter, lspPing, lspTrace, ethernetPing, ethernetJitter,
// lspPingPseudowire, video, y1731Delay, y1731Loss, mcastJitter,
// (currently unsupported by vendor MIBs): pathjitter
'sla_status' => $entry['rttMonCtrlAdminStatus'], // Possible: active, notInService, notReady, createAndGo, createAndWait, destroy
'deleted' => 0,
);
// Use jitter or simple echo graph for SLA
if (stripos($data['rtt_type'], 'jitter') !== FALSE)
{
$data['sla_graph'] = 'jitter';
} else {
$data['sla_graph'] = 'echo';
}
// Target
switch ($data['rtt_type'])
{
case 'http':
case 'ftp':
$data['sla_target'] = trim(snmp_hexstring($entry['rttMonEchoAdminURL']));
break;
case 'dns':
$data['sla_target'] = trim(snmp_hexstring($entry['rttMonEchoAdminTargetAddressString']));
break;
case 'echo':
case 'jitter':
case 'icmpjitter':
default:
if (!empty($entry['crttMonIPEchoAdminTargetAddress']))
{
$data['sla_target'] = hex2ip($entry['crttMonIPEchoAdminTargetAddress']);
} else {
$data['sla_target'] = hex2ip($entry['rttMonEchoAdminTargetAddress']);
}
break;
}
// Some fallbacks for when the tag is empty
if (!$data['sla_tag'])
{
$data['sla_tag'] = $data['sla_target'];
}
// Limits
$data['sla_limit_high'] = ($entry['rttMonCtrlAdminTimeout'] > 0 ? $entry['rttMonCtrlAdminTimeout'] : 5000);
$data['sla_limit_high_warn'] = ($entry['rttMonCtrlAdminThreshold'] > 0 ? $entry['rttMonCtrlAdminThreshold'] : 1000);
if ($data['sla_limit_high_warn'] >= $data['sla_limit_high']) {
$data['sla_limit_high_warn'] = (int)($data['sla_limit_high'] / 5);
}
$sla_table['CISCO-RTTMON-MIB'][$sla_index] = $data; // Pull to array for main processing
}
// EOF

View File

@ -0,0 +1,104 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$mib = 'DISMAN-PING-MIB';
$flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
// Additional vendor specific mibs used only for translate vendor specific RTT Types
$vendor_mibs = ['JUNIPER-PING-MIB', 'HH3C-NQA-MIB', 'HUAWEI-DISMAN-PING-MIB', 'ZHONE-DISMAN-PING-MIB']; //, 'H3C-NQA-MIB'];
$mibs = $mib;
foreach ($vendor_mibs as $vendor_mib)
{
if (is_device_mib($device, $vendor_mib))
{
echo("$vendor_mib ");
$mibs .= ':' . $vendor_mib;
break;
}
}
$oids = snmpwalk_cache_twopart_oid($device, "pingCtlEntry", array(), $mibs, NULL, $flags);
//print_vars($oids);
if (!snmp_status())
{
return;
}
foreach ($oids as $sla_owner => $entry2)
{
foreach ($entry2 as $sla_name => $entry)
{
if (!isset($entry['pingCtlAdminStatus']) || // Skip additional multi-index entries from table
($sla_owner == 'imclinktopologypleaseignore')) // Skip this weird SLAs by HH3C-NQA-MIB
{
continue;
}
// Get full index
$sla_index = snmp_translate('pingCtlRowStatus."'.$sla_owner.'"."'.$sla_name.'"', $mib);
$sla_index = str_replace('.1.3.6.1.2.1.80.1.2.1.23.', '', $sla_index);
$data = array(
'device_id' => $device['device_id'],
'sla_mib' => $mib,
'sla_index' => $sla_name, // FIXME. Here must be $sla_index, but migrate too hard
'sla_owner' => $sla_owner,
'sla_target' => $entry['pingCtlTargetAddress'],
//'rtt_type' => $entry['pingCtlType'],
'sla_status' => $entry['pingCtlRowStatus'], // Possible: active, notInService, notReady, createAndGo, createAndWait, destroy
'sla_graph' => 'jitter', // Seems as all of this types support jitter graphs
'deleted' => 0,
);
if ($entry['pingCtlAdminStatus'] == 'disabled')
{
// If SLA administratively disabled, exclude from polling
$data['deleted'] = 1;
}
// Type conversions
// Standard types: pingIcmpEcho, pingUdpEcho, pingSnmpQuery, pingTcpConnectionAttempt
// Juniper types: jnxPingIcmpTimeStamp, jnxPingHttpGet, jnxPingHttpGetMetadata, jnxPingDnsQuery, jnxPingNtpQuery, jnxPingUdpTimestamp
// Huawei types: hwpingUdpEcho, hwpingTcpconnect, hwpingjitter, hwpingHttp, hwpingdlsw, hwpingdhcp, hwpingftp
// HH3C types:
$data['rtt_type'] = str_replace(['jnxPing', 'hh3cNqa', 'hwping', 'ping'], '', $entry['pingCtlType']);
// Tag / Target
if (isHexString($entry['pingCtlTargetAddress']) ||
stripos($data['rtt_type'], 'Echo') !== FALSE)
{
$data['sla_target'] = hex2ip($data['sla_target']);
}
$data['sla_tag'] = $data['sla_target']; // FIXME. Here must be $sla_name, but migrate too hard
// Limits
$data['sla_limit_high'] = ($entry['pingCtlTimeOut'] > 0 ? $entry['pingCtlTimeOut'] * 1000 : 5000);
$data['sla_limit_high_warn'] = intval($data['sla_limit_high'] / 5);
/*
// Migrate old indexes
if (isset($sla_db[$mib_lower][$sla_owner.'.'.$name]))
{
// Old (non numeric) indexes
$sla_db[$mib_lower][$sla_index] = $sla_db[$mib_lower][$sla_owner.'.'.$name];
unset($sla_db[$mib_lower][$sla_owner.'.'.$name]);
dbUpdate(array('sla_index' => $sla_index, 'sla_mib' => $mib), 'slas', "`sla_id` = ?", array($sla_db[$mib_lower][$sla_index]['sla_id']));
}
*/
// Note, here used complex index (owner.index)
$sla_table[$mib][$sla_owner.'.'.$sla_name] = $data; // Pull to array for main processing
}
}
// EOF

View File

@ -0,0 +1,115 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// HPICF-IPSLA-MIB::hpicfIpSlaType.1 = INTEGER: dhcp(6)
// HPICF-IPSLA-MIB::hpicfIpSlaType.2 = INTEGER: dns(7)
// HPICF-IPSLA-MIB::hpicfIpSlaAdminState.1 = INTEGER: enable(1)
// HPICF-IPSLA-MIB::hpicfIpSlaAdminState.2 = INTEGER: enable(1)
// HPICF-IPSLA-MIB::hpicfIpSlaSourceAddressType.1 = INTEGER: unknown(0)
// HPICF-IPSLA-MIB::hpicfIpSlaSourceAddressType.2 = INTEGER: ipv4(1)
// HPICF-IPSLA-MIB::hpicfIpSlaSourceAddress.1 = ""
// HPICF-IPSLA-MIB::hpicfIpSlaSourceAddress.2 = Hex-STRING: AC 11 CC 0A
// HPICF-IPSLA-MIB::hpicfIpSlaDestAddressType.1 = INTEGER: unknown(0)
// HPICF-IPSLA-MIB::hpicfIpSlaDestAddressType.2 = INTEGER: dns(16)
// HPICF-IPSLA-MIB::hpicfIpSlaDestAddress.1 = ""
// HPICF-IPSLA-MIB::hpicfIpSlaDestAddress.2 = Hex-STRING: 67 6F 6F 67 6C 65 2E 73 65 00 6E 61 6D 65 2D 73
// 65 72 76 65 72 00 31 37 32 2E 31 37 2E 32 30 34
// 2E 31 30 00 00 3F 00 00 00 D8 B5 65 1F 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// HPICF-IPSLA-MIB::hpicfIpSlaRowStatus.1 = INTEGER: active(1)
// HPICF-IPSLA-MIB::hpicfIpSlaRowStatus.2 = INTEGER: active(1)
$oids = snmpwalk_cache_oid($device, "hpicfIpSlaTable", array(), 'HPICF-IPSLA-MIB', NULL, OBS_SNMP_ALL_MULTILINE);
// Add extended source/target info
// HPICF-IPSLA-MIB::hpicfIpSlaMsgResTimeout.1 = Gauge32: 0
// HPICF-IPSLA-MIB::hpicfIpSlaMsgResTimeout.2 = Gauge32: 736
$oids = snmpwalk_cache_oid($device, "hpicfIpSlaMsgResTimeout", $oids, 'HPICF-IPSLA-MIB');
print_debug_vars($oids);
foreach ($oids as $sla_index => $entry)
{
$data = array(
'device_id' => $device['device_id'],
'sla_mib' => 'HPICF-IPSLA-MIB',
'sla_index' => $sla_index,
//'sla_owner' => $entry['rttMonCtrlAdminOwner'],
//'sla_tag' => $entry['rttMonCtrlAdminTag'],
'rtt_type' => $entry['hpicfIpSlaType'], // Possible: icmpEcho(1), udpEcho(2), udpJitter(3), udpJitterVoIP(4),
// tcpConnect(5), dhcp(6), dns(7)
'sla_status' => $entry['hpicfIpSlaRowStatus'], // Possible: active, notInService, notReady, createAndGo, createAndWait, destroy
'deleted' => 0,
);
// Use jitter or simple echo graph for SLA
if (str_icontains_array($data['rtt_type'], 'jitter'))
{
$data['sla_graph'] = 'jitter';
} else {
$data['sla_graph'] = 'echo';
}
// Target
switch ($entry['hpicfIpSlaDestAddressType'])
{
case 'ipv4':
case 'ipv6':
$data['sla_target'] = hex2ip($entry['hpicfIpSlaDestAddress']);
break;
case 'ipv4z':
case 'ipv6z':
// Not tested
$data['sla_target'] = hex2ip($entry['hpicfIpSlaDestAddress']);
break;
case 'dns':
list($data['sla_tag'], , $data['sla_target']) = explode("\n", snmp_hexstring($entry['hpicfIpSlaDestAddress']));
break;
default:
if ($entry['hpicfIpSlaType'] == 'dhcp')
{
$data['sla_target'] = 'Interface ' . $entry['hpicfIpSlaSourceInterface'];
} else {
$data['sla_target'] = snmp_hexstring($entry['hpicfIpSlaDestAddress']);
}
break;
}
// Some fallbacks for when the tag is empty
if (!$data['sla_tag'])
{
$data['sla_tag'] = $data['sla_target'];
}
// Limits
$data['sla_limit_high'] = ($entry['hpicfIpSlaMsgResTimeout'] > 0 ? $entry['hpicfIpSlaMsgResTimeout'] : 5000);
$data['sla_limit_high_warn'] = intval($data['sla_limit_high'] / 5);
$sla_table['HPICF-IPSLA-MIB'][$sla_index] = $data; // Pull to array for main processing
}
// EOF