Skip to main content

A Python library to interact with the LibreNMS API (v0)

Project description

LibreNMS handler

PyPI image Black Pylint

A Python library to interact with the LibreNMS API (v0).

The project aims to provide the user with as much information as if they were looking at the reference guide themselves.

Usage

The package is installed via Pip with pip install librenms-handler.

The following statement will initialise the library:

from librenms_handler.devices import Devices

librenms_devices = Devices(
    'https://librenms.example.com',
    'e4ef9234abab59a90628dd3f616a60b4'
)

NOTE: If you are using a self-signed certificate for your server, you can bypass the errors by passing the initialisation option verify=False.

Once done, a list of methods will be available to you such as librenms_handler.list_devices(). Upon operation, the method will execute and return the required request to your LibreNMS instance.

>>> librenms_devices.add_device('test_device', snmp_disable=True, force_add=True)
{'status': 'ok', 'message': 'Device test_device (13) has been added successfully'}
>>> librenms_devices.del_device('test')
{'status': 'ok', 'devices': [{'device_id': 13, 'inserted': '2021-03-13 15:56:19', 'hostname': 'test_device', 'sysName': '', 'ip': None, 'overwrite_ip': None, 'community': '', 'authlevel': None, 'authname': None, 'authpass': None, 'authalgo': None, 'cryptopass': None, 'cryptoalgo': None, 'snmpver': 'v2c', 'port': 161, 'transport': 'udp', 'timeout': None, 'retries': None, 'snmp_disable': 1, 'bgpLocalAs': None, 'sysObjectID': None, 'sysDescr': None, 'sysContact': None, 'version': None, 'hardware': '', 'features': None, 'location_id': None, 'os': 'ping', 'status': True, 'status_reason': '', 'ignore': 0, 'disabled': 0, 'uptime': None, 'agent_uptime': 0, 'last_polled': None, 'last_poll_attempted': None, 'last_polled_timetaken': None, 'last_discovered_timetaken': None, 'last_discovered': None, 'last_ping': None, 'last_ping_timetaken': None, 'purpose': None, 'type': 'server', 'serial': None, 'icon': 'images/os/ping.svg', 'poller_group': 0, 'override_sysLocation': 0, 'notes': None, 'port_association_mode': 1, 'max_depth': 0, 'disable_notify': 0, 'location': None, 'lat': None, 'lng': None, 'attribs': [], 'vrf_lite_cisco': []}], 'message': 'Removed device test_device\n', 'count': 1}

Environment variables

While initialising the handler, the following parameters are required. The handler first checks for the following environment variables, should you choose to use them.

Environment variable Description Type Example
LIBRENMS_URL Full URL to the target LibreNMS instance string https://librenms.example.com
LIBRENMS_TOKEN Token generated from LIBRENMS_URL/api-access string e4ef9234abab59a90628dd3f616a60b4

Endpoints

While I will likely never have reason to fully complete all endpoints, the progress of such is shown below: See Projects to track the progress of the endpoints.

Endpoint Started Done
Alerts False
ARP False
Bills False
Device Groups False
Devices True False
Inventory False
Locations False
Logs False
Port Groups False
Ports False
Routing False
Services False
Switching False
System False

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

librenms-handler-0.1.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

librenms_handler-0.1.3-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file librenms-handler-0.1.3.tar.gz.

File metadata

  • Download URL: librenms-handler-0.1.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for librenms-handler-0.1.3.tar.gz
Algorithm Hash digest
SHA256 050c1b122b6d5305eb173f08a542f348d1c2f2ceed5f534f3867b8722e711a21
MD5 1103fcd60000c10684790756f1a295a1
BLAKE2b-256 48ca1d853e42c6061fe8b550612aa1bc5d9c7863fab890deea96d107ac081da4

See more details on using hashes here.

File details

Details for the file librenms_handler-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: librenms_handler-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for librenms_handler-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3403789d91d4ed17ab5a65d0670617662af350ce8b84aa301de4fa7a8bd530
MD5 c2e4cfb11888e4f18a2aa03c3aa68d34
BLAKE2b-256 58d83c0625513140b2b1367013be412a8af1c5b24ac6f2b008686eff2f616bd6

See more details on using hashes here.

Supported by

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