Api Librenms
Api Librenms
get_alert
Route: /api/v0/alerts/:id
● id is the alert id, you can obtain a list of alert ids from list_alerts.
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 7,
"alerts": [
{
"hostname": "localhost",
"id": "1",
"device_id": "1",
"rule_id": "1",
"state": "1",
"alerted": "1",
"open": "1",
"timestamp": "2014-12-11 14:40:02"
}]
}
ack_alert
Acknowledge an alert
Route: /api/v0/alerts/:id
● id is the alert id, you can obtain a list of alert ids from list_alerts.
● note is the note to add to the alert
● until_clear is a boolean and if set to false, the alert will re-alert if it
gets worse/better or changes.
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"message": "Alert has been acknowledged"
}
unmute_alert
Unmute an alert
Route: /api/v0/alerts/unmute/:id
● id is the alert id, you can obtain a list of alert ids from list_alerts.
Input:
-
Example:
Output:
{
"status": "ok",
"message": "Alert has been unmuted"
}
list_alerts
Route: /api/v0/alerts
Input:
Examples:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"alerts": [
{
"id": "1",
"device_id": "1",
"rule_id": "1",
"state": "1",
"alerted": "1",
"open": "1",
"timestamp": "2014-12-11 14:40:02"
}]
}
Rules
get_alert_rule
Route: /api/v0/rules/:id
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"rules": [
{
"id": "1",
"device_id": "1",
"rule": "%devices.os != \"Juniper\"",
"severity": "warning",
"extra":
"{\"mute\":true,\"count\":\"15\",\"delay\":null,\"invert\":false}",
"disabled": "0",
"name": "A test rule"
}
]
}
delete_rule
Route: /api/v0/rules/:id
Input:
-
Example:
Output:
{
"status": "ok",
"message": "",
"message": "Alert rule has been removed"
}
list_alert_rules
Route: /api/v0/rules
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"rules": [
{
"id": "1",
"device_id": "-1",
"rule": "%devices.os != \"Juniper\"",
"severity": "critical",
"extra":
"{\"mute\":false,\"count\":\"15\",\"delay\":\"300\",\"invert\":false
}",
"disabled": "0",
"name": "A test rule"
}]
}
add_rule
Route: /api/v0/rules
Input (JSON):
Example:
Output:
{
"status": "ok"
}
edit_rule
Route: /api/v0/rules
Input (JSON):
● rule_id: You must specify the rule_id to edit an existing rule, if this is
absent then a new rule will be created.
● devices: This is either an array of device ids or -1 for a global rule
● builder: The rule which should be in the format entity.condition
value (i.e devices.status != 0 for devices marked as down). It must
be json encoded in the format rules are currently stored.
● severity: The severity level the alert will be raised against, Ok,
Warning, Critical.
● disabled: Whether the rule will be disabled or not, 0 = enabled, 1 =
disabled
● count: This is how many polling runs before an alert will trigger and
the frequency.
● delay: Delay is when to start alerting and how frequently. The value
is stored in seconds but you can specify minutes, hours or days by
doing 5 m, 5 h, 5 d for each one.
● interval: How often to re-issue notifications while this alert is
active,0 means notify once.The value is stored in seconds but you
can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each
one.
● mute: If mute is enabled then an alert will never be sent but will
show up in the Web UI (true or false).
● invert: This would invert the rules check.
● name: This is the name of the rule and is mandatory.
● notes: Some informal notes for this rule
Example:
Output:
{
"status": "ok"
ARP
list_arp
Retrieve a specific ARP entry or all ARP entries for a device
Route: /api/v0/resources/ip/arp/:query
Input:
● device if you specify all for the query then you need to populate this
with the hostname or id of the device.
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"arp": [
{
"port_id": "229",
"mac_address": "da160e5c2002",
"ipv4_address": "1.1.1.1",
"context_name": ""
}
]
Bills
list_bills
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"bills": [
{
"bill_id": "1",
"bill_name": "Router bills",
"bill_type": "cdr",
"bill_cdr": "10000000",
"bill_day": "1",
"bill_quota": "0",
"rate_95th_in": "0",
"rate_95th_out": "0",
"rate_95th": "0",
"dir_95th": "in",
"total_data": "0",
"total_data_in": "0",
"total_data_out": "0",
"rate_average_in": "0",
"rate_average_out": "0",
"rate_average": "0",
"bill_last_calc": "2015-07-02 17:01:26",
"bill_custid": "Router",
"bill_ref": "Router",
"bill_notes": "Bill me",
"bill_autoadded": "0",
"ports_total": "0",
"allowed": "10Mbps",
"used": "0bps",
"percent": 0,
"overuse": "-",
"ports": [
{
"device_id": "168",
"port_id": "35146",
"ifName": "eth0"
}
]
}
]
}
get_bill
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"bills": [
{
"bill_id": "1",
"bill_name": "Router bills",
"bill_type": "cdr",
"bill_cdr": "10000000",
"bill_day": "1",
"bill_quota": "0",
"rate_95th_in": "0",
"rate_95th_out": "0",
"rate_95th": "0",
"dir_95th": "in",
"total_data": "0",
"total_data_in": "0",
"total_data_out": "0",
"rate_average_in": "0",
"rate_average_out": "0",
"rate_average": "0",
"bill_last_calc": "2015-07-02 17:01:26",
"bill_custid": "Router",
"bill_ref": "Router",
"bill_notes": "Bill me",
"bill_autoadded": "0",
"ports_total": "0",
"allowed": "10Mbps",
"used": "0bps",
"percent": 0,
"overuse": "-",
"ports": [
{
"device_id": "168",
"port_id": "35146",
"ifName": "eth0"
}
]
}
]
}
get_bill_graph
NB: The graphs returned from this will always be png as they do not come
from rrdtool, even if you have SVG set.
Route: `/api/v0/bills/:id/graphs/:graph_type
Example:
Output:
Graph Image
get_bill_graphdata
Retrieve the data used to draw a graph so it can be rendered in an external
system
Route: /api/v0/bills/:id/graphdata/:graph_type
Input:
Example:
Output:
get_bill_history
Route: /api/v0/bills/:id/history
Input:
Example:
Output:
{
"status": "ok",
"bill_history": [
{
"bill_hist_id": "1",
"bill_id": "1",
"updated": "2018-02-06 17:01:01",
"bill_datefrom": "2018-02-01 00:00:00",
"bill_dateto": "2018-02-28 23:59:59",
"bill_type": "CDR",
"bill_allowed": "100000000",
"bill_used": "229963765",
"bill_overuse": "129963765",
"bill_percent": "229.96",
"rate_95th_in": "229963765",
"rate_95th_out": "1891344",
"rate_95th": "229963765",
"dir_95th": "in",
"rate_average": "136527101",
"rate_average_in": "135123359",
"rate_average_out": "1403743",
"traf_in": "3235123452544",
"traf_out": "33608406566",
"traf_total": "3268731859110",
"bill_peak_out": "2782349290",
"bill_peak_in": "10161119",
"pdf": null
}
],
"count": 1,
}
get_bill_history_graph
NB: The graphs returned from this will always be png as they do not come
from rrdtool, even if you have SVG set.
Route: /api/v0/bills/:id/history/:bill_hist_id/graphs/:graph_type
Input:
Example:
Output:
(image)
get_bill_history_graphdata
Route: /api/v0/bills/:id/history/:bill_hist_id/graphdata/:graph_type
Input:
Example:
Output:
delete_bill
Route: /api/v0/bills/:id
Input:
Example:
Output:
{
"status": "ok",
"message": "Bill has been removed"
}
create_edit_bill
Route: /api/v0/bills
Method: POST
● If you send an existing bill_id the call replaces all values it receives.
For example if you send 2 ports it will delete the existing ports and
add the the 2 new ports. So to add ports you have to get the current
ports first and add them to your update call.
Input:
Example (create):
Example (set):
Output:
{
"status": "ok",
"bill_id": 32
DeviceGroups
get_devicegroups
Route: /api/v0/devicegroups
Input (JSON):
-
Examples:
Output:
[
{
"status": "ok",
"message": "Found 1 device groups",
"count": 1,
"groups": [
{
"id": "1",
"name": "Testing",
"desc": "Testing",
"pattern": "%devices.status = \"1\" &&"
}
]
}
]
add_devicegroup
Add a new device group. Upon success, the ID of the new device group is
returned and the HTTP response code is 201.
Route: /api/v0/devicegroups
Input (JSON):
Examples:
Dynamic Example:
Output:
{
"status": "ok",
"id": 86,
"message": "Device group New Device Group created"
}
Static Example:
{
"status": "ok",
"id": 86,
"message": "Device group New Device Group created"
}
update_devicegroup
Route: /api/v0/devicegroups/:name
● name Is the name of the device group which can be obtained using
get_devicegroups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Input (JSON):
Examples:
Output:
{
"status": "ok",
"message": "Device group LinuxServers updated"
}
delete_devicegroup
Route: /api/v0/devicegroups/:name
● name Is the name of the device group which can be obtained using
get_devicegroups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Input:
Examples:
Output:
{
"status": "ok",
"message": "Device group LinuxServers deleted"
}
get_devices_by_group
Route: /api/v0/devicegroups/:name
● name Is the name of the device group which can be obtained using
get_devicegroups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Input (JSON):
● full: set to any value to return all data for the devices in a given
group
Examples:
Output:
[
{
"status": "ok",
"message": "Found 3 in group LinuxServers",
"count": 3,
"devices": [
{
"device_id": "15"
},
{
"device_id": "18"
},
{
"device_id": "20"
}
]
}
]
maintenance_devicegroup
Route: /api/v0/devicegroups/:name/maintenance
Input (JSON):
Output:
{
"status": "ok",
"message": "Device group Cisco switches (2) will begin
maintenance mode at 2022-08-01 22:45:00 for 2:00h"
}
Output:
{
"status": "ok",
"message": "Device group Cisco switches (2) moved into
maintenance mode for 2:00h"
}
Route: /api/v0/devicegroups/:name/devices
● name Is the name of the device group which can be obtained using
get_devicegroups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Input (JSON):
Example:
Output:
{
"status": "ok",
"message": "Devices added"
}
Route: /api/v0/devicegroups/:name/devices
● name Is the name of the device group which can be obtained using
get_devicegroups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Input (JSON):
Example:
Output:
{
"status": "ok",
"message": "Devices removed"
Devices
del_device
Route: /api/v0/devices/:hostname
Input:
Example:
Output:
{
"status": "ok",
"message": "Removed device localhost",
"devices": [
{
"device_id": "1",
"hostname": "localhost",
...
"serial": null,
"icon": null
}
]
}
get_device
Route: /api/v0/devices/:hostname
● hostname can be either the device hostname or id
Input:
Example:
Output:
{
"status": "ok",
"devices": [
{
"device_id": "1",
"hostname": "localhost",
...
"serial": null,
"icon": null
}
]
}
discover_device
Route: /api/v0/devices/:hostname/discover
Input:
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/devices/localhost/discover
Output:
{
"status": "ok",
"result": {
"status": 0,
"message": "Device will be rediscovered"
},
"count": 2
}
availability
Route: /api/v0/devices/:hostname/availability
Input:
Example:
Output:
{
"status": "ok",
"availability": [
{
"duration": 86400,
"availability_perc": "100.000000"
},
{
"duration": 604800,
"availability_perc": "100.000000"
},
{
"duration": 2592000,
"availability_perc": "99.946000"
},
{
"duration": 31536000,
"availability_perc": "99.994000"
}
],
"count": 4
}
outages
Route: /api/v0/devices/:hostname/outages
Input:
Example:
Output:
{
"status": "ok",
"outages": [
{
"going_down": 1593194031,
"up_again": 1593194388
},
{
"going_down": 1593946507,
"up_again": 1593946863
},
{
"going_down": 1594628616,
"up_again": 1594628968
},
{
"going_down": 1594628974,
"up_again": 1594629339
},
{
"going_down": 1594638668,
"up_again": 1594638992
}
],
"count": 5
}
get_graphs
Get a list of available graphs for a device, this does not include ports.
Route: /api/v0/devices/:hostname/graphs
Input:
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/devices/localhost/graphs
Output:
{
"status": "ok",
"message": "",
"count": 3,
"graphs": [
{
"desc": "Poller Time",
"name": "device_poller_perf"
},
{
"desc": "Ping Response",
"name": "device_ping_perf"
},
{
"desc": "System Uptime",
"name": "uptime"
}
]
}
list_available_health_graphs
Route: /api/v0/devices/:hostname/health(/:type)(/:sensor_id)
Example:
Output:
{
"status": "ok",
"message": "",
"count": 2,
"graphs": [
{
"desc": "Airflow",
"name": "device_airflow"
},
{
"desc": "Voltage",
"name": "device_voltage"
}
]
}
Example:
Output:
{
"status": "ok",
"message": "",
"count": 2,
"graphs": [
{
"sensor_id": "1",
"desc": "Input Feed A"
},
{
"sensor_id": "2",
"desc": "Output Feed"
}
]
}
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"graphs": [
{
"sensor_id": "1",
"sensor_deleted": "0",
"sensor_class": "voltage",
"device_id": "1",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.318.1.1.27.1.1.0",
"sensor_index": "1",
"sensor_type": "apc",
"sensor_descr": "Input",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": "1.15",
"sensor_limit_warn": null,
"sensor_limit_low": "0.85",
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"lastupdate": "2017-01-13 13:50:26",
"sensor_prev": "1"
}
]
}
list_available_wireless_graphs
Route: /api/v0/devices/:hostname/wireless(/:type)(/:sensor_id)
Input:
Example:
Output:
{
"status": "ok",
"graphs": [
{
"desc": "Ccq",
"name": "device_wireless_ccq"
},
{
"desc": "Clients",
"name": "device_wireless_clients"
}
],
"count": 2
}
Example:
Output:
{
"status": "ok",
"graphs": [
{
"sensor_id": "791",
"desc": "SSID: bast (ng)"
},
{
"sensor_id": "792",
"desc": "SSID: bast (na)"
}
],
"count": 2
}
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/devices/localhost/health/device_wireless
_ccq/1
Output:
{
"status": "ok",
"graphs": [
{
"sensor_id": "791",
"sensor_deleted": "0",
"sensor_class": "ccq",
"device_id": "381",
"sensor_index": "0",
"sensor_type": "unifi",
"sensor_descr": "SSID: bast (ng)",
"sensor_divisor": "10",
"sensor_multiplier": "1",
"sensor_aggregator": "sum",
"sensor_current": "100",
"sensor_prev": "100",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"lastupdate": "2017-12-06 21:26:29",
"sensor_oids": "[\".1.3.6.1.4.1.41112.1.6.1.2.1.3.0\"]",
"access_point_id": null
}
],
"count": 1
}
get_health_graph
Get a particular health class graph for a device, if you provide a sensor_id as
well then a single sensor graph will be provided. If no sensor_id value is
provided then you will be sent a stacked sensor graph.
Route: /api/v0/devices/:hostname/graphs/health/:type(/:sensor_id)
Input:
Example:
Output:
Example:
Output:
get_wireless_graph
Get a particular wireless class graph for a device, if you provide a sensor_id as
well then a single sensor graph will be provided. If no sensor_id value is
provided then you will be sent a stacked wireless graph.
Route: /api/v0/devices/:hostname/graphs/wireless/:type(/:sensor_id)
Input:
Example:
Output:
Example:
Output:
get_graph_generic_by_hostname
Get a specific graph for a device, this does not include ports.
Route: /api/v0/devices/:hostname/:type
● hostname can be either the device hostname or id
● type is the type of graph you want, use [get_graphs](#get_graphs to
see the graphs available. Defaults to device uptime.
Input:
● from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● to: This is the date you would like the graph to end - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● width: The graph width, defaults to 1075.
● height: The graph height, defaults to 300.
● output: Set how the graph should be outputted (base64, display),
defaults to display.
Example:
Output:
Output is an image.
get_graph_by_service
Route:
/api/v0/devices/:hostname/services/:service_id/graphs/:datasource
Input:
● from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● to: This is the date you would like the graph to end - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● width: The graph width, defaults to 1075.
● height: The graph height, defaults to 300.
Example:
Output:
Output is an image.
get_port_graphs
Route: /api/v0/devices/:hostname/ports
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 3,
"ports": [
{
"ifName": "lo"
},
{
"ifName": "eth0"
},
{
"ifName": "eth1"
}
]
}
get_device_fdb
Route: /api/v0/devices/:hostname/fdb
Example:
Output:
{
"status": "ok",
"ports_fdb": {
"ports_fdb_id": 10,
"port_id": 10000,
"mac_address": "1aaa2bbb3ccc",
"vlan_id": 20000,
"device_id": 1,
"created_at": "2019-01-1 01:01:01",
"updated_at": "2019-01-1 01:01:01"
}
}
get_device_nac
Route: /api/v0/devices/:hostname/nac
Example:
Output:
{
"status": "ok",
"ports_nac": [
{
"ports_nac_id": 1,
"auth_id": "0000000000000AAAABBBB8CC",
"device_id": 3,
"port_id": 6,
"domain": "data",
"username": "hostname.librenms.org",
"mac_address": "1aaa2bbb3ccc",
"ip_address": "192.0.2.2",
"host_mode": "singleHost",
"authz_status": "authorizationSuccess",
"authz_by": "Authentication Server",
"authc_status": "authcSuccess",
"method": "dot1x",
"timeout": "0",
"time_left": "0",
"vlan": 0,
"time_elapsed": null,
"created_at": "2025-05-08T08:55:06.000000Z",
"updated_at": "2025-05-08T08:55:06.000000Z",
"historical": 0
}
]
}
get_device_ip_addresses
Route: /api/v0/devices/:hostname/ip
Example:
Output:
{
"status": "ok",
"message": "",
"addresses": [
{
"ipv4_address_id": "290",
"ipv4_address": "192.168.99.292",
"ipv4_prefixlen": "30",
"ipv4_network_id": "247",
"port_id": "323",
"context_name": ""
}
]
}
get_port_stack
Get a list of port mappings for a device. This is useful for showing physical
ports that are in a virtual port-channel.
Route: /api/v0/devices/:hostname/port_stack
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 2,
"mappings": [
{
"device_id": "3742",
"port_id_high": "1001000",
"port_id_low": "51001",
"ifStackStatus": "active"
},
{
"device_id": "3742",
"port_id_high": "1001000",
"port_id_low": "52001",
"ifStackStatus": "active"
}
]
}
get_device_transceivers
Route: /api/v0/devices/:hostname/transceivers
Example:
Output:
{
"status": "ok",
"transceivers": [
{
"id": 12,
"created_at": "2024-06-26T23:46:06.000000Z",
"updated_at": "2024-06-26T23:46:57.000000Z",
"device_id": 3138,
"port_id": 50735,
"index": "50",
"type": "10G_BASE_LR_SFP",
"vendor": "FS",
"oui": "00 00 00",
"model": null,
"revision": "",
"serial": "G000999AA",
"date": null,
"ddm": true,
"encoding": null,
"cable": "SM",
"distance": 20000,
"wavelength": 1330,
"connector": "LC",
"channels": 1
},
{
"id": 13,
"created_at": "2024-06-26T23:46:06.000000Z",
"updated_at": "2024-06-27T00:00:07.000000Z",
"device_id": 3138,
"port_id": 50736,
"index": "51",
"type": "10G_BASE_SR_SFP",
"vendor": "HPE",
"oui": "64 9D 99",
"model": null,
"revision": "1",
"serial": "AAAA0000AAA",
"date": null,
"ddm": true,
"encoding": null,
"cable": "SM",
"distance": 300,
"wavelength": 850,
"connector": "LC",
"channels": 1
}
]
}
get_components
Route: /api/v0/devices/:hostname/components
Input:
Output:
{
"status": "ok",
"message": "",
"count": 3,
"components": {
"2": {
"TestAttribute-1": "Value1",
"TestAttribute-2": "Value2",
"TestAttribute-3": "Value3",
"type": "TestComponent-1",
"label": "This is a really cool blue component",
"status": "1",
"ignore": "0",
"disabled": "0"
},
"20": {
"TestAttribute-1": "Value4",
"TestAttribute-2": "Value5",
"TestAttribute-3": "Value6",
"type": "TestComponent-1",
"label": "This is a really cool red component",
"status": "1",
"ignore": "0",
"disabled": "0"
},
"27": {
"TestAttribute-1": "Value7",
"TestAttribute-2": "Value8",
"TestAttribute-3": "Value9",
"type": "TestComponent-2",
"label": "This is a really cool yellow widget",
"status": "1",
"ignore": "0",
"disabled": "0"
}
}
}
add_components
Route: /api/v0/devices/:hostname/components/:type
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"components": {
"4459": {
"type": "APITEST",
"label": "",
"status": 1,
"ignore": 0,
"disabled": 0,
"error": ""
}
}
}
edit_components
Route: /api/v0/devices/:hostname/components
In this example we set the label and add a new field: TestField:
Output:
{
"status": "ok",
"message": "",
"count": 1
}
delete_components
Route: /api/v0/devices/:hostname/components/:component
Example:
{
"status": "ok",
"message": ""
}
get_port_stats_by_port_hostname
Route: /api/v0/devices/:hostname/ports/:ifname
Input:
Example:
Output:
{
"status": "ok",
"port": {
"port_id": "2",
"device_id": "1",
...
"poll_prev": "1418412902",
"poll_period": "300"
}
}
get_graph_by_port_hostname
Route: /api/v0/devices/:hostname/ports/:ifname/:type
Input:
● from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● to: This is the date you would like the graph to end - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● width: The graph width, defaults to 1075.
● height: The graph height, defaults to 300.
● ifDescr: If this is set to true then we will use ifDescr to lookup the
port instead of ifName. Pass the ifDescr value you want to search
as you would ifName.
Example:
Output:
Output is an image.
list_sensors
Route: /api/v0/resources/sensors
Input:
Example:
Output:
{
"status": "ok",
"sensors": [
{
"sensor_id": 218810,
"sensor_deleted": 0,
"sensor_class": "dbm",
"device_id": 136,
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.2636.3.60.1.1.1.1.7.919",
"sensor_index": "tx-919",
"sensor_type": "junos",
"sensor_descr": "xe-2/1/4 Tx Power",
"group": null,
"sensor_divisor": 100,
"sensor_multiplier": 1,
"sensor_current": -1.81,
"sensor_limit": 2,
"sensor_limit_warn": 0.5,
"sensor_limit_low": -9.7,
"sensor_limit_low_warn": -8.21,
"sensor_alert": 1,
"sensor_custom": "No",
"entPhysicalIndex": "919",
"entPhysicalIndex_measured": "ports",
"lastupdate": "2019-02-18 02:47:09",
"sensor_prev": -1.77,
"user_func": null
},
...
],
"count": 100
}
list_devices
Route: /api/v0/devices
Input:
Example:
Output:
{
"status": "ok",
"count": 1,
"devices": [
{
"device_id": "1",
"hostname": "localhost",
...
"serial": null,
"icon": null
}
]
}
Example:
Output:
{
"status": "ok",
"count": 1,
"devices": [
{
"device_id": "1",
"hostname": "localhost",
...
"serial": null,
"icon": null
}
]
}
device_under_maintenance
Route: /api/v0/devices/:hostname/maintenance
Input:
Example:
Output:
{
"status": "ok",
"is_under_maintenance": true
}
maintenance_device
Route: /api/v0/devices/:hostname/maintenance
Input (JSON):
Output:
{
"status": "ok",
"message": "Device localhost (1) will begin maintenance mode at
2022-08-01 22:45:00 for 2:00h"
}
Output:
{
"status": "ok",
"message": "Device localhost (1) moved into maintenance mode for
2:00h"
}
add_device
Add a new device. Most fields are optional. You may omit snmp credentials to
attempt each system credential in order. See snmp.version, snmp.community,
and snmp.v3
To guarantee device is added, use force_add. This will skip checks for
duplicate device and snmp reachability, but not duplicate hostname.
Route: /api/v0/devices
Input (JSON):
Fields:
Options:
● force_add: Skip all checks, credentials are required. Add the device
as given directly to the database.
● ping_fallback: if snmp checks fail, add the device as ping only
instead of failing
SNMP v3 credentials:
● snmp_disable: set to true for ICMP only. Disables SNMP checks and
polling.
● os: OS short name for the device (defaults to ping).
● sysName: sysName for the device.
● hardware: Device hardware.
Example:
curl -X POST -d
'{"hostname":"localhost.localdomain","version":"v1","community":"pub
lic"}' -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/devices
Output:
{
"status": "ok",
"message": "Device localhost.localdomain (57) has been added
successfully",
"devices": [
{
"device_id": "57",
"hostname": "localhost",
...
"serial": null,
"icon": null
}
}
list_oxidized
List devices for use with Oxidized. If you have group support enabled then a
group will also be returned based on your config.
LibreNMS will automatically map the OS to the Oxidized model name if they
don't match.
Route: /api/v0/oxidized(/:hostname)
Input (JSON):
Examples:
Output:
[
{
"hostname": "localhost",
"os": "linux"
},
{
"hostname": "otherserver",
"os": "linux"
}
]
update_device_field
Route: /api/v0/devices/:hostname
Input (JSON):
Examples:
Output:
[
{
"status": "ok",
"message": "Device notes has been updated"
}
]
update_device_port_notes
Route: /api/v0/devices/:hostname/port/:portid
Input (JSON): - notes: The string data to populate on the port notes field.
Examples:
Output:
[
{
"status": "ok",
"message": "Port notes field has been updated"
}
]
Output:
[
{
"status": "ok",
"message": "Device fields have been updated"
}
]
rename_device
Rename device.
Route: /api/v0/devices/:hostname/rename/:new_hostname
Input:
Examples:
Output:
[
{
"status": "ok",
"message": "Device has been renamed"
}
]
get_device_groups
Route: /api/v0/devices/:hostname/groups
● hostname can be either the device hostname or id
Input (JSON):
Examples:
Output:
[
{
"status": "ok",
"message": "Found 1 device groups",
"count": 1,
"groups": [
{
"id": "1",
"name": "Testing",
"desc": "Testing",
"pattern": "%devices.status = \"1\" &&"
}
]
}
]
search_oxidized
Route: api/v0/oxidized/config/search/:searchstring
Input:
-
Example:
Output:
{
"status": "ok",
"nodes": [
{
"node": "asr9k.librenms.org",
"full_name": "cisco\/ASR9K.Librenms.org"
},
{
"node": "ios.Librenms.org",
"full_name": "cisco\/ios.Librenms.org"
}
],
"count": 2
}
get_oxidized_config
Route: api/v0/oxidized/config/:hostname
Input:
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/oxidized/config/router.corp.com
Output:
{
"status": "ok",
"config": "DEVICE CONFIG HERE"
}
add_parents_to_host
Route: /api/v0/devices/:device/parents
Input (JSON):
Example:
Output:
{
"status": "ok",
"message": "Device dependencies have been saved"
}
delete_parents_from_host
Deletes some or all the parents from a host.
Route: /api/v0/devices/:device/parents
Input (JSON):
Example:
Output:
{
"status": "ok",
"message": "All device dependencies have been removed"
}
list_parents_of_host
This is not a separate API call. Instead, you obtain the list of parents from
list_devices. See that entry point for more detailed information.
Example:
Output:
{
"status": "ok",
"devices": [
{
...
"dependency_parent_id": "98,99",
"dependency_parent_hostname": "HOSTNAME1,HOSTNAME2",
...
}
],
"count": 1
Inventory
get_inventory
Retrieve the inventory for a device. If you call this without any parameters then
you will only get part of the inventory. This is because a lot of devices nest
each component, for instance you may initially have the chassis, within this
the ports - 1 being an sfp cage, then the sfp itself. The way this API call is
designed is to enable a recursive lookup. The first call will retrieve the root
entry, included within this response will be entPhysicalIndex, you can then call
for entPhysicalContainedIn which will then return the next layer of results. To
retrieve all items together, see get_inventory_for_device.
Route: /api/v0/inventory/:hostname
Input:
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE'
https://librenms.org/api/v0/inventory/localhost?
entPhysicalContainedIn=65536
Output:
{
"status": "ok",
"message": "",
"count": 1,
"inventory": [
{
"entPhysical_id": "2",
"device_id": "32",
"entPhysicalIndex": "262145",
"entPhysicalDescr": "Linux 3.3.5 ehci_hcd RB400 EHCI",
"entPhysicalClass": "unknown",
"entPhysicalName": "1:1",
"entPhysicalHardwareRev": "",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "false",
"entPhysicalModelName": "0x0002",
"entPhysicalVendorType": "zeroDotZero",
"entPhysicalSerialNum": "rb400_usb",
"entPhysicalContainedIn": "65536",
"entPhysicalParentRelPos": "-1",
"entPhysicalMfgName": "0x1d6b",
"ifIndex": "0"
}
]
}
get_inventory_for_device
Retrieve the flattened inventory for a device. This retrieves all inventory items
for a device regardless of their structure, and may be more useful for devices
with with nested components.
Route: /api/v0/inventory/:hostname/all
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"inventory": [
{
"entPhysical_id": "2",
"device_id": "32",
"entPhysicalIndex": "262145",
"entPhysicalDescr": "Linux 3.3.5 ehci_hcd RB400 EHCI",
"entPhysicalClass": "unknown",
"entPhysicalName": "1:1",
"entPhysicalHardwareRev": "",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "false",
"entPhysicalModelName": "0x0002",
"entPhysicalVendorType": "zeroDotZero",
"entPhysicalSerialNum": "rb400_usb",
"entPhysicalContainedIn": "65536",
"entPhysicalParentRelPos": "-1",
"entPhysicalMfgName": "0x1d6b",
"ifIndex": "0"
}
]
Locations
list_locations
Route: /api/v0/resources/locations
Input:
Example:
Output:
{
"status": "ok",
"locations": [
{
"id": "1",
"location": "Example location, Example city, Example
Country",
"lat": "-18.911436",
"lng": "47.517446",
"timestamp": "2017-04-01 02:40:05"
},
...
],
"count": 100
}
add_location
Route: /api/v0/locations/
Input:
Example:
Output:
{
"status": "ok",
"message": "Location added with id #45"
}
delete_location
Route: /api/v0/locations/:location
Output:
{
"status": "ok",
"message": "Location Google has been deleted successfully"
edit_location
Edits a location
Route: /api/v0/locations/:location
Input:
● lat: latitude
● lng: longitude
Example:
Output:
{
"status": "ok",
"message": "Location updated successfully"
}
get_location
Route: /api/v0/location/:location
Output:
{
"status": "ok",
"get_location": [
{
"id": 1,
"location": "TEST",
"lat": 00.000000,
"lng": 00.000000,
"timestamp": "2023-01-01 00:00:00",
"fixed_coordinates": 1
}
],
"count": 1
Logs
All the list_*logs calls are aliased to list_logs.
Input:
● start: The page number to request.
● limit: The limit of results to be returned.
● from: The date and time or the event id to search from.
● to: The data and time or the event id to search to.
list_eventlog
Route: /api/v0/logs/eventlog/:hostname
list_syslog
Route: /api/v0/logs/syslog/:hostname
list_alertlog
Route: /api/v0/logs/alertlog/:hostname
list_authlog
Route: /api/v0/logs/authlog/:hostname
Example:
Output:
{
"status": "ok",
"message": "",
"count": 5,
"total": "15",
"logs": [
{
"hostname": "localhost",
"sysName": "web01.1.novalocal",
"event_id": "10050349",
"host": "279",
"device_id": "279",
"datetime": "2017-07-22 19:57:47",
"message": "ifAlias: -> <pptp-something-something-tunnel-
something>",
"type": "interface",
"reference": "NULL",
"username": "",
"severity": "3"
},
....
{
"hostname": "localhost",
"sysName": "web01.1.novalocal",
"event_id": "10050353",
"host": "279",
"device_id": "279",
"datetime": "2017-07-22 19:57:47",
"message": "ifHighSpeed: -> 0",
"type": "interface",
"reference": "NULL",
"username": "",
"severity": "3"
}
]
}
syslogsink
Route: /api/v0/logs/syslogsink
Accept any json messages and passes to further syslog processing. single messages or an
array of multiple messages is accepted. see Syslog for more details and logstash integration
Example
Back to top
PollerGroups
get_poller_group
Route: /api/v0/poller_group/:poller_group
Output:
{
"status": "ok",
"get_poller_group": [
{
"id": 1,
"group_name": "test",
"descr": "test group"
}
],
"count": 1
Port_Groups
get_port_groups
Route: /api/v0/port_groups
Examples:
Output:
[
{
"status": "ok",
"message": "Found 1 port groups",
"count": 1,
"groups": [
{
"id": "1",
"name": "Testing",
"desc": "Testing"
}
]
}
]
get_ports_by_group
Route: /api/v0/port_groups/:name
● name Is the name of the port group which can be obtained using
get_port_groups. Please ensure that the name is urlencoded if it
needs to be (i.e Linux Servers would need to be urlencoded.
Params:
● full: set to any value to return all data for the devices in a given
group
Examples:
Output:
{
"status": "ok",
"ports": [
{
"port_id": 1376
},
{
"port_id": 2376
}
],
"count": 2
}
add_port_group
Add a new port group. Upon success, the ID of the new port group is returned
and the HTTP response code is 201.
Route: /api/v0/port_groups
Input (JSON):
Examples:
Dynamic Example:
Output:
{
"status": "ok",
"id": 86,
"message": "Port group New Port Group created"
}
assign_port_group
Route: /api/v0/port_groups/:port_group_id/assign
Input (JSON):
Examples:
Dynamic Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE' -X POST -d '{"port_ids":
["4","34","25,"983"]}'
https://librenms.org/api/v0/port_groups/3/assign
Output:
{
"status": "ok",
"Port Ids 4, 34, 25, 983 have been added to Port Group Id 3":
200
}
remove_port_group
Route: /api/v0/port_groups/:port_group_id/remove
Input (JSON):
Examples:
Dynamic Example:
Output:
{
"status": "ok",
"Port Ids 4, 34, 25, 983 have been removed from Port Group Id
3": 200
}
PortGroups
get_graph_by_portgroup
Route: /api/v0/portgroups/:group
● group is the type of port group graph you want, I.e Transit, Peering,
etc. You can specify multiple types comma separated.
Input:
● from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● to: This is the date you would like the graph to end - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● width: The graph width, defaults to 1075.
● height: The graph height, defaults to 300.
Example:
Output:
Output is an image.
get_graph_by_portgroup_multiport_bits
Route: /api/v0/portgroups/multiport/bits/:id
● id is a comma separated list of port ids you want, I.e 1,2,3,4, etc.
You can specify multiple IDs comma separated.
Input:
● from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● to: This is the date you would like the graph to end - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more
information.
● width: The graph width, defaults to 1075.
● height: The graph height, defaults to 300.
Example:
Output:
Output is an image.
Ports
get_all_ports
Get info for all ports on all devices. Strongly recommend that you use the
columns parameter to avoid pulling too much data.
Route: /api/v0/ports
Input:
Example:
{
"status": "ok",
"message": "",
"ports": [
{
"ifName": "Gi0/0/0",
"port_id": "1"
},
{
"ifName": "Gi0/0/1",
"port_id": "2"
},
...
{
"ifName": "Vlan 3615",
"port_id": "5488"
}
]
}
search_ports
Route: /api/v0/ports/search/:search
Input:
Example:
{
"status": "ok",
"ports": [
{
"device_id": 1,
"port_id": 1,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 2,
"port_id": 3,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 3,
"port_id": 5,
"ifIndex": 1,
"ifName": "lo"
}
]
}
Route: /api/v0/ports/search/:field/:search
Input:
Output:
{
"status": "ok",
"ports": [
{
"device_id": 1,
"port_id": 1,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 2,
"port_id": 3,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 3,
"port_id": 5,
"ifIndex": 1,
"ifName": "lo"
}
]
}
ports_with_associated_mac
Route: /api/v0/ports/mac/:search?filter=first
● search a mac address in fdb and print the ports ordered by the mac
count of the associated port.
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"port": [
{
"port_id": "323",
"device_id": "55",
"port_descr_type": null,
"port_descr_descr": null,
"port_descr_circuit": null,
"port_descr_speed": null,
"port_descr_notes": null,
"ifDescr": "GigabitEthernet0/0/0",
"ifName": "Gi0/0/0",
"portName": null,
"ifIndex": "1",
"ifSpeed": "1000000000",
"ifConnectorPresent": "true",
"ifPromiscuousMode": "false",
"ifHighSpeed": "1000",
"ifOperStatus": "up",
"ifOperStatus_prev": null,
"ifAdminStatus": "up",
"ifAdminStatus_prev": null,
"ifDuplex": "fullDuplex",
"ifMtu": "1560",
"ifType": "ethernetCsmacd",
"ifAlias": "ASR Interconnect Trunk",
"ifPhysAddress": "84bf20853e00",
"ifHardType": null,
"ifLastChange": "42407358",
"ifVlan": "",
"ifTrunk": "",
"ifVrf": "0",
"counter_in": null,
"counter_out": null,
"ignore": "0",
"disabled": "0",
"detailed": "0",
"deleted": "0",
"pagpOperationMode": null,
"pagpPortState": null,
"pagpPartnerDeviceId": null,
"pagpPartnerLearnMethod": null,
"pagpPartnerIfIndex": null,
"pagpPartnerGroupIfIndex": null,
"pagpPartnerDeviceName": null,
"pagpEthcOperationMode": null,
"pagpDeviceId": null,
"pagpGroupIfIndex": null,
"ifInUcastPkts": "128518576",
"ifInUcastPkts_prev": "128517284",
"ifInUcastPkts_delta": "1292",
"ifInUcastPkts_rate": "4",
"ifOutUcastPkts": "128510560",
"ifOutUcastPkts_prev": "128509268",
"ifOutUcastPkts_delta": "1292",
"ifOutUcastPkts_rate": "4",
"ifInErrors": "0",
"ifInErrors_prev": "0",
"ifInErrors_delta": "0",
"ifInErrors_rate": "0",
"ifOutErrors": "0",
"ifOutErrors_prev": "0",
"ifOutErrors_delta": "0",
"ifOutErrors_rate": "0",
"ifInOctets": "12827393730",
"ifInOctets_prev": "12827276736",
"ifInOctets_delta": "116994",
"ifInOctets_rate": "387",
"ifOutOctets": "14957481766",
"ifOutOctets_prev": "14957301765",
"ifOutOctets_delta": "180001",
"ifOutOctets_rate": "596",
"poll_time": "1483779150",
"poll_prev": "1483778848",
"poll_period": "302"
}
]
}
get_port_info
Route: /api/v0/ports/:portid?with=vlans
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"port": [
{
"port_id": "323",
"device_id": "55",
"port_descr_type": null,
"port_descr_descr": null,
"port_descr_circuit": null,
"port_descr_speed": null,
"port_descr_notes": null,
"ifDescr": "GigabitEthernet0/0/0",
"ifName": "Gi0/0/0",
"portName": null,
"ifIndex": "1",
"ifSpeed": "1000000000",
"ifConnectorPresent": "true",
"ifPromiscuousMode": "false",
"ifHighSpeed": "1000",
"ifOperStatus": "up",
"ifOperStatus_prev": null,
"ifAdminStatus": "up",
"ifAdminStatus_prev": null,
"ifDuplex": "fullDuplex",
"ifMtu": "1560",
"ifType": "ethernetCsmacd",
"ifAlias": "ASR Interconnect Trunk",
"ifPhysAddress": "84bf20853e00",
"ifHardType": null,
"ifLastChange": "42407358",
"ifVlan": "",
"ifTrunk": "",
"ifVrf": "0",
"counter_in": null,
"counter_out": null,
"ignore": "0",
"disabled": "0",
"detailed": "0",
"deleted": "0",
"pagpOperationMode": null,
"pagpPortState": null,
"pagpPartnerDeviceId": null,
"pagpPartnerLearnMethod": null,
"pagpPartnerIfIndex": null,
"pagpPartnerGroupIfIndex": null,
"pagpPartnerDeviceName": null,
"pagpEthcOperationMode": null,
"pagpDeviceId": null,
"pagpGroupIfIndex": null,
"ifInUcastPkts": "128518576",
"ifInUcastPkts_prev": "128517284",
"ifInUcastPkts_delta": "1292",
"ifInUcastPkts_rate": "4",
"ifOutUcastPkts": "128510560",
"ifOutUcastPkts_prev": "128509268",
"ifOutUcastPkts_delta": "1292",
"ifOutUcastPkts_rate": "4",
"ifInErrors": "0",
"ifInErrors_prev": "0",
"ifInErrors_delta": "0",
"ifInErrors_rate": "0",
"ifOutErrors": "0",
"ifOutErrors_prev": "0",
"ifOutErrors_delta": "0",
"ifOutErrors_rate": "0",
"ifInOctets": "12827393730",
"ifInOctets_prev": "12827276736",
"ifInOctets_delta": "116994",
"ifInOctets_rate": "387",
"ifOutOctets": "14957481766",
"ifOutOctets_prev": "14957301765",
"ifOutOctets_delta": "180001",
"ifOutOctets_rate": "596",
"poll_time": "1483779150",
"poll_prev": "1483778848",
"poll_period": "302"
}
]
}
get_port_ip_info
Get all IP info (v4 and v6) for a given port id.
Route: /api/v0/ports/:portid/ip
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"addresses": [
{
"ipv4_address_id": "290",
"ipv4_address": "192.168.99.292",
"ipv4_prefixlen": "30",
"ipv4_network_id": "247",
"port_id": "323",
"context_name": ""
}
]
}
get_port_transceiver
Route: /api/v0/ports/:portid/transceiver
Output:
{
"status": "ok",
"transceivers": [
{
"id": 13,
"created_at": "2024-06-26T23:46:06.000000Z",
"updated_at": "2024-06-27T00:00:07.000000Z",
"device_id": 3138,
"port_id": 50736,
"index": "51",
"type": "10G_BASE_SR_SFP",
"vendor": "HPE",
"oui": "64 9D 99",
"model": null,
"revision": "1",
"serial": "AAA0000AAA00",
"date": null,
"ddm": true,
"encoding": null,
"cable": "MM",
"distance": 300,
"wavelength": 850,
"connector": "LC",
"channels": 1
}
]
}
get_port_description
Get the description (ifAlias) for a given port id.
Route: /api/v0/ports/:portid/description
Example:
Output:
{
"status": "ok",
"port_description": "GigabitEthernet14"
}
update_port_description
Route: /api/v0/ports/:portid/description
Input (JSON):
Example:
Output:
{
"status": "ok",
"message": "Port description updated."
}
Routing
list_bgp
Route: /api/v0/bgp
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"bgp_sessions": [
{
"bgpPeer_id": 1260,
"device_id": 7,
"vrf_id": null,
"astext": "Acme Ltd",
"bgpPeerIdentifier":
"2001:0DB8:0000:24cb:0000:0000:0000:0001",
"bgpPeerRemoteAs": 65432,
"bgpPeerState": "established",
"bgpPeerAdminStatus": "start",
"bgpPeerLastErrorCode": 6,
"bgpPeerLastErrorSubCode": 2,
"bgpPeerLastErrorText": "administrative shutdown",
"bgpPeerIface": 268,
"bgpLocalAddr":
"2001:0DB8:0000:24cb:0000:0000:0000:0002",
"bgpPeerRemoteAddr": "0.0.0.0",
"bgpPeerDescr": "Another one #CORE",
"bgpPeerInUpdates": 283882969,
"bgpPeerOutUpdates": 7008,
"bgpPeerInTotalMessages": 283883031,
"bgpPeerOutTotalMessages": 1386692,
"bgpPeerFsmEstablishedTime": 1628487,
"bgpPeerInUpdateElapsedTime": 0,
"context_name": ""
},
...
],
"count": 100
}
get_bgp
Route: /api/v0/bgp/:id
Input:
Example:
Output:
{
"status": "ok",
"bgp_session": [
{
"bgpPeer_id": "4",
"device_id": "2",
"astext": "",
"bgpPeerIdentifier": "1234:1b80:1:12::2",
"bgpPeerRemoteAs": "54321",
"bgpPeerState": "established",
"bgpPeerAdminStatus": "running",
"bgpLocalAddr": "1234:1b80:1:12::1",
"bgpPeerRemoteAddr": "0.0.0.0",
"bgpPeerInUpdates": "3",
"bgpPeerOutUpdates": "1",
"bgpPeerInTotalMessages": "0",
"bgpPeerOutTotalMessages": "0",
"bgpPeerFsmEstablishedTime": "0",
"bgpPeerInUpdateElapsedTime": "0",
"context_name": ""
}
],
"count": 1
}
edit_bgp_descr
Route: /api/v0/bgp/:id
Input:
Example:
Output:
{
"status": "ok",
"message": "BGP description for peer X.X.X.X on device 1 updated
to Your description here"
}
list_cbgp
Input:
Example:
Output:
{
"status": "ok",
"bgp_counters": [
{
"device_id": "9",
"bgpPeerIdentifier": "192.168.99.31",
"afi": "ipv4",
"safi": "multicast",
"AcceptedPrefixes": "2",
"DeniedPrefixes": "0",
"PrefixAdminLimit": "0",
"PrefixThreshold": "0",
"PrefixClearThreshold": "0",
"AdvertisedPrefixes": "11487",
"SuppressedPrefixes": "0",
"WithdrawnPrefixes": "10918",
"AcceptedPrefixes_delta": "-2",
"AcceptedPrefixes_prev": "2",
"DeniedPrefixes_delta": "0",
"DeniedPrefixes_prev": "0",
"AdvertisedPrefixes_delta": "-11487",
"AdvertisedPrefixes_prev": "11487",
"SuppressedPrefixes_delta": "0",
"SuppressedPrefixes_prev": "0",
"WithdrawnPrefixes_delta": "-10918",
"WithdrawnPrefixes_prev": "10918",
"context_name": ""
},
...
],
"count": 100
}
list_ip_addresses
Route: /api/v0/resources/ip/addresses/:address_family
Input:
Example:
Output:
{
"status": "ok",
"ip_addresses": [
{
"ipv4_address_id": "69",
"ipv4_address": "127.0.0.1",
"ipv4_prefixlen": "8",
"ipv4_network_id": "55",
"port_id": "135",
"context_name": ""
},
...
],
"count": 55
}
get_network_ip_addresses
Route: /api/v0/resources/ip/networks/:id/ip
● id must be integer
Input:
Example:
Output:
{
"status": "ok",
"addresses": [
{
"ipv4_address_id": "69",
"ipv4_address": "127.0.0.1",
"ipv4_prefixlen": "8",
"ipv4_network_id": "55",
"port_id": "135",
"context_name": ""
}
],
"count": 1
}
list_ip_networks
Route: /api/v0/resources/ip/networks/:address_family
Input:
Example:
Output:
{
"status": "ok",
"ip_networks": [
{
"ipv4_network_id": "1",
"ipv4_network": "127.0.0.0/8",
"context_name": ""
},
...
],
"count": 100
}
list_ipsec
List the current IPSec tunnels which are active.
Route: /api/v0/routing/ipsec/data/:hostname
Input:
Example:
Output:
{
"status": "ok",
"message": "",
"count": 0,
"ipsec": [
"tunnel_id": "1",
"device_id": "1",
"peer_port": "0",
"peer_addr": "127.0.0.1",
"local_addr": "127.0.0.2",
"local_port": "0",
"tunnel_name": "",
"tunnel_status": "active"
]
}
Please note, this will only show active VPN sessions not all configured.
list_ospf
Input:
Example:
Output:
{
"status": "ok",
"ospf_neighbours": [
{
"device_id": "1",
"port_id": "0",
"ospf_nbr_id": "172.16.1.145.0",
"ospfNbrIpAddr": "172.16.1.145",
"ospfNbrAddressLessIndex": "0",
"ospfNbrRtrId": "172.16.0.140",
"ospfNbrOptions": "82",
"ospfNbrPriority": "1",
"ospfNbrState": "full",
"ospfNbrEvents": "5",
"ospfNbrLsRetransQLen": "0",
"ospfNbmaNbrStatus": "active",
"ospfNbmaNbrPermanence": "dynamic",
"ospfNbrHelloSuppressed": "false",
"context_name": ""
}
],
"count": 1
}
list_ospf_ports
Route: /api/v0/ospf_ports
Example:
Output:
{
"status": "ok",
"ospf_ports": [
{
"id": 189086,
"device_id": 43,
"port_id": 2838,
"ospf_port_id": "10.10.2.86.0",
"ospfIfIpAddress": "10.10.2.86",
"ospfAddressLessIf": 0,
"ospfIfAreaId": "0.0.0.0",
"ospfIfType": "pointToPoint",
"ospfIfAdminStat": "enabled",
"ospfIfRtrPriority": 128,
"ospfIfTransitDelay": 1,
"ospfIfRetransInterval": 5,
"ospfIfHelloInterval": 10,
"ospfIfRtrDeadInterval": 40,
"ospfIfPollInterval": 90,
"ospfIfState": "pointToPoint",
"ospfIfDesignatedRouter": "0.0.0.0",
"ospfIfBackupDesignatedRouter": "0.0.0.0",
"ospfIfEvents": 33,
"ospfIfAuthKey": "",
"ospfIfStatus": "active",
"ospfIfMulticastForwarding": "unicast",
"ospfIfDemand": "false",
"ospfIfAuthType": "0",
"ospfIfMetricIpAddress": "10.10.2.86",
"ospfIfMetricAddressLessIf": 0,
"ospfIfMetricTOS": 0,
"ospfIfMetricValue": 10,
"ospfIfMetricStatus": "active",
"context_name": null
}
],
"count": 1
}
list_ospfv3
Route: /api/v0/ospfv3
Input:
Example:
Output:
{
"status": "ok",
"ospfv3_neighbours": [
{
"id": 7,
"device_id": 14,
"ospfv3_instance_id": 7,
"port_id": 2345,
"router_id": "10.0.43.11",
"ospfv3NbrIfIndex": 2,
"ospfv3NbrIfInstId": 0,
"ospfv3NbrRtrId": 167797515,
"ospfv3NbrAddressType": "ipv6",
"ospfv3NbrAddress": "fe80::1d7:101:98cf:af80",
"ospfv3NbrOptions": 19,
"ospfv3NbrPriority": 50,
"ospfv3NbrState": "full",
"ospfv3NbrEvents": 6,
"ospfv3NbrLsRetransQLen": 0,
"ospfv3NbrHelloSuppressed": "false",
"ospfv3NbrIfId": 14,
"ospfv3NbrRestartHelperStatus": "notHelping",
"ospfv3NbrRestartHelperAge": 0,
"ospfv3NbrRestartHelperExitReason": "none",
"context_name": ""
}
],
"count": 1
}
list_ospfv3_ports
Route: /api/v0/ospfv3_ports
Example:
Output:
{
"status": "ok",
"ospfv3_ports": [
{
"id": 13,
"device_id": 14,
"ospfv3_instance_id": 7,
"ospfv3_area_id": 43,
"port_id": 2390,
"ospfv3IfIndex": 2,
"ospfv3IfInstId": 0,
"ospfv3IfAreaId": 0,
"ospfv3IfType": "broadcast",
"ospfv3IfAdminStatus": "enabled",
"ospfv3IfRtrPriority": 1,
"ospfv3IfTransitDelay": 1,
"ospfv3IfRetransInterval": 5,
"ospfv3IfHelloInterval": 10,
"ospfv3IfRtrDeadInterval": 40,
"ospfv3IfPollInterval": 10,
"ospfv3IfState": "backupDesignatedRouter",
"ospfv3IfDesignatedRouter": "10.0.43.11",
"ospfv3IfBackupDesignatedRouter": "10.7.9.254",
"ospfv3IfEvents": 7,
"ospfv3IfDemand": "false",
"ospfv3IfMetricValue": 10,
"ospfv3IfLinkScopeLsaCount": 2,
"ospfv3IfLinkLsaCksumSum": 64455,
"ospfv3IfDemandNbrProbe": "false",
"ospfv3IfDemandNbrProbeRetransLimit": 0,
"ospfv3IfDemandNbrProbeInterval": 0,
"ospfv3IfTEDisabled": "true",
"ospfv3IfLinkLSASuppression": "false",
"context_name": ""
}
],
"count": 1
}
list_vrf
List the current VRFs.
Route: /api/v0/routing/vrf
Input:
OR
Example:
Output:
{
"status": "ok",
"vrfs": [
{
"vrf_id": "2",
"vrf_oid": "8.77.103.109.116.45.118.114.102",
"vrf_name": "Mgmt-vrf",
"mplsVpnVrfRouteDistinguisher": "",
"mplsVpnVrfDescription": "",
"device_id": "8"
},
...
],
"count": 100
}
get_vrf
Retrieves VRF by ID
Route: /api/v0/routing/vrf/:id
Input:
Example:
Output:
{
"status": "ok",
"vrf": [
{
"vrf_id": "2",
"vrf_oid": "8.77.103.109.116.45.118.114.102",
"vrf_name": "Mgmt-vrf",
"mplsVpnVrfRouteDistinguisher": "",
"mplsVpnVrfDescription": "",
"device_id": "8"
}
],
"count": 1
}
list_mpls_services
Route: /api/v0/routing/mpls/services
Input:
● hostname = Either the devices hostname or id
Example:
Output:
{
"status": "ok",
"mpls_services": [
{
"svc_id": 1671,
"svc_oid": 27,
"device_id": 4,
"svcRowStatus": "active",
"svcType": "tls",
"svcCustId": 1,
"svcAdminStatus": "up",
"svcOperStatus": "up",
"svcDescription": "",
"svcMtu": 9008,
"svcNumSaps": 1,
"svcNumSdps": 0,
"svcLastMgmtChange": 2,
"svcLastStatusChange": 168,
"svcVRouterId": 0,
"svcTlsMacLearning": "enabled",
"svcTlsStpAdminStatus": "disabled",
"svcTlsStpOperStatus": "down",
"svcTlsFdbTableSize": 250,
"svcTlsFdbNumEntries": 0,
"hostname": "host.example.com"
}
],
"count": 1
}
list_mpls_saps
Route: /api/v0/routing/mpls/saps
Input:
Example:
Output:
{
"status": "ok",
"saps": [
{
"sap_id": 1935,
"svc_id": 1660,
"svc_oid": 7,
"sapPortId": 16108921125,
"ifName": "1/1/c2/1",
"device_id": 3,
"sapEncapValue": "0",
"sapRowStatus": "active",
"sapType": "epipe",
"sapDescription": "",
"sapAdminStatus": "up",
"sapOperStatus": "down",
"sapLastMgmtChange": 2,
"sapLastStatusChange": 0,
"hostname": "hostname=host.example.com"
}
],
"count": 1
Services
list_services
Route: /api/v0/services
Input:
● state: only which have a certain state (valid options are 0=Ok,
1=Warning, 2=Critical).
● type: service type, used sql LIKE to find services, so for tcp, use
type=tcp for http use type=http
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"services": [
[
{
"service_id": "13",
"device_id": "1",
"service_ip": "demo1.yourdomian.net",
"service_type": "ntp_peer",
"service_desc": "NTP",
"service_param": "-H 192.168.1.10",
"service_ignore": "0",
"service_status": "0",
"service_changed": "1470962470",
"service_message": "NTP OK: Offset -0.000717 secs",
"service_disabled": "0",
"service_ds": "{\"offset\":\"s\"}"
}
],
[
{
"service_id": "2",
"device_id": "2",
"service_ip": "demo2.yourdomian.net",
"service_type": "esxi_hardware.py",
"service_desc": "vmware hardware",
"service_param": "-H 192.168.1.11 -U USER -P PASS -
p",
"service_ignore": "0",
"service_status": "0",
"service_changed": "1471702206",
"service_message": "OK - Server: Supermicro
X9SCL/X9SCM s/n: 0123456789 System BIOS: 2.2 2015-02-20",
"service_disabled": "0",
"service_ds":
"{\"P2Vol_0_Processor_1_Vcore\":\"\",\"P2Vol_1_System_Board_1_-
12V\":\"\",\"P2Vol_2_System_Board_1_12V\":\"\",\"P2Vol_3_System_Boar
d_1_3.3VCC\":\"\",\"P2Vol_4_System_Board_1_5VCC\":\"\",\"P2Vol_5_Sys
tem_Board_1_AVCC\":\"\",\"P2Vol_6_System_Board_1_VBAT\":\"\",\"P2Vol
_7_System_Board_1_"
}
]
]
}
get_service_for_host
Route: /api/v0/services/:hostname
Input:
● state: only which have a certain state (valid options are 0=Ok,
1=Warning, 2=Critical).
● type: service type, used sql LIKE to find services, so for tcp, use
type=tcp for http use type=http
Example:
Output:
{
"status": "ok",
"message": "",
"count": 1,
"services": [
[
{
"service_id": "2",
"device_id": "2",
"service_ip": "demo2.yourdomian.net",
"service_type": "esxi_hardware.py",
"service_desc": "vmware hardware",
"service_param": "-H 192.168.1.11 -U USER -P PASS -
p",
"service_ignore": "0",
"service_status": "0",
"service_changed": "1471702206",
"service_message": "OK - Server: Supermicro
X9SCL/X9SCM s/n: 0123456789 System BIOS: 2.2 2015-02-20",
"service_disabled": "0",
"service_ds":
"{\"P2Vol_0_Processor_1_Vcore\":\"\",\"P2Vol_1_System_Board_1_-
12V\":\"\",\"P2Vol_2_System_Board_1_12V\":\"\",\"P2Vol_3_System_Boar
d_1_3.3VCC\":\"\",\"P2Vol_4_System_Board_1_5VCC\":\"\",\"P2Vol_5_Sys
tem_Board_1_AVCC\":\"\",\"P2Vol_6_System_Board_1_VBAT\":\"\",\"P2Vol
_7_System_Board_1_"
}
]
]
}
add_service_for_host
Route: /api/v0/services/:hostname
Input:
Example:
{
"status": "ok",
"message": "Service ping has been added to device 192.168.1.10
(#10)"
}
edit_service_from_host
Edits a service
Route: /api/v0/services/:service_id
● service id
Input:
● id: service id
Example:
Output:
{
"status": "ok",
"message": "Service updated successfully"
delete_service_from_host
Deletes service from device
Route: /api/v0/services/:service_id
● service id
Input:
● id: service id
Example:
Output:
{
"status": "ok",
"message": "Service has been deleted successfully"
Switching
list_vlans
Route: /api/v0/resources/vlans
Input:
Example:
{
"status": "ok",
"vlans": [
{
"vlan_id": "31",
"device_id": "10",
"vlan_vlan": "1",
"vlan_domain": "1",
"vlan_name": "default",
"vlan_type": "ethernet",
"vlan_state": 1
},
...
],
"count": 100
}
get_vlans
Route: /api/v0/devices/:hostname/vlans
Input:
Example:
Output:
{
"status": "ok",
"count": 0,
"vlans": [
{
"vlan_vlan": "1",
"vlan_domain": "1",
"vlan_name": "default",
"vlan_type": "ethernet",
"vlan_state": 1
}
]
}
list_links
Route: /api/v0/resources/links
Input:
Example:
Output:
{
"status": "ok",
"links": [
{
"id": 10,
"local_port_id": 100,
"local_device_id": 1,
"remote_port_id": 200,
"active": 1,
"protocol": "lldp",
"remote_hostname": "host2.example.com",
"remote_device_id": 2,
"remote_port": "xe-0/0/1",
"remote_platform": null,
"remote_version": "Example Router v.1.0"
},
...
],
"count": 100
}
get_links
Route: /api/v0/devices/:hostname/links
Input:
Example:
Output:
{
"status": "ok",
"links": [
{
"id": 10,
"local_port_id": 100,
"local_device_id": 1,
"remote_port_id": 200,
"active": 1,
"protocol": "lldp",
"remote_hostname": "host2.example.com",
"remote_device_id": 2,
"remote_port": "xe-0/0/1",
"remote_platform": null,
"remote_version": "Example Router v.1.0"
},
...
],
"count": 10
}
get_link
Retrieves Link by ID
Route: /api/v0/resources/links/:id
Input:
Example:
Output:
{
"status": "ok",
"links": [
{
"id": 10,
"local_port_id": 100,
"local_device_id": 1,
"remote_port_id": 200,
"active": 1,
"protocol": "lldp",
"remote_hostname": "host2.example.com",
"remote_device_id": 2,
"remote_port": "xe-0/0/1",
"remote_platform": null,
"remote_version": "Example Router v.1.0"
}
],
"count": 1
}
list_fdb
Route: /api/v0/resources/fdb/:mac
Input:
Example:
Output:
{
"status": "ok",
"ports_fdb": [
{
"ports_fdb_id": 10,
"port_id": 10000,
"mac_address": "1aaa2bbb3ccc",
"vlan_id": 20000,
"device_id": 1,
"created_at": "2019-01-1 01:01:01",
"updated_at": "2019-01-1 01:01:01"
},
...
],
"count": 100
}
list_fdb_detail
Get a list of all ports FDB with human readable device and interface names.
Route: /api/v0/resources/fdb/:mac/detail
Input:
Example:
Output:
{
'count': 7,
'mac': '9c:93:aa:bb:cc:dd',
'mac_oui': 'Xerox Corporation',
'ports_fdb': [
{
'hostname': 'hq-core1',
'sysName': 'hq-core1',
'ifName': 'ae10',
'ifAlias': 'ae10',
'ifDescr': 'ae10',
'last_seen': '2 hours ago',
'updated_at': '2023-05-17 03:19:15'
},
{
'hostname': 'hq-sw1',
'sysName': 'hq-sw1',
'ifName': 'ge-0/0/0',
'ifAlias': 'ge-0/0/0',
'ifDescr': 'ge-0/0/0',
'last_seen': '3 hours ago',
'updated_at': '2023-05-17 02:02:06'
},
...
],
'status': 'ok'
}
list_nac
Route: /api/v0/resources/nac/:mac
Input:
Example:
Output:
{
"status": "ok",
"ports_nac": [
{
"ports_nac_id": 1,
"auth_id": "0000000000000AAAABBBB8CC",
"device_id": 3,
"port_id": 6,
"domain": "data",
"username": "hostname.librenms.org",
"mac_address": "1aaa2bbb3ccc",
"ip_address": "192.0.2.2",
"host_mode": "singleHost",
"authz_status": "authorizationSuccess",
"authz_by": "Authentication Server",
"authc_status": "authcSuccess",
"method": "dot1x",
"timeout": "0",
"time_left": "0",
"vlan": 0,
"time_elapsed": null,
"created_at": "2025-05-08T08:55:06.000000Z",
"updated_at": "2025-05-08T08:55:06.000000Z",
"historical": 0
}
]
System
system
Route: /api/v0/system
Input:
-
Example:
Output:
{
"status": "ok",
"system": [
{
"local_ver": "1.37-234-g19103ee",
"local_sha": "19103ee36f68f009272c15be22e5a7e10a8b0b85",
"local_date": "1526480966",
"local_branch": "master",
"db_schema": 249,
"php_ver": "7.2.2",
"database_ver": "MariaDB 5.5.56-MariaDB",
"rrdtool_ver": "1.4.8",
"netsnmp_ver": "NET-SNMP 5.7.2"
}
],
"count": 1