mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix misc Cisco polling errors (#16307)
* Fix misc Cisco polling errors * Apply fixes from StyleCI --------- Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
$components = $component->getComponents($device['device_id'], $options);
|
$components = $component->getComponents($device['device_id'], $options);
|
||||||
|
|
||||||
// We only care about our device id.
|
// We only care about our device id.
|
||||||
$components = $components[$device['device_id']];
|
$components = $components[$device['device_id']] ?? null;
|
||||||
|
|
||||||
// Only collect SNMP data if we have enabled components
|
// Only collect SNMP data if we have enabled components
|
||||||
if (is_array($components) && count($components) > 0) {
|
if (is_array($components) && count($components) > 0) {
|
||||||
|
@@ -15,7 +15,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
d_echo($cefs);
|
d_echo($cefs);
|
||||||
|
|
||||||
if (is_array($cefs)) {
|
if (is_array($cefs)) {
|
||||||
if (! is_array($entity_array)) {
|
if (! isset($entity_array) || ! is_array($entity_array)) {
|
||||||
echo 'Caching OIDs: ';
|
echo 'Caching OIDs: ';
|
||||||
$entity_array = [];
|
$entity_array = [];
|
||||||
echo ' entPhysicalDescr';
|
echo ' entPhysicalDescr';
|
||||||
@@ -93,11 +93,13 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
}//end if
|
}//end if
|
||||||
|
|
||||||
// FIXME - need to delete old ones. FIXME REALLY.
|
// FIXME - need to delete old ones. FIXME REALLY.
|
||||||
print_r($cefs_db);
|
if (! empty($cefs_db)) {
|
||||||
|
print_r($cefs_db);
|
||||||
|
|
||||||
foreach ((array) $cefs_db as $cef_switching_id) {
|
foreach ((array) $cefs_db as $cef_switching_id) {
|
||||||
dbDelete('cef_switching', '`cef_switching_id` = ?', [$cef_switching_id]);
|
dbDelete('cef_switching', '`cef_switching_id` = ?', [$cef_switching_id]);
|
||||||
echo '-';
|
echo '-';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
@@ -66,7 +66,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
$components = $component->getComponents($device['device_id'], $options);
|
$components = $component->getComponents($device['device_id'], $options);
|
||||||
|
|
||||||
// We only care about our device id.
|
// We only care about our device id.
|
||||||
$components = $components[$device['device_id']];
|
$components = $components[$device['device_id']] ?? null;
|
||||||
|
|
||||||
// Only collect SNMP data if we have enabled components
|
// Only collect SNMP data if we have enabled components
|
||||||
if (is_array($components) && count($components) > 0) {
|
if (is_array($components) && count($components) > 0) {
|
||||||
|
@@ -35,6 +35,11 @@ use LibreNMS\RRD\RrdDefinition;
|
|||||||
if ($device['os_group'] == 'cisco') {
|
if ($device['os_group'] == 'cisco') {
|
||||||
$oid_list = ['crasEmailNumSessions.0', 'crasIPSecNumSessions.0', 'crasL2LNumSessions.0', 'crasLBNumSessions.0', 'crasSVCNumSessions.0', 'crasWebvpnNumSessions.0'];
|
$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 = snmp_get_multi($device, $oid_list, '-OUQs', 'CISCO-REMOTE-ACCESS-MONITOR-MIB');
|
||||||
|
|
||||||
|
if (empty($data[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$data = $data[0];
|
$data = $data[0];
|
||||||
|
|
||||||
// Some ASAs return 'No Such Object available on this agent at this OID'
|
// Some ASAs return 'No Such Object available on this agent at this OID'
|
||||||
|
@@ -16,7 +16,7 @@ use LibreNMS\RRD\RrdDefinition;
|
|||||||
if ($device['os_group'] == 'cisco') {
|
if ($device['os_group'] == 'cisco') {
|
||||||
// Total
|
// Total
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$output = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.2.1.1.6', null);
|
$output = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.2.1.1.6');
|
||||||
if (is_array($output)) {
|
if (is_array($output)) {
|
||||||
foreach ($output as $key => $value) {
|
foreach ($output as $key => $value) {
|
||||||
$total += $value[''];
|
$total += $value[''];
|
||||||
@@ -25,7 +25,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
if (isset($total) && $total > 0) {
|
if (isset($total) && $total > 0) {
|
||||||
// Active
|
// Active
|
||||||
$active = 0;
|
$active = 0;
|
||||||
foreach (snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.2.1.1.7', null) as $key => $value) {
|
foreach (snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.2.1.1.7') as $key => $value) {
|
||||||
$active += $value[''];
|
$active += $value[''];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,13 +15,11 @@ use LibreNMS\RRD\RrdDefinition;
|
|||||||
|
|
||||||
if ($device['os_group'] == 'cisco') {
|
if ($device['os_group'] == 'cisco') {
|
||||||
// Total
|
// Total
|
||||||
$total = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.6.4.1.3', null);
|
$total = SnmpQuery::get('1.3.6.1.4.1.9.9.86.1.6.4.1.3')->value();
|
||||||
$total = $total['1.3.6.1.4.1.9.9.86.1.6.4.1.3'][''];
|
|
||||||
|
|
||||||
if (isset($total) && $total > 0) {
|
if (isset($total) && $total > 0) {
|
||||||
// Available
|
// Available
|
||||||
$available = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.6.4.1.4', null);
|
$available = SnmpQuery::get('1.3.6.1.4.1.9.9.86.1.6.4.1.4')->value();
|
||||||
$available = $available['1.3.6.1.4.1.9.9.86.1.6.4.1.4'][''];
|
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
$active = $total - $available;
|
$active = $total - $available;
|
||||||
|
@@ -15,13 +15,11 @@ use LibreNMS\RRD\RrdDefinition;
|
|||||||
|
|
||||||
if ($device['os_group'] == 'cisco') {
|
if ($device['os_group'] == 'cisco') {
|
||||||
// Total
|
// Total
|
||||||
$total = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.7.1.0', null);
|
$total = SnmpQuery::get('1.3.6.1.4.1.9.9.86.1.7.1.0')->value();
|
||||||
$total = $total['1.3.6.1.4.1.9.9.86.1.7.1.0'][''];
|
|
||||||
|
|
||||||
if (isset($total) && $total > 0) {
|
if (is_numeric($total) && $total > 0) {
|
||||||
// Available
|
// Available
|
||||||
$available = snmpwalk_cache_oid_num($device, '1.3.6.1.4.1.9.9.86.1.7.2.0', null);
|
$available = SnmpQuery::get('1.3.6.1.4.1.9.9.86.1.7.2.0')->value();
|
||||||
$available = $available['1.3.6.1.4.1.9.9.86.1.7.2.0'][''];
|
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
$active = $total - $available;
|
$active = $total - $available;
|
||||||
|
@@ -16,7 +16,7 @@ use LibreNMS\RRD\RrdDefinition;
|
|||||||
if ($device['os_group'] == 'cisco') {
|
if ($device['os_group'] == 'cisco') {
|
||||||
$output = snmpwalk_cache_oid($device, 'cvCallVolConnActiveConnection', [], 'CISCO-VOICE-DIAL-CONTROL-MIB');
|
$output = snmpwalk_cache_oid($device, 'cvCallVolConnActiveConnection', [], 'CISCO-VOICE-DIAL-CONTROL-MIB');
|
||||||
d_echo($output);
|
d_echo($output);
|
||||||
if (is_array($output)) {
|
if (is_array($output) && ! empty($output)) {
|
||||||
$rrd_def = RrdDefinition::make()
|
$rrd_def = RrdDefinition::make()
|
||||||
->addDataset('h323', 'GAUGE', 0)
|
->addDataset('h323', 'GAUGE', 0)
|
||||||
->addDataset('sip', 'GAUGE', 0)
|
->addDataset('sip', 'GAUGE', 0)
|
||||||
|
Reference in New Issue
Block a user