diff --git a/includes/definitions/discovery/junos.yaml b/includes/definitions/discovery/junos.yaml index 48f66196e7..f80f8e06dc 100644 --- a/includes/definitions/discovery/junos.yaml +++ b/includes/definitions/discovery/junos.yaml @@ -1,4 +1,4 @@ -mib: JUNIPER-IFOPTICS-MIB:JNX-OPT-IF-EXT-MIB:IF-MIB:JUNIPER-MIB:JUNIPER-SRX5000-SPU-MONITORING-MIB +mib: JUNIPER-IFOPTICS-MIB:JNX-OPT-IF-EXT-MIB:IF-MIB:JUNIPER-MIB:JUNIPER-SRX5000-SPU-MONITORING-MIB:JUNIPER-ALARM-MIB modules: processors: data: @@ -18,6 +18,7 @@ modules: data: - oid: - ifDescr + - jnxFruName chromatic_dispersion: data: - @@ -113,3 +114,43 @@ modules: divisor: 1000 descr: '{{ $ifDescr }} Tx Bias' index: 'jnxPMCurTxLaserBiasCurrent.{{ $index }}' + state: + data: + - + oid: jnxYellowAlarmState + value: jnxYellowAlarmState + num_oid: .1.3.6.1.4.1.2636.3.4.2.2.1. + descr: 'Yellow Alarm' + index: '{{ $index }}' + states: + - { value: 1, descr: unknown, graph: 1, generic: 3 } + - { value: 2, descr: off, graph: 1, generic: 0 } + - { value: 3, descr: on, graph: 1, generic: 2 } + - + oid: jnxRedAlarmState + value: jnxRedAlarmState + num_oid: .1.3.6.1.4.1.2636.3.4.2.3.1. + descr: 'Red Alarm' + index: '{{ $index }}' + states: + - { value: 1, descr: unknown, graph: 1, generic: 3 } + - { value: 2, descr: off, graph: 1, generic: 0 } + - { value: 3, descr: on, graph: 1, generic: 2 } + - + oid: jnxFruState + value: jnxFruState + num_oid: .1.3.6.1.4.1.2636.3.1.15.1.8. + descr: '{{ $jnxFruName }}' + skip_values: 2 + index: '{{ $index }}' + states: + - { value: 1, descr: unknown, graph: 1, generic: 3 } + - { value: 2, descr: empty, graph: 1, generic: 3 } + - { value: 3, descr: present, graph: 1, generic: 1 } + - { value: 4, descr: ready, graph: 1, generic: 0 } + - { value: 5, descr: announceOnline, graph: 1, generic: 0 } + - { value: 6, descr: online, graph: 1, generic: 0 } + - { value: 7, descr: anounceOffline, graph: 1, generic: 1 } + - { value: 8, descr: offline, graph: 1, generic: 2 } + - { value: 9, descr: diagnostic, graph: 1, generic: 3 } + - { value: 10, descr: standby, graph: 1, generic: 3 } diff --git a/includes/discovery/sensors/state/junos.inc.php b/includes/discovery/sensors/state/junos.inc.php deleted file mode 100644 index e5f86b5259..0000000000 --- a/includes/discovery/sensors/state/junos.inc.php +++ /dev/null @@ -1,82 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$tables = array( - array('JUNIPER-MIB','jnxFruTable','.1.3.6.1.4.1.2636.3.1.15.1.8.','jnxFruState','jnxFruName') , - array('JUNIPER-ALARM-MIB','jnxYellowAlarms','.1.3.6.1.4.1.2636.3.4.2.2.1.0','jnxYellowAlarmState') , - array('JUNIPER-ALARM-MIB','jnxRedAlarms','.1.3.6.1.4.1.2636.3.4.2.3.1.0','jnxRedAlarmState') -); - -foreach ($tables as $tablevalue) { - $temp = snmpwalk_cache_multi_oid($device, $tablevalue[1], array(), $tablevalue[0], 'junos'); - $cur_oid = $tablevalue[2]; - - if (is_array($temp)) { - //Create State Index - $state_name = $tablevalue[3]; - $state_index_id = create_state_index($state_name); - - //Create State Translation - if ($state_index_id !== null) { - if ($state_name == 'jnxFruState') { - $states = array( - array($state_index_id,'unknown',0,1,3) , - array($state_index_id,'empty',0,2,3) , - array($state_index_id,'present',0,3,1) , - array($state_index_id,'ready',0,4,0) , - array($state_index_id,'announceOnline',0,5,0) , - array($state_index_id,'online',0,6,0) , - array($state_index_id,'anounceOffline',0,7,1) , - array($state_index_id,'offline',0,8,2) , - array($state_index_id,'diagnostic',0,9,3) , - array($state_index_id,'standby',0,10,3) - ); - } else { - $states = array( - array($state_index_id,'other',0,1,3) , - array($state_index_id,'off',0,2,0) , - array($state_index_id,'on',0,3,2) - ); - } - foreach ($states as $value) { - $insert = array( - 'state_index_id' => $value[0], - 'state_descr' => $value[1], - 'state_draw_graph' => $value[2], - 'state_value' => $value[3], - 'state_generic_value' => $value[4] - ); - dbInsert($insert, 'state_translations'); - } - } - - foreach ($temp as $index => $entry) { - $oid = $cur_oid.$index; - $descr = $temp[$index]['jnxFruName']; - - if ($tablevalue[3] !== 'jnxFruState') { - $oid = $tablevalue[2]; - $descr = 'Yellow Alarm'; - if ($tablevalue[3] == 'jnxRedAlarmState') { - $descr = 'Red Alarm'; - } - } - if (stripos($descr, 'Yellow Alarm') !== false || stripos($descr, 'Red Alarm') !== false || stripos($descr, 'cb') !== false || stripos($descr, 'pem') !== false || stripos($descr, 'fan') !== false || stripos($descr, 'power') !== false || preg_match('/Routing Engine [0|1]/', $descr)) { - //Discover Sensors - discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp[$index][$tablevalue[3]], 'snmp', $index); - - //Create Sensor To State Index - create_sensor_to_state_index($device, $state_name, $index); - } - } - } -}