status.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {{define "status"}}
  2. <html>
  3. <head><title>{{.Title}}</title></head>
  4. <style>
  5. body {
  6. /* max-width: 60rem; */
  7. margin-left: auto;
  8. margin-right: auto;
  9. padding: 3rem 1rem 8rem;
  10. line-height: 1.4;
  11. font-size: 1rem;
  12. font-weight: 400;
  13. 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;
  14. text-rendering: optimizeLegibility;
  15. }
  16. .small {
  17. font-size: 0.7rem;
  18. }
  19. h1 {
  20. font-weight: 500;
  21. letter-spacing: -.025em;
  22. }
  23. a { color: rgb(74 125 221); }
  24. a:hover { color: rgb(73 100 149); }
  25. ul {
  26. list-style: none;
  27. margin: 0;
  28. padding: 0;
  29. }
  30. ul>li::before {
  31. position: absolute;
  32. top: .625rem;
  33. left: .125rem;
  34. height: .375rem;
  35. width: .375rem;
  36. border-radius: 9999px;
  37. background-color: currentColor;
  38. opacity: .4;
  39. content: "";
  40. }
  41. ul>li {
  42. position: relative;
  43. padding-left: 1.25rem;
  44. }
  45. th, td {
  46. padding: 5px;
  47. text-align: left;
  48. background: #eeeeee;
  49. }
  50. .error {
  51. color: red;
  52. }
  53. </style>
  54. <body>
  55. <h1>{{.Title}}</h1>
  56. <ul>
  57. <li>Prober Status:
  58. {{if .UnhealthyProbes }}
  59. <span class="error">{{.UnhealthyProbes}}</span>
  60. out of {{.TotalProbes}} probes failed or never ran.
  61. {{else}}
  62. All {{.TotalProbes}} probes are healthy
  63. {{end}}
  64. </li>
  65. {{ range $text, $url := .Links }}
  66. <li><a href="{{$url}}">{{$text}}</a></li>
  67. {{end}}
  68. </ul>
  69. <h1>Probes:</h1>
  70. <table class="sortable">
  71. <thead><tr>
  72. <th>Name</th>
  73. <th>Probe Class & Labels</th>
  74. <th>Interval</th>
  75. <th>Last Attempt</th>
  76. <th>Success</th>
  77. <th>Latency</th>
  78. <th>Last Error</th>
  79. </tr></thead>
  80. <tbody>
  81. {{range $name, $probeInfo := .Probes}}
  82. <tr>
  83. <td>
  84. {{$name}}
  85. {{range $text, $url := $probeInfo.Links}}
  86. <br/>
  87. <button onclick="location.href='{{$url}}';" type="button">
  88. {{$text}}
  89. </button>
  90. {{end}}
  91. </td>
  92. <td>{{$probeInfo.Class}}<br/>
  93. <div class="small">
  94. {{range $label, $value := $probeInfo.Labels}}
  95. {{$label}}={{$value}}<br/>
  96. {{end}}
  97. </div>
  98. </td>
  99. <td>{{$probeInfo.Interval}}</td>
  100. <td data-sort="{{$probeInfo.TimeSinceLast.Milliseconds}}">
  101. {{if $probeInfo.TimeSinceLast}}
  102. {{$probeInfo.TimeSinceLast.String}} ago<br/>
  103. <span class="small">{{$probeInfo.End.Format "2006-01-02T15:04:05Z07:00"}}</span>
  104. {{else}}
  105. Never
  106. {{end}}
  107. </td>
  108. <td>
  109. {{if $probeInfo.Result}}
  110. {{$probeInfo.Result}}
  111. {{else}}
  112. <span class="error">{{$probeInfo.Result}}</span>
  113. {{end}}<br/>
  114. <div class="small">Recent: {{$probeInfo.RecentResults}}</div>
  115. <div class="small">Mean: {{$probeInfo.RecentSuccessRatio}}</div>
  116. </td>
  117. <td data-sort="{{$probeInfo.Latency.Milliseconds}}">
  118. {{$probeInfo.Latency.String}}
  119. <div class="small">Recent: {{$probeInfo.RecentLatencies}}</div>
  120. <div class="small">Median: {{$probeInfo.RecentMedianLatency}}</div>
  121. </td>
  122. <td class="small">{{$probeInfo.Error}}</td>
  123. </tr>
  124. {{end}}
  125. </tbody>
  126. </table>
  127. <link href="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable-base.min.css" rel="stylesheet" />
  128. <script src="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable.min.js"></script>
  129. </body>
  130. </html>
  131. {{end}}