summaryrefslogtreecommitdiffhomepage
path: root/prober/status.html
blob: d26588da1943140b0ab4d036a00564f38336edbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{{define "status"}}
<html>
    <head><title>{{.Title}}</title></head>
    <style>
        body {
            /* max-width: 60rem; */
            margin-left: auto;
            margin-right: auto;
            padding: 3rem 1rem 8rem;
            line-height: 1.4;
            font-size: 1rem;
            font-weight: 400;
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
            text-rendering: optimizeLegibility;
        }
        .small {
            font-size: 0.7rem;
        }
        h1 {
            font-weight: 500;
            letter-spacing: -.025em;
        }
        a { color: rgb(74 125 221); }
        a:hover { color: rgb(73 100 149); }
        ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }
        ul>li::before {
            position: absolute;
            top: .625rem;
            left: .125rem;
            height: .375rem;
            width: .375rem;
            border-radius: 9999px;
            background-color: currentColor;
            opacity: .4;
            content: "";
        }
        ul>li {
            position: relative;
            padding-left: 1.25rem;
        }
        th, td {
            padding: 5px;
            text-align: left;
            background: #eeeeee;
        }
        .error {
            color: red;
        }
    </style>
<body>
    <h1>{{.Title}}</h1>
    <ul>
        <li>Prober Status:
        {{if .UnhealthyProbes }}
            <span class="error">{{.UnhealthyProbes}}</span>
            out of {{.TotalProbes}} probes failed or never ran.
        {{else}}
            All {{.TotalProbes}} probes are healthy
        {{end}}
        </li>
        {{ range $text, $url := .Links }}
        <li><a href="{{$url}}">{{$text}}</a></li>
        {{end}}
    </ul>

    <h1>Probes:</h1>
    <table class="sortable">
        <thead><tr>
            <th>Name</th>
            <th>Probe Class & Labels</th>
            <th>Interval</th>
            <th>Last Finished</th>
            <th>Last Started</th>
            <th>Status</th>
            <th>Latency</th>
            <th>Last Error</th>
        </tr></thead>
        <tbody>
        {{range $name, $probeInfo := .Probes}}
        <tr>
            <td>
                {{$name}}
                {{range $text, $url := $probeInfo.Links}}
                <br/>
                {{if not $probeInfo.Continuous}}
                    <button onclick="location.href='{{$url}}';" type="button">
                        {{$text}}
                    </button>
                {{end}}
                {{end}}
            </td>
            <td>{{$probeInfo.Class}}<br/>
                <div class="small">
                {{range $label, $value := $probeInfo.Labels}}
                    {{$label}}={{$value}}<br/>
                {{end}}
                </div>
            </td>
            <td>
                {{if $probeInfo.Continuous}}
                    Continuous
                {{else}}
                    {{$probeInfo.Interval}}
                {{end}}
            </td>
            <td data-sort="{{$probeInfo.TimeSinceLastEnd.Milliseconds}}">
                {{if $probeInfo.TimeSinceLastEnd}}
                    {{$probeInfo.TimeSinceLastEnd.String}} ago<br/>
                    <span class="small">{{$probeInfo.End.Format "2006-01-02T15:04:05Z07:00"}}</span>
                {{else}}
                    Never
                {{end}}
            </td>
            <td data-sort="{{$probeInfo.TimeSinceLastStart.Milliseconds}}">
                {{if $probeInfo.TimeSinceLastStart}}
                    {{$probeInfo.TimeSinceLastStart.String}} ago<br/>
                    <span class="small">{{$probeInfo.Start.Format "2006-01-02T15:04:05Z07:00"}}</span>
                {{else}}
                    Never
                {{end}}
            </td>
            <td>
                {{if $probeInfo.Error}}
                    <span class="error">{{$probeInfo.Status}}</span>
                {{else}}
                    {{$probeInfo.Status}}
                {{end}}<br/>
                {{if not $probeInfo.Continuous}}
                    <div class="small">Recent: {{$probeInfo.RecentResults}}</div>
                    <div class="small">Mean: {{$probeInfo.RecentSuccessRatio}}</div>
                {{end}}
            </td>
            <td data-sort="{{$probeInfo.Latency.Milliseconds}}">
                {{if $probeInfo.Continuous}}
                    n/a
                {{else}}
                    {{$probeInfo.Latency.String}}
                    <div class="small">Recent: {{$probeInfo.RecentLatencies}}</div>
                    <div class="small">Median: {{$probeInfo.RecentMedianLatency}}</div>
                {{end}}
            </td>
            <td class="small">{{$probeInfo.Error}}</td>
        </tr>
        {{end}}
        </tbody>
    </table>
    <link href="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable-base.min.css" rel="stylesheet" />
    <script src="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable.min.js"></script>
</body>
</html>
{{end}}