File: report.py

package info (click to toggle)
crmsh 5.0.0~rc2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,792 kB
  • sloc: python: 50,329; sh: 1,207; makefile: 254; xml: 243; exp: 234; awk: 22
file content (11 lines) | stat: -rwxr-xr-x 436 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
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]))