Skip to content

Commit

Permalink
Restore OpenBSD version/features/hardware (#8673)
Browse files Browse the repository at this point in the history
* Restore OpenBSD version/features/hardware

* Add os test data

* Update openbsd.inc.php
  • Loading branch information
murrant committed May 9, 2018
1 parent 8ce423d commit b94ad92
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
3 changes: 3 additions & 0 deletions includes/polling/os/openbsd.inc.php
Expand Up @@ -2,6 +2,9 @@

use LibreNMS\RRD\RrdDefinition;

list(,,$version,$features,$hardware) = explode(" ", $device['sysDescr']);
$features = str_replace(['(', ')'], '', $features);

$oids = snmp_get_multi($device, 'pfStateCount.0 pfStateSearches.0 pfStateInserts.0 pfStateRemovals.0', '-OQUs', 'OPENBSD-PF-MIB');

$states = $oids[0]['pfStateCount'];
Expand Down
2 changes: 1 addition & 1 deletion includes/polling/os/unix.inc.php
Expand Up @@ -125,7 +125,7 @@
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
list(,,$hardware) = explode("$features", $device['sysDescr']);
} elseif ($device['os'] == "openbsd" || $device['os'] == "solaris" || $device['os'] == "opensolaris") {
} elseif ($device['os'] == "solaris" || $device['os'] == "opensolaris") {
list(,,$version,$features,$hardware) = explode(" ", $device['sysDescr']);
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
Expand Down
40 changes: 40 additions & 0 deletions tests/data/openbsd_1.json
@@ -0,0 +1,40 @@
{
"os": {
"discovery": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.12",
"sysDescr": "OpenBSD hostname 5.3 GENERIC.MP#58 i386",
"sysContact": null,
"version": null,
"hardware": "",
"features": null,
"location": null,
"os": "openbsd",
"type": "server",
"serial": null,
"icon": "openbsd.svg"
}
]
},
"poller": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.12",
"sysDescr": "OpenBSD hostname 5.3 GENERIC.MP#58 i386",
"sysContact": null,
"version": "5.3",
"hardware": "i386",
"features": "GENERIC.MP#58",
"location": null,
"os": "openbsd",
"type": "server",
"serial": null,
"icon": "openbsd.svg"
}
]
}
}
}

0 comments on commit b94ad92

Please sign in to comment.