Skip to main content

Sensu client for python

https://badge.fury.io/py/pysensu-ng.svg https://travis-ci.org/sangoma/pysensu.png?branch=master https://pypip.in/d/pysensu-ng/badge.png

This is a client to interact with the Sensu API

Features

  • Includes methods for some entrypoints (clients, events, checks, stashes) of the Sensu API (0.24) IMPORTANT: from 0.6.0 release we are supporting Sensu API 0.24+ .. backward compatibility with previous versions of Sensu API might be broken.

  • Includes methods for handle subscriptions info (nodes subscribed to a specific channel)

Trivial Example

from pysensu.api import SensuAPI

url = 'http://localhost:4567'
my_sensu = SensuAPI(url, username=username, password=password)
print(my_sensu.get_info())

DEBUG

To enable debug import logging module and set the debug level

import logging
logging.getLogger('pysensu.api').setLevel(logging.DEBUG)

Exceptions

You can handle an exception using a code like this. Note: Sensu API give you a 404 code if a client does not exists.

import pysensu.api

url = 'http://localhost:4567'
my_sensu = pysensu.api.SensuAPI(url)
client = "testclient"

try:
    print(my_sensu.get_client_data(client))
except pysensu.api.SensuAPIException as e:
    if "404" in str(e):
        print("{} does not exists on sensu api".format(client))
    else:
        raise e

Documentation

The full documentation is at http://pysensu.rtfd.org.

History

0.13.0 (2019-07-23)

0.10.0 (2017-05-17)

  • Add support for results API

0.9.0 (2017-03-13)

  • Add support for silenced API

0.8.0 (2016-11-28)

  • Added operations for Aggregates and Status (Health/Info)

  • Added support for optional limit/offset parameters to get_clients

  • Modified post_check_request to work properly with subscribers.

0.7.0 (2016-08-17)

  • Fix adding stashes

0.6.0 (2016-08-02)

  • Fix calls to Sensu API entrypoints in order to make them compatible with lastest version of Sensu API (0.24) previous versions of Sensu API might not behave as expected.

0.1.0 (2015-12-15)

  • First release on PyPI.

Metadata

Release files for pysensu-ng 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysensu-ng 0.13.0
File Size Uploaded Provenance Actions
pysensu-ng-0.13.0.tar.gz 7.2 kB Without provenance Details for pysensu-ng-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysensu-ng 0.13.0
File Interpreter ABI Platform Actions
pysensu_ng-0.13.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for pysensu_ng-0.13.0-py2.py3-none-any.whl

Total release size: 13.4 kB

Release files / pysensu-ng-0.13.0.tar.gz

Download URL pysensu-ng-0.13.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c423a625a87e585cbfb3f177b3ab7e197b11553c9b344316434c091f7b906a90
BLAKE2b-256 checksum
How to use checksums
f5a15f0e9fbb3672ea62cdd05d138b4470d8d88bee57fbf9cde056e64e6ed13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Release files / pysensu_ng-0.13.0-py2.py3-none-any.whl

Download URL pysensu_ng-0.13.0-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6f5bf8eedbcd76820ac66a3c386dafb3cb439e3c5a447f5d41f5d8ddd156bc83
BLAKE2b-256 checksum
How to use checksums
11fea13ed223744b0ecb6206b4e718307d90af828e65cc01a32259c78e4d6bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Security for pysensu-ng 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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