mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Test against the snmpwalk with snmpsim
Fix issues with the snmp queries and indexes
This commit is contained in:
@@ -16,15 +16,16 @@ if ($device['os'] == 'ibm-amm') {
|
||||
d_echo($oids."\n");
|
||||
if (!empty($oids)) {
|
||||
|
||||
echo 'BLADE-MIB';
|
||||
foreach ($oids as $data) {
|
||||
echo 'BLADE-MIB ';
|
||||
foreach ($oids as $index => $data) {
|
||||
|
||||
if (!empty($data)) {
|
||||
$value = snmp_get($device, $data.'.0', '-OsqnU', 'BLADE-MIB');
|
||||
$value = trim(snmp_get($device, $data.'.0', '-Oqv', 'BLADE-MIB'), '"');
|
||||
|
||||
if (is_numeric($value)) {
|
||||
$oid = 'BLADE-MIB::' . $data . '.0';
|
||||
$descr = $data;
|
||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, 0, 'snmp', $descr, 1, 1, null, null, null, null, $value);
|
||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,15 +13,18 @@
|
||||
if ($device['os'] == 'ibm-amm') {
|
||||
|
||||
$index = 1;
|
||||
$oids = array('blower1State','blower2State','blower3State','blower4State');
|
||||
$oids = array(
|
||||
'blower1State' => '.1.3.6.1.4.1.2.3.51.2.2.3.10.0',
|
||||
'blower2State' => '.1.3.6.1.4.1.2.3.51.2.2.3.11.0',
|
||||
'blower3State' => '.1.3.6.1.4.1.2.3.51.2.2.3.12.0',
|
||||
'blower4State' => '.1.3.6.1.4.1.2.3.51.2.2.3.13.0'
|
||||
);
|
||||
|
||||
foreach ($oids as $oid) {
|
||||
|
||||
$state = snmp_get($device, $oid.'.0', '-OsqnU', 'BLADE-MIB');
|
||||
foreach ($oids as $state_name => $oid) {
|
||||
|
||||
$state = snmp_get($device, $oid, '-Oqv');
|
||||
if (!empty($state)) {
|
||||
|
||||
$state_name = $oid;
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
if ($state_index_id) {
|
||||
@@ -46,7 +49,7 @@ if ($device['os'] == 'ibm-amm') {
|
||||
|
||||
}//end if
|
||||
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, 0, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
$index++;
|
||||
@@ -56,15 +59,18 @@ if ($device['os'] == 'ibm-amm') {
|
||||
}//end foreach
|
||||
|
||||
$index = 1;
|
||||
$oids = array('blower1ControllerState','blower2ControllerState','blower3ControllerState','blower4ControllerState');
|
||||
$oids = array(
|
||||
'blower1ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.30.0',
|
||||
'blower2ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.31.0',
|
||||
'blower3ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.32.0',
|
||||
'blower4ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.33.0');
|
||||
|
||||
foreach ($oids as $oid) {
|
||||
foreach ($oids as $state_name => $oid) {
|
||||
|
||||
$state = snmp_get($device, $oid.'.0', '-OsqnU', 'BLADE-MIB');
|
||||
$state = snmp_get($device, $oid, '-Oqv');
|
||||
|
||||
if (!empty($state)) {
|
||||
if (is_numeric($state) && $state != 2) {
|
||||
|
||||
$state_name = $oid;
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
if ($state_index_id) {
|
||||
@@ -90,7 +96,7 @@ if ($device['os'] == 'ibm-amm') {
|
||||
|
||||
}//end if
|
||||
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, 0, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
$index++;
|
||||
|
Reference in New Issue
Block a user