linuxfabrik.lfops.uptimerobot_account_info¶
Read UptimeRobot account details
Synopsis¶
- Calls
getAccountDetailson the UptimeRobot v2 API and returns the resulting account record (email, monitor limit, current up/down/paused counters, subscription expiry date, ...). - Read-only; the module always reports
changed=falseand is safe to run in check mode.
Available since LFOps 6.0.2.
Optional Parameters¶
api_key
- UptimeRobot API key. When unset, the module reads api_key_file (default
~/.uptimerobot) and finally falls back to theUPTIMEROBOT_API_KEYenvironment variable. - Type: String.
api_key_file
- Path to a file whose first line is the UptimeRobot API key. Tilde-expanded.
- Type: String.
- Default:
~/.uptimerobot
Examples¶
# 1) Read account quota and current usage. The API key comes from
# ~/.uptimerobot when no parameter is given.
- name: 'Capture UptimeRobot account info'
linuxfabrik.lfops.uptimerobot_account_info:
register: 'ur_account'
- ansible.builtin.debug:
msg: >-
{{ ur_account.account.up_monitors }}/{{ ur_account.account.monitor_limit }}
monitors used; subscription expires
{{ ur_account.account.subscription_expiry_date }}
# 2) Same call but with an explicit key file (any reachable path is fine).
- linuxfabrik.lfops.uptimerobot_account_info:
api_key_file: '/etc/ansible/secrets/uptimerobot.key'
register: 'ur_account'
# 3) Fail the play early if the account is over 90% of its monitor quota.
- linuxfabrik.lfops.uptimerobot_account_info:
register: 'ur_account'
- ansible.builtin.assert:
that: 'ur_account.account.up_monitors / ur_account.account.monitor_limit < 0.9'
fail_msg: 'UptimeRobot quota is nearly exhausted; bump the plan or delete stale monitors.'
Return Values¶
account
- Account details as returned by
getAccountDetails. - Type: Dictionary.
- Returned: always.
-
Sample:
yaml down_monitors: 0 email: user@example.com monitor_interval: 60 monitor_limit: 50 paused_monitors: 0 up_monitors: 10
debug
- Diagnostic information about the API call. Stable enough to assert against, not stable enough to be load-bearing.
- Type: Dictionary.
- Returned: always.
-
Sample:
yaml fields: - down_monitors - email - monitor_interval - monitor_limit - paused_monitors - up_monitors operation: read
Authors¶
- Linuxfabrik GmbH, Zurich, Switzerland (info (at) linuxfabrik (dot) ch)