Add Synology Hardware/Version/Serial detection (#8087)

* Add Synology Hardware/Version/Serial detection

Fixes #7957

* Add DSM test data for hardware/version/serial

* updated to use snmp_get_multi_oid and save more test data

* added json data

* re-saved json data for dsm

* Update dsm.json

* Update dsm_ds916.json

* Update dsm_ds214.json
This commit is contained in:
Nick Peelman
2018-01-21 02:13:33 -05:00
committed by Tony Murray
parent 99f8728688
commit 9ee96bda76
5 changed files with 284 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<?php
/**
* dsm.inc.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Nick Peelman
* @author Nick Peelman <nick@peelman.us>
*/
$tmp_dsm = snmp_get_multi_oid($device, 'modelName.0 version.0 serialNumber.0', '-OUQs', 'SYNOLOGY-SYSTEM-MIB');
$hardware = $tmp_dsm['modelName.0'];
$version = $tmp_dsm['version.0'];
$serial = $tmp_dsm['serialNumber.0'];
unset($tmp_dsm);

95
tests/data/dsm.json Normal file
View File

@ -0,0 +1,95 @@
{
"applications": {
"discovery": {
"applications": [],
"application_metrics": []
},
"poller": "matches discovery"
},
"arp-table": {
"discovery": {
"ipv4_mac": []
},
"poller": "matches discovery"
},
"bgp-peers": {
"discovery": {
"devices": [
{
"bgpLocalAs": null
}
],
"bgpPeers": [],
"bgpPeers_cbgp": []
},
"poller": "matches discovery"
},
"mempools": {
"discovery": {
"mempools": []
},
"poller": "matches discovery"
},
"ports": {
"discovery": {
"ports": []
},
"poller": "matches discovery"
},
"os": {
"discovery": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
"sysDescr": "Linux hostname 3.10.77 #8451 SMP Wed Jan 4 00:31:32 CST 2017 x86_64",
"sysContact": null,
"version": null,
"hardware": "",
"features": null,
"location": null,
"os": "dsm",
"type": "storage",
"serial": null,
"icon": "synology.svg"
}
]
},
"poller": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
"sysDescr": "Linux hostname 3.10.77 #8451 SMP Wed Jan 4 00:31:32 CST 2017 x86_64",
"sysContact": null,
"version": "DSM 6.1-15217",
"hardware": "DS1817+",
"features": null,
"location": null,
"os": "dsm",
"type": "storage",
"serial": "3005AWL999111",
"icon": "synology.svg"
}
]
}
},
"processors": {
"discovery": {
"processors": []
},
"poller": "matches discovery"
},
"storage": {
"discovery": {
"storage": []
},
"poller": "matches discovery"
},
"wireless": {
"discovery": {
"wireless_sensors": []
},
"poller": "matches discovery"
}
}

78
tests/data/dsm_ds214.json Normal file
View File

@ -0,0 +1,78 @@
{
"applications": {
"discovery": {
"applications": [],
"application_metrics": []
},
"poller": "matches discovery"
},
"arp-table": {
"discovery": {
"ipv4_mac": []
},
"poller": "matches discovery"
},
"bgp-peers": {
"discovery": {
"devices": [
{
"bgpLocalAs": null
}
],
"bgpPeers": [],
"bgpPeers_cbgp": []
},
"poller": "matches discovery"
},
"mempools": {
"discovery": {
"mempools": []
},
"poller": "matches discovery"
},
"ports": {
"discovery": {
"ports": []
},
"poller": "matches discovery"
},
"os": {
"discovery": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
"sysDescr": "Linux xxxxx 3.2.40 #7393 SMP PREEMPT Thu Jun 2 19:47:23 CST 2016 i686",
"sysContact": null,
"version": null,
"hardware": "",
"features": null,
"location": null,
"os": "dsm",
"type": "storage",
"serial": null,
"icon": "synology.svg"
}
]
},
"poller": "matches discovery"
},
"processors": {
"discovery": {
"processors": []
},
"poller": "matches discovery"
},
"storage": {
"discovery": {
"storage": []
},
"poller": "matches discovery"
},
"wireless": {
"discovery": {
"wireless_sensors": []
},
"poller": "matches discovery"
}
}

78
tests/data/dsm_ds916.json Normal file
View File

@ -0,0 +1,78 @@
{
"applications": {
"discovery": {
"applications": [],
"application_metrics": []
},
"poller": "matches discovery"
},
"arp-table": {
"discovery": {
"ipv4_mac": []
},
"poller": "matches discovery"
},
"bgp-peers": {
"discovery": {
"devices": [
{
"bgpLocalAs": null
}
],
"bgpPeers": [],
"bgpPeers_cbgp": []
},
"poller": "matches discovery"
},
"mempools": {
"discovery": {
"mempools": []
},
"poller": "matches discovery"
},
"ports": {
"discovery": {
"ports": []
},
"poller": "matches discovery"
},
"os": {
"discovery": {
"devices": [
{
"sysName": "",
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
"sysDescr": "Linux Syno 3.10.77 #8451 SMP Wed Nov 9 13:45:59 CST 2016 x86_6",
"sysContact": null,
"version": null,
"hardware": "",
"features": null,
"location": null,
"os": "dsm",
"type": "storage",
"serial": null,
"icon": "synology.svg"
}
]
},
"poller": "matches discovery"
},
"processors": {
"discovery": {
"processors": []
},
"poller": "matches discovery"
},
"storage": {
"discovery": {
"storage": []
},
"poller": "matches discovery"
},
"wireless": {
"discovery": {
"wireless_sensors": []
},
"poller": "matches discovery"
}
}

View File

@ -1,3 +1,6 @@
1.3.6.1.2.1.1.1.0|4|Linux hostname 3.10.77 #8451 SMP Wed Jan 4 00:31:32 CST 2017 x86_64
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10
1.3.6.1.2.1.25.1.4.0|4|syno_hw_version
1.3.6.1.4.1.6574.1.5.1.0|4|DS1817+
1.3.6.1.4.1.6574.1.5.3.0|4|DSM 6.1-15217
1.3.6.1.4.1.6574.1.5.2.0|4|3005AWL999111