From f3db579a66d4a3444d0855d6424a310b3438762e Mon Sep 17 00:00:00 2001 From: Yannik Enss Date: Sat, 10 Apr 2021 19:52:00 +0200 Subject: [PATCH] allow specifying host order --- README.md | 1 + service.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 958de8c..2b61f75 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,5 @@ PROCESS = "" [output] filename = "index.html" +host_order = [ "host1", "host2", "host4" ] ``` diff --git a/service.py b/service.py index 19aea1f..e5b424c 100755 --- a/service.py +++ b/service.py @@ -91,6 +91,13 @@ class StatusPage: host_names.add(service['attrs']['host_name']) # render html for each host_name 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): html_output = html_output + self.render_services_per_host(host) return html_output