diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:48:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:48:59 +0000 |
commit | d835b2cae8abc71958b69362162e6a70c3d7ef63 (patch) | |
tree | 81052e3d2ce3e1bcda085f73d925e9d6257dec15 /scripts/check-uptime/report.py | |
parent | Initial commit. (diff) | |
download | crmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.tar.xz crmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.zip |
Adding upstream version 4.6.0.upstream/4.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/check-uptime/report.py')
-rwxr-xr-x | scripts/check-uptime/report.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/check-uptime/report.py b/scripts/check-uptime/report.py new file mode 100755 index 0000000..81710c8 --- /dev/null +++ b/scripts/check-uptime/report.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 +import crm_script +show_all = crm_script.is_true(crm_script.param('show_all')) +uptimes = list(crm_script.output(1).items()) +max_uptime = '', 0.0 +for host, uptime in uptimes: + if float(uptime) > max_uptime[1]: + max_uptime = host, float(uptime) +if show_all: + print("Uptimes: %s" % (', '.join("%s: %s" % v for v in uptimes))) +print("Longest uptime is %s seconds on host %s" % (max_uptime[1], max_uptime[0])) |