1<?php 2 3// Power Status OID (Value : 0 Bad, 1 Good, 2 NotPresent) 4// Common States - F5 Power supply and FanSpeed State 5$states = [ 6 ['value' => 0, 'generic' => 2, 'graph' => 0, 'descr' => 'Bad'], 7 ['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Good'], 8 ['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'NotPresent'], 9]; 10 11$temp = snmpwalk_cache_multi_oid($device, 'sysChassisPowerSupplyTable', [], 'F5-BIGIP-SYSTEM-MIB'); 12if (is_array($temp)) { 13 echo 'F5 power supply: '; 14 //Create State Index 15 $state_name = 'sysChassisPowerSupplyStatus'; 16 create_state_index($state_name, $states); 17 18 foreach ($temp as $index => $data) { 19 $descr = 'sysChassisPowerSupplyStatus.' . $temp[$index]['sysChassisPowerSupplyIndex']; 20 $current = $data['sysChassisPowerSupplyStatus']; 21 $sensorType = 'f5'; 22 $oid = '.1.3.6.1.4.1.3375.2.1.3.2.2.2.1.2.' . $index; 23 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current, 'snmp', $index); 24 25 //Create Sensor To State Index 26 create_sensor_to_state_index($device, $state_name, $index); 27 } // End foreach (array_keys($temp) as $index) 28} // End if (is_array($temp)) 29 30$temp = snmpwalk_cache_multi_oid($device, 'sysChassisFanStatus', [], 'F5-BIGIP-SYSTEM-MIB'); 31if (is_array($temp)) { 32 echo 'F5 FanSpeed State: '; 33 //Create State Index 34 $state_name = 'sysChassisFanStatus'; 35 create_state_index($state_name, $states); 36 foreach (array_keys($temp) as $index) { 37 $descr = 'Fan Speed Status ' . $index; 38 $current = $temp[$index]['sysChassisFanStatus']; 39 $sensorType = 'f5'; 40 $oid = '.1.3.6.1.4.1.3375.2.1.3.2.1.2.1.2.' . $index; 41 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current, 'snmp', $index); 42 43 //Create Sensor To State Index 44 create_sensor_to_state_index($device, $state_name, $index); 45 } // End foreach (array_keys($temp) as $index) 46} // End if (is_array($temp)) 47 48$temp = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatus', [], 'F5-BIGIP-SYSTEM-MIB'); 49 50if (is_array($temp)) { 51 echo 'F5 FailOver State: '; 52 //Create State Index 53 $state_name = 'sysCmFailoverStatusId'; 54 $states = [ 55 ['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'], 56 ['value' => 1, 'generic' => 2, 'graph' => 0, 'descr' => 'OffLine'], 57 ['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'ForcedOffline'], 58 ['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'Standby'], 59 ['value' => 4, 'generic' => 0, 'graph' => 0, 'descr' => 'Active'], 60 ]; 61 create_state_index($state_name, $states); 62 63 foreach (array_keys($temp) as $index) { 64 $descr = 'sysCmFailoverStatusId.' . $temp[$index]['sysCmFailoverStatusId']; 65 $current = $temp[$index]['sysCmFailoverStatusId']; 66 $sensorType = 'f5'; 67 $oid = '.1.3.6.1.4.1.3375.2.1.14.3.1.' . $index; 68 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current, 'snmp', $index); 69 70 //Create Sensor To State Index 71 create_sensor_to_state_index($device, $state_name, $index); 72 } // End foreach (array_keys($temp) as $index) 73} // End if (is_array($temp)) 74 75$temp = snmpwalk_cache_multi_oid($device, 'sysCmSyncStatusId', [], 'F5-BIGIP-SYSTEM-MIB'); 76 77if (is_array($temp)) { 78 echo 'F5 Sync State: '; 79 //Create State Index 80 $state_name = 'sysCmSyncStatusId'; 81 $states = [ 82 ['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'], 83 ['value' => 1, 'generic' => 1, 'graph' => 0, 'descr' => 'syncing'], 84 ['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'needManualSync'], 85 ['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'inSync'], 86 ['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'syncFailed'], 87 ['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'syncDisconnected'], 88 ['value' => 6, 'generic' => 0, 'graph' => 0, 'descr' => 'standalone'], 89 ['value' => 7, 'generic' => 1, 'graph' => 0, 'descr' => 'awaitingInitialSync'], 90 ['value' => 8, 'generic' => 2, 'graph' => 0, 'descr' => 'incompatibleVersion'], 91 ['value' => 9, 'generic' => 2, 'graph' => 0, 'descr' => 'partialSync'], 92 ]; 93 create_state_index($state_name, $states); 94 95 foreach (array_keys($temp) as $index) { 96 $descr = 'sysCmSyncStatusId.' . $index; 97 $current = $temp[$index]['sysCmSyncStatusId']; 98 $sensorType = 'f5'; 99 $oid = '.1.3.6.1.4.1.3375.2.1.14.1.1.' . $index; 100 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current, 'snmp', $index); 101 102 //Create Sensor To State Index 103 create_sensor_to_state_index($device, $state_name, $index); 104 } // End foreach (array_keys($temp) as $index) 105} // End if (is_array($temp)) 106 107$temp = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatusColor', [], 'F5-BIGIP-SYSTEM-MIB'); 108 109if (is_array($temp)) { 110 echo 'F5 FailOver State Color: '; 111 //Create State Index 112 $state_name = 'sysCmFailoverStatusColor'; 113 $states = [ 114 ['value' => 0, 'generic' => 0, 'graph' => 0, 'descr' => 'Green: functioning correctly'], 115 ['value' => 1, 'generic' => 1, 'graph' => 0, 'descr' => 'Yellow: functioning suboptimally'], 116 ['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'Red: requires attention to function correctly'], 117 ['value' => 3, 'generic' => 3, 'graph' => 0, 'descr' => 'Blue: status is unknown'], 118 ['value' => 4, 'generic' => 0, 'graph' => 0, 'descr' => 'Gray: intentionally not functioning'], 119 ['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'Black: not connected to any peers'], 120 ]; 121 create_state_index($state_name, $states); 122 123 foreach (array_keys($temp) as $index) { 124 $descr = 'sysCmFailoverStatusColor.' . $index; 125 $current = $temp[$index]['sysCmFailoverStatusColor']; 126 $sensorType = 'f5'; 127 $oid = '.1.3.6.1.4.1.3375.2.1.14.3.3.' . $index; 128 discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current, 'snmp', $index); 129 130 //Create Sensor To State Index 131 create_sensor_to_state_index($device, $state_name, $index); 132 } // End foreach (array_keys($temp) as $index) 133} // End if (is_array($temp)) 134