Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device - Add Cisco REP Segment state sensor #15666

Merged
merged 4 commits into from Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 27 additions & 17 deletions includes/discovery/sensors/state/cisco.inc.php
Expand Up @@ -14,23 +14,24 @@
$redundant_data = snmp_get($device, 'cswRingRedundant.0', '-OQv', 'CISCO-STACKWISE-MIB');

$tables = [
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.1.1.6.', 'oid' => 'c3gModemStatus', 'state_name' => 'c3gModemStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Modem status'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.4.1.1.3.', 'oid' => 'c3gGsmCurrentBand', 'state_name' => 'c3gGsmCurrentBand', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Current band'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.2.1.5.', 'oid' => 'c3gGsmPacketService', 'state_name' => 'c3gGsmPacketService', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Packet service'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.2.1.6.', 'oid' => 'c3gGsmCurrentRoamingStatus', 'state_name' => 'c3gGsmCurrentRoamingStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Roaming status'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.5.1.1.2.', 'oid' => 'c3gGsmSimStatus', 'state_name' => 'c3gGsmSimStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'SIM status'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.2.1.7.', 'oid' => 'ciscoEnvMonVoltageStatusTable', 'state_name' => 'ciscoEnvMonVoltageState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonVoltageStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.3.1.6.', 'oid' => 'ciscoEnvMonTemperatureStatusTable', 'state_name' => 'ciscoEnvMonTemperatureState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonTemperatureStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.4.1.3.', 'oid' => 'ciscoEnvMonFanStatusTable', 'state_name' => 'ciscoEnvMonFanState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonFanStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.5.1.3.', 'oid' => 'ciscoEnvMonSupplyStatusTable', 'state_name' => 'ciscoEnvMonSupplyState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonSupplyStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.117.1.1.2.1.2.', 'oid' => 'cefcFRUPowerStatusTable', 'state_name' => 'cefcFRUPowerOperStatus', 'mib' => 'CISCO-ENTITY-FRU-CONTROL-MIB', 'descr' => 'Sensor Name'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.1.2.', 'oid' => 'cRFStatusUnitState', 'state_name' => 'cRFStatusUnitState', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Device State'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.1.4.', 'oid' => 'cRFStatusPeerUnitState', 'state_name' => 'cRFStatusPeerUnitState', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Peer State'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.2.14.', 'oid' => 'cRFCfgRedundancyOperMode', 'state_name' => 'cRFCfgRedundancyOperMode', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Mode'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.1.3.', 'oid' => 'cswGlobals', 'state_name' => 'cswRingRedundant', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Ring - Redundant'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.1.1.3.', 'oid' => 'cswSwitchRole', 'state_name' => 'cswSwitchRole', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Role - Switch#'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.1.1.6.', 'oid' => 'cswSwitchState', 'state_name' => 'cswSwitchState', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack State - Switch#'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.2.1.1.', 'oid' => 'cswStackPortOperStatus', 'state_name' => 'cswStackPortOperStatus', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Port Status - '],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.1.1.6.', 'oid' => 'c3gModemStatus', 'state_name' => 'c3gModemStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Modem status'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.4.1.1.3.', 'oid' => 'c3gGsmCurrentBand', 'state_name' => 'c3gGsmCurrentBand', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Current band'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.2.1.5.', 'oid' => 'c3gGsmPacketService', 'state_name' => 'c3gGsmPacketService', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Packet service'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.2.1.6.', 'oid' => 'c3gGsmCurrentRoamingStatus', 'state_name' => 'c3gGsmCurrentRoamingStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'Roaming status'],
['num_oid' => '.1.3.6.1.4.1.9.9.661.1.3.5.1.1.2.', 'oid' => 'c3gGsmSimStatus', 'state_name' => 'c3gGsmSimStatus', 'mib' => 'CISCO-WAN-3G-MIB', 'descr' => 'SIM status'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.2.1.7.', 'oid' => 'ciscoEnvMonVoltageStatusTable', 'state_name' => 'ciscoEnvMonVoltageState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonVoltageStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.3.1.6.', 'oid' => 'ciscoEnvMonTemperatureStatusTable', 'state_name' => 'ciscoEnvMonTemperatureState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonTemperatureStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.4.1.3.', 'oid' => 'ciscoEnvMonFanStatusTable', 'state_name' => 'ciscoEnvMonFanState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonFanStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.13.1.5.1.3.', 'oid' => 'ciscoEnvMonSupplyStatusTable', 'state_name' => 'ciscoEnvMonSupplyState', 'mib' => 'CISCO-ENVMON-MIB', 'descr' => 'ciscoEnvMonSupplyStatusDescr'],
['num_oid' => '.1.3.6.1.4.1.9.9.117.1.1.2.1.2.', 'oid' => 'cefcFRUPowerStatusTable', 'state_name' => 'cefcFRUPowerOperStatus', 'mib' => 'CISCO-ENTITY-FRU-CONTROL-MIB', 'descr' => 'Sensor Name'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.1.2.', 'oid' => 'cRFStatusUnitState', 'state_name' => 'cRFStatusUnitState', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Device State'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.1.4.', 'oid' => 'cRFStatusPeerUnitState', 'state_name' => 'cRFStatusPeerUnitState', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Peer State'],
['num_oid' => '.1.3.6.1.4.1.9.9.176.1.2.14.', 'oid' => 'cRFCfgRedundancyOperMode', 'state_name' => 'cRFCfgRedundancyOperMode', 'mib' => 'CISCO-RF-MIB', 'descr' => 'VSS Mode'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.1.3.', 'oid' => 'cswGlobals', 'state_name' => 'cswRingRedundant', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Ring - Redundant'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.1.1.3.', 'oid' => 'cswSwitchRole', 'state_name' => 'cswSwitchRole', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Role - Switch#'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.1.1.6.', 'oid' => 'cswSwitchState', 'state_name' => 'cswSwitchState', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack State - Switch#'],
['num_oid' => '.1.3.6.1.4.1.9.9.500.1.2.2.1.1.', 'oid' => 'cswStackPortOperStatus', 'state_name' => 'cswStackPortOperStatus', 'mib' => 'CISCO-STACKWISE-MIB', 'descr' => 'Stack Port Status - '],
['num_oid' => '.1.3.6.1.4.1.9.9.601.1.3.1.1.4.', 'oid' => 'crepSegmentComplete', 'state_name' => 'crepSegmentComplete', 'mib' => 'CISCO-RESILIENT-ETHERNET-PROTOCOL-MIB', 'descr' => 'REP State - Segment '],
];

foreach ($tables as $tablevalue) {
Expand Down Expand Up @@ -179,6 +180,12 @@
['value' => 12, 'generic' => 2, 'graph' => 0, 'descr' => 'mepLocked'],
['value' => 13, 'generic' => 2, 'graph' => 0, 'descr' => 'networkRejected'],
];
} elseif ($state_name == 'crepSegmentComplete') {
$states = [
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'complete'],
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'incomplete'],
];
} else {
$states = [
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'normal'],
Expand Down Expand Up @@ -214,6 +221,9 @@
} elseif ($state_name == 'c3gModemStatus' || $state_name == 'c3gGsmCurrentBand' || $state_name == 'c3gGsmPacketService' || $state_name == 'c3gGsmCurrentRoamingStatus' || $state_name == 'c3gGsmSimStatus') {
$descr = $tablevalue['descr'];
$state_group = snmp_get($device, 'entPhysicalName.' . $index, '-Oqv', 'ENTITY-MIB');
} elseif ($state_name == 'crepSegmentComplete') {
$repsegmentnumber++;
$descr = $tablevalue['descr'] . $repsegmentnumber;
}
discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, $index, $state_name, trim($descr), 1, 1, null, null, null, null, $temp[$index][$tablevalue['state_name']], 'snmp', $index, null, null, $state_group);

Expand Down
36 changes: 18 additions & 18 deletions tests/data/ios_2960x.json
Expand Up @@ -14937,8 +14937,8 @@
"ifName": "StackPort1",
"portName": null,
"ifIndex": 5179,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15037,8 +15037,8 @@
"ifName": "StackSub-St1-1",
"portName": null,
"ifIndex": 5180,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15137,8 +15137,8 @@
"ifName": "StackSub-St1-2",
"portName": null,
"ifIndex": 5181,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15237,8 +15237,8 @@
"ifName": "StackPort2",
"portName": null,
"ifIndex": 5182,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15337,8 +15337,8 @@
"ifName": "StackSub-St2-1",
"portName": null,
"ifIndex": 5183,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15437,8 +15437,8 @@
"ifName": "StackSub-St2-2",
"portName": null,
"ifIndex": 5184,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15537,8 +15537,8 @@
"ifName": "StackPort3",
"portName": null,
"ifIndex": 5185,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15637,8 +15637,8 @@
"ifName": "StackSub-St3-1",
"portName": null,
"ifIndex": 5186,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down Expand Up @@ -15737,8 +15737,8 @@
"ifName": "StackSub-St3-2",
"portName": null,
"ifIndex": 5187,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
Expand Down