utr is a CLI tool for UptimeRobot. Unlike other tools, it enables you to manage monitors, maintenance windows, alert contacts and status pages based on status, in a manner similar to Ansible. The desired configuration is defined in YAML files, and utr ensures that the actual state automatically corresponds to the desired state in an idempotent manner.
All you need is Python 3 and a valid UptimeRobot API key. This can be entered either directly using the --api_key option, or via a file (the default is ~/.uptimerobot). You can install the tool using pip install --user uptimerobot-cli. Typing utr --help displays all available commands and options.
It was developed in the Linuxfabrik, is open source, and is licensed under the UNLICENSE. Further details and documentation can be found at github.com/linuxfabrik.
Define monitors, maintenance windows (MWindows) and alarm contacts in one or more YAML files. Example:
mwindows:
  - type: 'weekly'
    value: 'wed'
    start_time: '03:30'
    end_time: '05:30'
    status: 'active'
    state: 'present'
monitors:
  - prefix: 'prod'
    url: 'https://www.example.com/'
    interval: 30
    http_method: 'get'
    type: 'keyw'
    keyword_type: 'notex'
    keyword_case_type: 'ci'
    keyword_value: 'Example Inc.'
    mwindows:
      - friendly_name: 'weekly wed 03:30-05:30'
    state: 'present'Further details on the YAML syntax can be found in the project's YAML documentation.
Use the apply function to apply the YAML definition to UptimeRobot:
utr apply config.ymlIn UptimeRobot, create, update and delete actions are performed idempotently to achieve the desired state.
For quick queries or bulk updates that don't require YAML, the get and set commands are available. Examples:
utr get accountutr get monitors --output=tableutr set monitors --search=example --status=pausedThis allows you to manage individual resources quickly and easily.