Comment 2 for bug 1971156

Revision history for this message
Xav Paice (xavpaice) wrote :

in nrpe_helpers.py, the check is initially populated with a time from set_known_reboot_time(), and sent to get_check_reboot_context().

When I created a fresh cluster using the instructions in the bug description, the resulting NRPE check is this:

# System reboot time (sub)
command[check_reboot]=/usr/local/lib/nagios/plugins/check_reboot.py "2022-05-03 05:12:03"

Running that manually:

root@juju-da6b2f-nrpe-0:/etc/nagios/nrpe.d# /usr/local/lib/nagios/plugins/check_reboot.py "2022-05-03 05:12:03"
OK: system is up since 2022-05-03 05:12:03

The action, however, fails:

ubuntu@xavpaice-bastion:~$ juju run-action --wait nrpe/0 run-nrpe-check name=check-reboot
unit-nrpe-0:
  UnitId: nrpe/0
  id: "2"
  results:
    Stderr: |
      usage: check_reboot.py [-h] known_reboot_time
      check_reboot.py: error: argument known_reboot_time: time must be in format yyyy-mm-dd HH:MM:SS, same as output from `uptime --since`.
    check-output: ""
  status: completed
  timing:
    completed: 2022-05-03 06:11:51 +0000 UTC
    enqueued: 2022-05-03 06:11:48 +0000 UTC
    started: 2022-05-03 06:11:51 +0000 UTC

This bug is therefore about the action, not the NRPE check itself.