Skip to main content

PyPI - Python Version PyPI Downloads GitHub contributors

akips

This akips module provides a simple way for python scripts to interact with the AKiPS Network Monitoring Software API interface.

Installation

To install akips, simply use pip:

pip install akips

AKiPS Setup

AKiPS includes a way to extend the server through custom perl scripts. They publish a list from their Support - Site scripts page, along with install instructions.

This module can use additional routines included in the akips_setup directory of this repository, site_scripting.pl.

Usage Examples

Connect to AKiPS

import pprint
from akips import AKIPS

api = AKIPS('akips.example.com',username='api-ro',password='something')

List all devices (with an optional group filter)

devices = api.get_devices(groups=['a10'])
pprint.pp(devices, sort_dicts=True, width=120, indent=4)

The above code will output the text below.

{   'TH840-A': {   'SNMPv2-MIB.sysDescr': 'Thunder Series Unified Application Service Gateway TH840 ACOS',
                   'SNMPv2-MIB.sysLocation': 'Datacenter A',
                   'SNMPv2-MIB.sysName': 'TH840-A',
                   'ip4addr': '192.168.20.15'},
    'TH840-B': {   'SNMPv2-MIB.sysDescr': 'Thunder Series Unified Application Service Gateway TH840 ACOS',
                   'SNMPv2-MIB.sysLocation': 'Datacenter B',
                   'SNMPv2-MIB.sysName': 'TH840-B',
                   'ip4addr': '192.168.30.25'}}

List all data for a specific device

device = api.get_device('TH840-A')
pprint.pp(device, sort_dicts=True, width=120, indent=4)

Lookup the AKiPS device key for a specific IP address

device_key = api.get_device_by_ip(ipaddr='192.168.20.15')
pprint.pp(device_key, sort_dicts=True, width=120, indent=4)

The above code will return the key used by AKiPS for the device with this IP.

'TH840-A'

Get attributes for a specific device and child

attributes = api.get_attributes(device="TH840-A", child="sys")
pprint.pp(attributes, sort_dicts=True, width=120, indent=4)

The above code will return the key used by AKiPS for the device with this IP.

{   'TH840-A': {   'sys': {   'SNMP.community': 'private',
                              'SNMP.discover_oids': '2440',
                              'SNMP.discover_runtime': '0',
                              'SNMP.discover_tt': '1759478985',
                              'SNMP.discover_walks': '57',
                              'SNMP.discover_walks_fail': '0',
                              'SNMP.discover_walks_ok': '57',
                              'SNMP.discover_walks_unknown': '0',
                              'SNMP.ipaddr': '192.168.20.15',
                              'SNMP.lost': '1',
                              'SNMP.maxrep': '20',
                              'SNMP.rtt': '1',
                              'SNMP.rx': '1',
                              'SNMP.snmpState': '2,up,1581605551,1706545348,',
                              'SNMP.tx': '1',
                              'SNMP.version': '2',
                              'SNMPv2-MIB.sysContact': 'Networking',
                              'SNMPv2-MIB.sysDescr': 'Thunder Series Unified Application Service Gateway TH840 ACOS',
                              'SNMPv2-MIB.sysLocation': 'Datacenter A',
                              'SNMPv2-MIB.sysName': 'TH840-A',
                              'SNMPv2-MIB.sysObjectID': 'A10-COMMON-MIB.a10AX.38',
                              'SNMPv2-MIB.sysUpTime': '1749494858,1759502716',
                              'ifXTable': '1',
                              'ip4addr': '192.168.20.15',
                              'mac_md5': 'a34558cd34432f618f5b29fb4376b5a2'}}}

Get a specific attribute over all devices (with optional group filter)

attributes = api.get_attributes(attribute='SNMPv2-MIB.sysUpTime',groups=['a10'])
pprint.pp(attributes, sort_dicts=True, width=120, indent=4)

The above code will return the following data.

{   'TH840-A': {'sys': {'SNMPv2-MIB.sysUpTime': '1749494858,1759502176'}},
    'TH840-B': {'sys': {'SNMPv2-MIB.sysUpTime': '1738681335,1759502177'}}}

Get list of devices in a specific group

group_list = api.get_group_membership(groups=["a10"])
pprint.pp(group_list, sort_dicts=True, width=120, indent=4)

The above code will return the following data.

{   'TH840-A': ['A10', 'admin', 'Core-Routers', 'Not-Core', 'OpsCenter', 'Ungrouped', 'user '],
    'TH840-B': ['A10', 'admin', 'Core-Routers', 'Not-Core', 'OpsCenter', 'Ungrouped', 'user ']}

Get list of groups for a specific device

group_list = api.get_group_membership(device="TH840-A")
pprint.pp(group_list, sort_dicts=True, width=120, indent=4)

The above code will return the following data.

{'TH840-A': ['A10', 'admin', 'Core-Routers', 'Not-Core', 'OpsCenter', 'Ungrouped', 'user ']}

API Errors

An AkipsError exception will be thrown if the AKiPS API responds with an error message. The output below was generated by providing an invalid password and making a call.

api = AKIPS('server' ,username='api-ro', password='badpassword')
device = api.get_device('TH840-A')
% ./akips_test.py
Web API request failed: ERROR: api-db invalid username/password

Traceback (most recent call last):
  File "/Users/test/project/akips_test/./akips_test.py", line 25, in <module>
    device = api.get_device('TH840-A')
  File "/Users/test/project/akips_test/venv/lib/python3.10/site-packages/akips/__init__.py", line 93, in get_device
    text = self._get(params=params)
  File "/Users/test/project/akips_test/venv/lib/python3.10/site-packages/akips/__init__.py", line 502, in _get
    raise AkipsError(message=r.text)
akips.exceptions.AkipsError: ERROR: api-db invalid username/password

API Documentation

API Documentation

Contributing

CONTRIBUTING.md

Bugs/Requests

Please use the GitHub issue tracker to submit bugs or request features.

Download files

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

Source Distribution

akips-0.6.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

akips-0.6.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file akips-0.6.0.tar.gz.

File metadata

  • Download URL: akips-0.6.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for akips-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d168ee2c98a162e8eba1082d8a89f1d88b387cd8370d1db8a8d37231afa2dd6b
MD5 50e00404929e66568406899deab55a91
BLAKE2b-256 51dae5cfb7909f04c4f60ddb0fab409f2688b0153ca67b16a9ac223c37ea3d4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for akips-0.6.0.tar.gz:

Publisher: release.yml on unc-network/akips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file akips-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: akips-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for akips-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b574ff3353bab4414215bfe85c8ea06f6ddd9b496b8974df7ceb68454636f55
MD5 d83209573775345febbd41372911bf1e
BLAKE2b-256 4c2713b12a756a5af24b9f1bcf0dcbcc414beff06f3f52ee5176325085df8eb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for akips-0.6.0-py3-none-any.whl:

Publisher: release.yml on unc-network/akips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

This release

0.6.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page