Skip to main content

A library for interacting/scrapping Icinga 1 CGI endpoints

Project description

License PyPI Downloads PyPI Version Build Status Coverage Status

A library for interacting/scrapping Icinga 1 CGI endpoints.

Full Documentation can be found at: https://icingapy.readthedocs.io/

How to setup the client:

>>> from icingapy import IcingaClient
icinga = IcingaClient('icinga.host.com', 'admin', 'Ch@ng3m3!')

Icinga Client currently support three methods. summary, status, downtime

summary

queries the status.cgi endpoint and parses the table for a list of services, their status and info.

>>> icinga.summary('testhost')
{'Current Load': {'service': 'Current Load', 'status': 'OK', 'info': 'OK - load average: 0.38, 0.33, 0.31'},
'Current Users': {'service': 'Current Users', 'status': 'OK', 'info': 'USERS OK - 0 users currently logged in'},
'Disk Space': {'service': 'Disk Space', 'info': 'DISK CRITICAL - free space: / 1423 MB (10% inode=53%): '},
'HTTP': {'service': 'HTTP', 'status': 'OK', 'info': 'HTTP OK: HTTP/1.1 301 Moved Permanently - 529 bytes in 0.000 second response time'},
'SSH': {'service': 'SSH', 'info': 'connect to address 127.0.0.1 and port 22: Connection refused'},
'Total Processes': {'service': 'Total Processes', 'status': 'OK', 'info': 'PROCS OK: 12 processes'}}
status

queries the extinfo.cgi endpoint and parses the table to pull the same information (with the addition of last-check) as summary but for a single service

>>> icinga.status('testhost', 'Current Load')
{'service': 'Current Load',
'state': '  OK   (for  0d  1h 50m 10s)',
'info': 'OK - load average: 0.38, 0.33, 0.31',
'last-check': '2018-09-29 17:22:07'}
downtime

queries the cmd.cgi endpoint to post a downtime for a particular host or service host. Returns True/False. service, expire_timedate, and msg are optional. Method defaults to a timedate of 1 hour. expire_timedate expects a dictionary with keys matching datetime.timedelta parameters.

>>> icinga.downtime(host='localhost', service='Disk Space', expire_timedate={'hours': 1}, msg='until logrotate'))
True

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

icingapy-0.1.2.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

icingapy-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file icingapy-0.1.2.tar.gz.

File metadata

  • Download URL: icingapy-0.1.2.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for icingapy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 067805d384043625f8a4c40b97ae424dad737401fde73846374244320b9fdbe8
MD5 e01e6b5f29b95b661070cabd88b7afb8
BLAKE2b-256 a5b49f4c8cb9e828b701c906aa62dcd673a1a21c56b9cfa619d0d9a1c7959dea

See more details on using hashes here.

File details

Details for the file icingapy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: icingapy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for icingapy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47037fcb1d715207f2fab90ca426cd4ee6cbf4a7a9225eba1b329f206496fb5e
MD5 19664bf170335354e21f2fe7999a3568
BLAKE2b-256 6b6355c11e8b540d669123e8b4da79a960ef03b411b5c242f0e5408ffe3ffba3

See more details on using hashes here.

Supported by

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