Skip to main content

PyOpsview 🐍

Python REST API Client for Opsview!

Opsview Logo

Installation

Installing Dependencies

# Using `pip`
pip install -r https://raw.githubusercontent.com/jpgxs/pyopsview/master/requirements.txt

# Using `apt`
apt update && apt install python-requests python-six

# Using `apt-get`
apt-get update && apt-get install python-requests python-six

# Using `yum`
yum install python-requests python-six

# Using `dnf`
dnf install python-requests python-six

# Using `urpmi`
urpmi python-requests python-six

Installing

# From `pypi`
pip install pyopsview

# From source
git clone https://github.com/jpgxs/pyopsview
cd pyopsview
python setup.py install

Usage

Basic Usage

from __future__ import print_function

from pyopsview import OpsviewClient
from pyopsview.exceptions import OpsviewClientException

# Authenticate the client and load the appropriate API schema for the
# specific Opsview version
client = OpsviewClient(username='admin', password='initial',
                       endpoint='https://opsview.example.com')

# Create a new client using the token; this is useful for things like ansible
# where the login operation would otherwise have to be done for every operation
auth_token = client.token
client = OpsviewClient(username='admin', token=auth_token,
                       endpoint='https://opsview.example.com')

# Get a list of the configured hosts. This returns a generator.
all_hosts = client.config.hosts.list()
for host in all_hosts:
    print(host['check_interval'])

# Find all hosts monitored by the master monitoring server.
monitored_by_master = client.config.hosts.find(monitored_by='Master Monitoring Server')

# Update the address of one host
update_host = all_hosts[-1]
update_host['address'] = '127.128.129.130'
update_host = client.config.hosts.update(update_host['id'], **update_host)

# Find the Master opsview server
opsview_master = client.config.hosts.find_one(name='Opsview')
if opsview_master is None:
    raise RuntimeError('Failed to find the Opsview master server!')

# Get a list of all Service Checks on the Opsview master
master_service_checks = []
master_service_checks += opsview_master['service_checks']

for template in opsview_master['host_templates']:
    template_detail = client.hosttemplates.find_one(template['name'])
    master_service_checks += template_detail['service_checks']

TODO

  • Add schemas for other versions of Opsview
  • Add API operations for:
    • Downtime
    • Service/Host Status
    • Live Object Information (Runtime)
    • Acknowledgements
    • Scheduling Rechecks
    • Graphing Data
    • Event/History Data
    • Notes
    • SNMP queries

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Metadata

Release files for pyopsview 6.2.3

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

Source distribution (sdist)

Source distribution for pyopsview 6.2.3
File Size Uploaded Provenance Actions
pyopsview-6.2.3.tar.gz 37.2 kB Without provenance Details for pyopsview-6.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyopsview 6.2.3
File Interpreter ABI Platform Actions
pyopsview-6.2.3-py3-none-any.whl Python 3 none any Details for pyopsview-6.2.3-py3-none-any.whl

Total release size: 108.7 kB

Release files / pyopsview-6.2.3.tar.gz

Download URL pyopsview-6.2.3.tar.gz
Size 37.2 kB
Tags Source
SHA-256 checksum
How to use checksums
da96d355d6c26feabc1644d742c96c465cd3b0a6bd43be5b16c96e70eba33389
BLAKE2b-256 checksum
How to use checksums
85aab76c97d07fb6ff80e02cba406031481f4ed5902f1b7b473daefb48c91a99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

Release files / pyopsview-6.2.3-py3-none-any.whl

Download URL pyopsview-6.2.3-py3-none-any.whl
Size 71.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc68eca6e38adbf66e36b51cf5ff96d57927717762b69fcc1ec2ec8f8f872fa3
BLAKE2b-256 checksum
How to use checksums
78539d6baa825e523419b082fa82675d7cf455861d8d79225a5cbf895daa9bbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

Security for pyopsview 6.2.3

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