Hi,
I’m trying to automatically update some of my hostnames in LibreNMS when they are changing with a script. The easiest way to do this would be with the API’s devices->update_device_field call I think. Only when I tried to make a call to this API function with the hostname
field I get the following error;
500 Server Error: Internal Server Error for url: https://librenms/api/v0/devices/device-hostname
b'{\n "status": "error",\n "message": "Device field is not allowed to be updated"\n}'
Looking through the source code I can see the following in includes/html/api_functions.inc.php:1910
→ $bad_fields = ['device_id', 'hostname'];
. Seems like this is denied on purpose, but I can’t figure out why? On the web interface you can update hostnames through the settings page, why not through the API?
Maybe there is another way of doing this? I would like to avoid a direct DB call
validate.php output for good measure;
====================================
Component | Version
--------- | -------
LibreNMS | 22.9.0-3-g06c361c2b
DB Schema | 2022_08_15_084507_add_rrd_type_to_wireless_sensors_table (248)
PHP | 8.1.12
Python | 3.6.8
Database | MariaDB 10.3.35-MariaDB
RRDTool | 1.7.0
SNMP | 5.8
====================================