API is returning old data

I have an python program that queries LibreNMS for all the devices under a specific group. It then displays the following info about those devices:

Status Device Name IP Address Version Hardware OS Uptime Type Active Alarms Historical Alarms.

My problem is that the API seems to be returning old data from when I originally wrote the script a few months ago. It says the device is down and has alarms even though the GUI shows it up with no active alarms.

My API query is to get all alerts and then see if any of my group devices are in the list:

http://LibreNMS_URL/api/v0/alerts

It returns this about the specific device I am referencing:

    {
        "hostname": "<hostname>",
        "id": 954,
        "device_id": 121,
        "rule_id": 1,
        "state": 1,
        "alerted": 1,
        "open": 0,
        "note": "",
        "timestamp": "2023-06-05 14:01:58",
        "info": "",
        "severity": "critical"
    },

This is what I see in the GUI for that same device (no alarms):

It also checks to see if the status is “true” or “false” to change the color to red if the device is down with the following query:

http://LibreNMS_URL/api/v0/devices/44

A snippet of what it returns is:

“status”: true,

That is saying the device is down from what I can tell. The device is not down anymore so I am not sure why I am getting this stale data.

Thanks in advance for any insight anyone has on this. Driving me crazy.

status: true means the device is up (the actual data in the table will be status = 1).

It looks like this PR changed the output of the API (Display Up/Down time in Device List by PipoCanaja · Pull Request #9951 · librenms/librenms · GitHub). I’m assuming because it’s easier in the code to test for true / false.

If you update you code to take that into account then you should be good.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.