Skip to content

Commit

Permalink
Fixed sensor discovery issue for serverscheck os (librenms#16499)
Browse files Browse the repository at this point in the history
  • Loading branch information
laf authored Oct 6, 2024
1 parent 205c104 commit 8c6964a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions includes/discovery/sensors/humidity/serverscheck.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
'sensor3Value.0' => '.1.3.6.1.4.1.17095.3.10.0',
'sensor4Value.0' => '.1.3.6.1.4.1.17095.3.14.0',
'sensor5Value.0' => '.1.3.6.1.4.1.17095.3.18.0',
'sensor6Value.0' => '.1.3.6.1.4.1.17095.3.22.0',
'sensor7Value.0' => '.1.3.6.1.4.1.17095.3.26.0',
'sensor8Value.0' => '.1.3.6.1.4.1.17095.3.30.0',
];

$temp_x = 1;
Expand Down
3 changes: 3 additions & 0 deletions includes/discovery/sensors/state/serverscheck.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
'sensor3Value.0' => '.1.3.6.1.4.1.17095.3.10.0',
'sensor4Value.0' => '.1.3.6.1.4.1.17095.3.14.0',
'sensor5Value.0' => '.1.3.6.1.4.1.17095.3.18.0',
'sensor6Value.0' => '.1.3.6.1.4.1.17095.3.22.0',
'sensor7Value.0' => '.1.3.6.1.4.1.17095.3.26.0',
'sensor8Value.0' => '.1.3.6.1.4.1.17095.3.30.0',
];

foreach ($pre_cache['serverscheck_control'] as $oid_name => $oid_value) {
Expand Down
3 changes: 3 additions & 0 deletions includes/discovery/sensors/temperature/serverscheck.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
'sensor3Value.0' => '.1.3.6.1.4.1.17095.3.10.0',
'sensor4Value.0' => '.1.3.6.1.4.1.17095.3.14.0',
'sensor5Value.0' => '.1.3.6.1.4.1.17095.3.18.0',
'sensor6Value.0' => '.1.3.6.1.4.1.17095.3.22.0',
'sensor7Value.0' => '.1.3.6.1.4.1.17095.3.26.0',
'sensor8Value.0' => '.1.3.6.1.4.1.17095.3.30.0',
];

$temp_x = 1;
Expand Down
50 changes: 50 additions & 0 deletions tests/data/serverscheck.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@
"sensors": {
"discovery": {
"sensors": [
{
"sensor_deleted": 0,
"sensor_class": "humidity",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.17095.3.22.0",
"sensor_index": "sensor6name",
"sensor_type": "serverscheck",
"sensor_descr": "Humidity1",
"group": null,
"sensor_divisor": 1,
"sensor_multiplier": 1,
"sensor_current": 39.63,
"sensor_limit": 70,
"sensor_limit_warn": null,
"sensor_limit_low": 30,
"sensor_limit_low_warn": null,
"sensor_alert": 1,
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"rrd_type": "GAUGE",
"state_name": null
},
{
"sensor_deleted": 0,
"sensor_class": "state",
Expand Down Expand Up @@ -100,6 +125,31 @@
},
"poller": {
"sensors": [
{
"sensor_deleted": 0,
"sensor_class": "humidity",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.17095.3.22.0",
"sensor_index": "sensor6name",
"sensor_type": "serverscheck",
"sensor_descr": "Humidity1",
"group": null,
"sensor_divisor": 1,
"sensor_multiplier": 1,
"sensor_current": 39.63,
"sensor_limit": 70,
"sensor_limit_warn": null,
"sensor_limit_low": 30,
"sensor_limit_low_warn": null,
"sensor_alert": 1,
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"rrd_type": "GAUGE",
"state_name": null
},
{
"sensor_deleted": 0,
"sensor_class": "state",
Expand Down
5 changes: 5 additions & 0 deletions tests/snmpsim/serverscheck.snmprec
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
1.3.6.1.4.1.17095.3.17.0|4|-
1.3.6.1.4.1.17095.3.18.0|4|-
1.3.6.1.4.1.17095.3.19.0|4|-
1.3.6.1.4.1.17095.3.20.0|4|-
1.3.6.1.4.1.17095.3.21.0|4|Humidity1
1.3.6.1.4.1.17095.3.22.0|4|39.63
1.3.6.1.4.1.17095.3.23.0|4|DOWN
1.3.6.1.4.1.17095.3.24.0|4|04 October 2024,11:33:55

0 comments on commit 8c6964a

Please sign in to comment.