Skip to main content
https://readthedocs.org/projects/urconf/badge/?version=latest https://travis-ci.org/knyar/urconf.svg?branch=master https://coveralls.io/repos/knyar/urconf/badge.svg?branch=master&service=github

Declarative configuration library for Uptime Robot

urconf is a Python library for Uptime Robot <https://uptimerobot.com/> API. It expects definition of all your contacts and monitors, and then issues API calls required to configure your Uptime Robot accordingly.

Usage

Install urconf using pip: pip install urconf

Write your monitoring configuration as a Python script:

import logging
import urconf

# urconf logs all operations that change configuration at the INFO level.
# Use DEBUG to see API call contents.
logging.basicConfig(level=logging.INFO)

config = urconf.UptimeRobot("api-key")  # dry_run=True enables dry mode

# Define contacts
email = config.email_contact("me@example.com")
boxcar = config.boxcar_contact("boxcar-api-key", "my boxcar")

# Define monitors
ssh = config.port_monitor("ssh on server1", "server1.example.com", 22)
web = config.keyword_monitor(
    "my site", "https://example.com/", "welcome to example.com!")
# More complex example with HTTP auth and non-standard monitoring interval
backend = config.keyword_monitor(
    "my backend", "https://admin.example.com", "Cannot connect to database",
    should_exist=False, http_username="admin", http_password="password",
    interval=20)

# Associate contacts with monitors
for monitor in (ssh, web, backend):
    monitor.add_contacts(email, boxcar)

# Sync configuration to Uptime Robot
config.sync()

Run the script to sync configuration.

Functionality

Currently implemented:

  • SMS, email, Twitter DM, Boxcar, Webhook, Pushbullet and Pushover contacts;

  • keyword and port monitors.

Pull requests extending supported types of contacts or monitors are very welcome.

If you need to use contact types which are not supported by the newAlertContact method of Uptime Robot API (for example, HipChat or Slack), you can create the contact manually in the web UI, define it in your configuration file by calling the UptimeRobot.contact() method directly and then use that contact in add_contacts normally:

config = urconf.UptimeRobot("api-key")
hipchat = config.contact(type=10, value="123", friendly_name="Hipchat")
config.port_monitor("ssh1", "ssh1.example.com", 22).add_contacts(hipchat)

Development notes

  • refer to API documentation <https://uptimerobot.com/api> while implementing additional functionality;

  • run tox to run the tests in Python 2.7 and 3.4 environments;

  • run make html in docs/ to build documentation in HTML. It can be viewed in docs/_build/html/ afterwards.

License

urconf is licensed under the MIT license.

Release files for urconf 2021.1

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

Source distribution (sdist)

Source distribution for urconf 2021.1
File Size Uploaded
urconf-2021.1.tar.gz 12.1 kB Details

Release files / urconf-2021.1.tar.gz

Download URL urconf-2021.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
30a0198aa6cbd69d6af0f30d796eb174db3ad53183126181468d847e2ad21f35
BLAKE2b-256 checksum
How to use checksums
e83df677c07b4bb7f6479333ec5a55387d2ff4461e30f219f648e9d708ae978a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

Release history Release notifications | RSS feed

This release

2021.1 This release

1 release file

2016.5

1 release file

2016.4

1 release file

2016.3

1 release file

2016.2

1 release file

2016.1

1 release file

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