Skip to main content

Python client for the LibreNMS API

Project description

librenmsapi

librenmsapi is Python client library for the LibreNMS API.

The Python code (librenmsapi.py) is auto-generated from the Markdown files for the LibreNMS API documentation. It should therefore be complete, assuming that the LibreNMS API documentation is complete.

import librenmsapi

URL = 'http://192.168.1.1'
TOKEN = '3231554f57c1d0d05c5c3c0a2da3ba8f6a1b67f2'

client = librenmsapi.LibreNMS(URL, TOKEN):

The endpoint categories (Devices, Inventory, Locations, etc.) are available as attributes of the LibreNMS class (in lower-case) and the actual endpoints as their methods().

Required inputs must be provided as arguments, optional inputs can be supplied as keyword arguments.

All methods return a Python dictionary, equivalent to the JSON output shown in the LibreNMS API documentation.

Any API calls that result in an error will raise librenmsapi.ApiException.

result = client.devices.add_device(hostname='localhost', community='public')
print(result)
# {'count': 1,
# 'devices': [{'agent_uptime': 0,
#              'authalgo': None,
#              'authlevel': None,
#              'authname': None,
#              'authpass': None,
#              ...
#              'transport': 'udp',
#              'type': '',
#              'uptime': None,
#              'version': None}],
# 'status': 'ok'}

result = client.devices.get_device('localhost')
print(result)
# {
#    "status": "ok",
#    "devices": [
#        {
#            "device_id": "1",
#            "hostname": "localhost",
#            ...
#            "serial": null,
#            "icon": null
#        }
#    ]
# }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

librenmsapi-0.0.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

librenmsapi-0.0.1-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file librenmsapi-0.0.1.tar.gz.

File metadata

  • Download URL: librenmsapi-0.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for librenmsapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c5ac3f09ecce36d3b7094df0be7fc25d6547f6e51f721f2bbbff73ca5e2ddaf6
MD5 17641b1c999f52e3c193380bee4b09c3
BLAKE2b-256 68a5767cb3292be84e27aa9e2c8d21b5277a948ecb3677c55b7d950f9ec3b625

See more details on using hashes here.

File details

Details for the file librenmsapi-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: librenmsapi-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for librenmsapi-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4710de93003f3d7bacdcef7aea04c37e40d741727ff95023ef0c3e102814dcff
MD5 8bd4033cf2361f9f6c0a5be97afb8818
BLAKE2b-256 e3b49c8c6928e2ff93debb11cfcf1f6927690a1e27b8c8bcf19a139c84014bcc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page