allow specifying host order

This commit is contained in:
2021-04-10 19:52:00 +02:00
parent 83534572c2
commit f3db579a66
2 changed files with 8 additions and 0 deletions

View File

@@ -19,4 +19,5 @@ PROCESS = ""
[output] [output]
filename = "index.html" filename = "index.html"
host_order = [ "host1", "host2", "host4" ]
``` ```

View File

@@ -91,6 +91,13 @@ class StatusPage:
host_names.add(service['attrs']['host_name']) host_names.add(service['attrs']['host_name'])
# render html for each host_name # render html for each host_name
html_output = "" html_output = ""
for host in self.config['output']['host_order']:
try:
host_names.remove(host)
except KeyError:
pass
else:
html_output = html_output + self.render_services_per_host(host)
for host in sorted(host_names): for host in sorted(host_names):
html_output = html_output + self.render_services_per_host(host) html_output = html_output + self.render_services_per_host(host)
return html_output return html_output