diff --git a/system_status/server.py b/system_status/server.py index 49a24c5..26937aa 100644 --- a/system_status/server.py +++ b/system_status/server.py @@ -125,7 +125,8 @@ def get_prometheus_data() -> list[PrometheusData]: timestamps_and_values = [] for epoch_time, value in maybe_values: - timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(epoch_time)) + pacific_dt = datetime.datetime.fromtimestamp(epoch_time, tz=ZoneInfo("America/Los_Angeles")) + timestamp = pacific_dt.strftime("%Y-%m-%d %H:%M:%S") timestamps_and_values.append(TimestampAndValuePair(timestamp, value)) # the service is up if the maximum timestamp's value is "1" diff --git a/system_status/templates/my_template.html b/system_status/templates/my_template.html index 44a2049..b07e716 100644 --- a/system_status/templates/my_template.html +++ b/system_status/templates/my_template.html @@ -3,189 +3,467 @@ + SCE Service Status -
- -

How are our services doing ???

-

Current Time:

-

Fetch Time: {{ fetch_time }}

+ +
+ +
+

How are our services doing ???

+
+
+
+
Data fetched: {{ fetch_time }}
+
+ +
+
+
Total Services
+
0
+
+
+
Up
+
0
+
+
+
Down
+
0
+
+
-
-
- - - - - - - - - {% for item in data %} - {% set job = item.job %} - - {% if item.is_up %} - {% set status = "✅ UP" %} - {% else %} - {% set status = "❌ DOWN" %} - {% endif %} - {% set detail = item.instance %} - - - {# This TD is for the "Status" column #} - - {# THIS IS THE CORRECTED SECTION for the EMOJI HISTORY #} - +
✅ Up | ❌ Down | ⚠️ No Data
Job NameStatusDetail -
Prev. Day
-
◀➖➖➖➖➖➖➖➖
-
History of past 24 Hours
-
➖➖➖➖➖➖➖➖▶
-
Now
-
{{ job }}{{ status }}{{ detail }} - {% for value in item.values %} - {% if value.value == "1" %} - ✅ - {% else %} - ❌ - {% endif %} - {# the below if-statement adds a vertical line for every four entries #} - {% if (not loop.index % 4) and loop.index < 24%} - | - {% endif %} + +
+
+ + + + + + + + + + + {% for item in data %} + + + + + + {% endfor %} - - {# END OF CORRECTED SECTION #} - - {# The original template had an unclosed - {% endfor %} -
ServiceStatusInstancePrev. Day ◀➖➖➖➖➖➖➖➖ History of past 24 Hours ➖➖➖➖➖➖➖➖▶ Now
{{ item.job }} + {% if item.is_up %} + UP + {% else %} + Down + {% endif %} + {{ item.instance }} +
+ {% for value in item.values %} + {% if value.value == "1" %} +
+ {% else %} +
+ {% endif %} + {% if loop.index0 % 6 == 5 and not loop.last %} +
+ {% endif %} + {% endfor %} +
+
and then {% endfor %}. - You also need to make sure you have enough elements - to match your headers. - Based on your s: Job Name, Status, Detail, History. - You only had 2 s initially. - #} -
+
+
+
+
Up
+
Down
+
No Data
+
-
+