Fix discovery and pooling Racom Ray2 (#13553)

* Fix discovery and pooling

* Added test data

* Removed author

* Fix

* Discovery transcribed into json

* Fix

* Fix2

* Fix3
This commit is contained in:
Martin22
2021-11-24 18:18:12 +01:00
committed by GitHub
parent e32685b54e
commit 382ef6219b
10 changed files with 1373 additions and 725 deletions

View File

@@ -1,158 +0,0 @@
<?php
echo 'RAy Racom State';
// System Status (Value : na (0) unknown, ok (1) ok, warning (2) warning, alarm (3) alarm)
$state = snmp_get($device, 'systemStatus.0', '-Ovqe', 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'systemStatus';
create_state_index(
$state_name,
[
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'],
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'],
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'Warning'],
['value' => 3, 'generic' => 3, 'graph' => 0, 'descr' => 'Alarm'],
]
);
$sensor_index = 0;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.1',
$sensor_index,
$state_name,
'System Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}
// Line Status (Value : na (0) unknown, ok (1) ok, analyzer (2) analyzer, connecting (3) connecting, searching (4)). Supported by RAy10 only.
$state = snmp_get($device, 'lineStatus.0', '-Ovqe', 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'lineStatus';
create_state_index(
$state_name,
[
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'],
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'],
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'Analyzer'],
['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'Connecting'],
['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'Searching'],
]
);
$sensor_index = 1;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.2',
$sensor_index,
$state_name,
'Radio Link Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}
// RF Power Status (Value : na (0) unknown, ok (1) ok, fail (2) fail)
$state = snmp_get($device, 'rfPowerStatus.0', '-Ovqe', 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'rfPowerStatus';
create_state_index(
$state_name,
[
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'],
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Ok'],
['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'Failure'],
]
);
$sensor_index = 2;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.4',
$sensor_index,
$state_name,
'RF Power Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}
// Peer station user Ethernet link Status (Value : na (0) unknown, up (1) up, down (2) down) Not supported by RAy2.
$state = snmp_get($device, 'ethPeer.0', '-Ovqe', 'RAY-MIB');
if ($state) {
//Create State Index
$state_name = 'ethPeer';
create_state_index(
$state_name,
[
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'],
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'Up'],
['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'Down'],
]
);
$sensor_index = 3;
discover_sensor(
$valid['sensor'],
'state',
$device,
'.1.3.6.1.4.1.33555.1.1.3.6',
$sensor_index,
$state_name,
'Peer Station Ethernet Status',
1,
1,
null,
null,
null,
null,
$state,
'snmp',
0
);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $sensor_index);
}

View File

@@ -1,22 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2017 Martin Zatloukal <slezi2@pvfree.net>
* 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.
*/
d_echo('RAY');
$oid = '.1.3.6.1.4.1.33555.1.1.4.2';
$index = 0;
$sensor_type = ' temperatureRadio';
$descr = 'Internal Temp';
$divisor = 100;
$temperature = (snmp_get($device, $oid, '-Oqv', 'RAY-MIB') / $divisor);
if (is_numeric($temperature)) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensor_type, $descr, $divisor, null, null, null, null, null, $temperature);
}

View File

@@ -1,22 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2017 Martin Zatloukal <slezi2@pvfree.net>
* 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.
*/
d_echo('RAY');
$oid = '.1.3.6.1.4.1.33555.1.1.4.3';
$index = 0;
$sensor_type = 'voltageUnit';
$descr = 'Voltage';
$divisor = 10;
$voltage = (snmp_get($device, $oid, '-Oqv', 'RAY-MIB') / $divisor);
if (is_numeric($voltage)) {
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $sensor_type, $descr, $divisor, null, null, null, null, null, $voltage);
}