Hi,
I’m trying to connect our “home brew component database/ipam/configuration database” to LibreNMS as our new monitoring solution.
Question: the API-function “update_device_field” is supposed to edit any field of a device, am I right?
If so, then I think I stumbled upon a bug in the API: when I try to patch the field “type” to “wireless”, it switches back to “server”.
Steps:
curl -k -X POST -d '{"hostname":"HOSTNAME","snmp_disable":"true","os":"ping","hardware":"AP-Hardware"}' -H 'X-Auth-Token: MYTOKEN' https://MY.SERVER.ADDRESS/api/v0/devices
{
"status": "ok",
"message": "Device HOSTNAME (42) has been added successfully"
}
curl -k -X PATCH -d '{"field":"type","data":"wireless"}' -H 'X-Auth-Token: MYTOKEN https://MY.SERVER.ADDRESS/api/v0/devices/HOSTNAME
{
"status": "ok",
"message": "Device type field has been updated"
}
curl -k H 'X-Auth-Token: MYTOKEN' https://MY.SERVER.ADDRESS/api/v0/devices/HOSTNAME
{
"status": "ok",
"devices": [
{
(...)
"type": null,
(...)
}
],
"count": 1
}
output from the same command a few minutes later showed:
(...)
"type":"server",
(...)
In the WebUI Eventlog, whenever I try to switch the “type” field by API, it shows:
System Device type changed wireless => server
Changes done through the WebUI to the field “type” are persistent, but no option for me.
Output of “./validate.php”
LibreNMS | 1.42.01-34-g731da950d
DB Schema | 258
PHP | 7.0.30
MySQL | 10.0.34-MariaDB
RRDTool | 1.4.7
SNMP | NET-SNMP 5.7.3
[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] fping6 could not be executed. fping6 must have CAP_NET_RAW capability (getcap) or suid. Selinux exlusions may be required.
(/usr/sbin/fping6: can't create raw socket (must run as root?) : Operation not permitted)
[FAIL] fping6 should be suid!
[FIX] chmod u+s /usr/sbin/fping6
(The [FAIL] in the output is of no importance to us so far as LibreNMS is running in a test area without IPv6.)