[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 06/23] wip: incidents and uptime


MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: arf20 <aruizfernandez05@xxxxxxxxx>

---
 README.md      | 10 +++++-----
 index.htm.tmpl | 32 ++++++++++++++++++++++++++++----
 main.c         |  4 +++-
 3 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 6745dbf..456aedf 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,9 @@ make
 
 ## Features (TODO)
 
- - Current service status table
- - Outage events table
- - Uptime counter (total, month)
- - Alerts
- - Centralised config
+ [X] Current service status table
+ [ ] Outage events table
+ [ ] Uptime counter (total, month)
+ [ ] Alerts
+ [ ] Centralised config
 
diff --git a/index.htm.tmpl b/index.htm.tmpl
index e545845..0372cc7 100644
--- a/index.htm.tmpl
+++ b/index.htm.tmpl
@@ -16,6 +16,15 @@ table, th, td {
 .down {
     background-color: red;
 }
+
+.row {
+
+}
+
+.col {
+    float: left;
+    width: 50%;
+}
         </style>
     </head>
 
@@ -27,10 +36,25 @@ table, th, td {
         <main>
             <h2 class="center">Status Monitor</h2>
             <p>This webapp monitors the status of the main ARFNET services from outside the ARFNET network</p>
-            <table>
-                <tr><th>Type</th><th>Service</th><th>Status</th></tr>
-                %s
-            </table>
+            <div class="col">
+                Services
+                <table>
+                    <tr><th>Type</th><th>Service</th><th>Status</th></tr>
+                    %s
+                </table>
+            </div>
+            <div class="col">
+                Uptime
+                <table>
+                    <tr><th>Week %%up</th><th>Month %%up</th><th>Total %%up since %s</th></tr>
+                    <tr><td>%s</td><td>%s</td><td>%s</td></tr>
+                </table>
+                Incidents
+                <table>
+                    <tr><th>Resolved</th><th>Started</th><th>Duration</th></tr>
+                    <tr>%s</tr>
+                </table>
+            </div>
         </main>
     </body>
 </html>
diff --git a/main.c b/main.c
index 15379b3..05925fd 100644
--- a/main.c
+++ b/main.c
@@ -50,7 +50,9 @@ enum MHD_Result answer_to_connection(
 
     if (strcmp(method, "GET") == 0 && strcmp(url, "/") == 0) {
         snprintf(buff, RES_BUFF,
-            index_format_template, monitor_generate_status_html());
+            index_format_template,
+            monitor_generate_status_html(), "(since)", "(week %up)",
+            "(month %up)", "(total %up)", "(incidents)");
 
         response = MHD_create_response_from_buffer(strlen(buff), (void*)buff,
             MHD_RESPMEM_PERSISTENT);
-- 
2.47.3


References:
[arfnet2-status PATCH 00/23] First releasearf20 <arf20@xxxxxxxxx>