about summary refs log tree commit diff
path: root/bundles/prometheus/files/consoles/node.html
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/prometheus/files/consoles/node.html')
-rw-r--r--bundles/prometheus/files/consoles/node.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/bundles/prometheus/files/consoles/node.html b/bundles/prometheus/files/consoles/node.html
new file mode 100644
index 0000000..9ef79ce
--- /dev/null
+++ b/bundles/prometheus/files/consoles/node.html
@@ -0,0 +1,133 @@
+{{/* vim: set ft=gotmpl: */}}
+
+{{ template "head" . }}
+
+{{ template "prom_content_head" . }}
+<div class="prom_content_div">
+  <div style="columns:2;">
+    <h1 style="margin-bottom:10px;">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
+    <table class="table">
+      <thead class="thead-dark">
+        <tr><th colspan="2">Overview</th></tr>
+      </thead>
+      <tbody>
+        <tr>
+          <td>User CPU</td>
+          <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(node_cpu_seconds_total{job='node-exporter',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(node_cpu_seconds_total{job='node-exporter',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
+        </tr>
+        <tr>
+          <td>System CPU</td>
+          <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(node_cpu_seconds_total{job='node-exporter',instance='%s',mode='system'}[5m])) * 100 / count(count by (cpu)(node_cpu_seconds_total{job='node-exporter',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }}</td>
+        </tr>
+        <tr>
+          <td>Memory Total</td>
+          <td>{{ template "prom_query_drilldown" (args (printf "node_memory_MemTotal_bytes{job='node-exporter',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
+        </tr>
+        <tr>
+          <td>Memory Free</td>
+          <td>{{ template "prom_query_drilldown" (args (printf "node_memory_MemFree_bytes{job='node-exporter',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
+        </tr>
+      </tbody>
+    </table>
+    <table class="table">
+      <tr><th colspan="2">Network</th></tr>
+      {{ range printf "node_network_receive_bytes_total{job='node-exporter',instance='%s',device!='lo'}" .Params.instance | query | sortByLabel "device" }}
+      <tr>
+        <td>{{ .Labels.device }} Received</td>
+        <td>{{ template "prom_query_drilldown" (args (printf "irate(node_network_receive_bytes_total{job='node-exporter',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
+      </tr>
+      <tr>
+        <td>{{ .Labels.device }} Transmitted</td>
+        <td>{{ template "prom_query_drilldown" (args (printf "irate(node_network_transmit_bytes_total{job='node-exporter',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
+      </tr>
+      {{ end }}
+    </table>
+    <table class="table">
+      <tr><th colspan="2">Disks</th></tr>
+      {{ range printf "node_disk_io_time_seconds_total{job='node-exporter',instance='%s',device!~'^(md\\\\d+$|dm-)'}" .Params.instance | query | sortByLabel "device" }}
+      <tr>
+        <td>{{ .Labels.device }} Utilization</td>
+        <td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_io_time_seconds_total{job='node-exporter',instance='%s',device='%s'}[5m]) * 100" .Labels.instance .Labels.device) "%" "printf.1f") }}</td>
+      </tr>
+      {{ end }}
+      {{ range printf "node_disk_io_time_seconds_total{job='node-exporter',instance='%s'}" .Params.instance | query | sortByLabel "device" }}
+      <tr>
+        <td>{{ .Labels.device }} Throughput</td>
+        <td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_read_bytes_total{job='node-exporter',instance='%s',device='%s'}[5m]) + irate(node_disk_written_bytes_total{job='node-exporter',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
+      </tr>
+      {{ end }}
+    </table>
+    <table class="table">
+      <tr><th colspan="2">Filesystem Fullness</th></tr>
+      {{ define "roughlyNearZero" }}
+      {{ if gt .1 . }}~0{{ else }}{{ printf "%.1f" . }}{{ end }}
+      {{ end }}
+      {{ range printf "node_filesystem_size_bytes{job='node-exporter',instance='%s'}" .Params.instance | query | sortByLabel "mountpoint" }}
+      <tr>
+        <td>{{ .Labels.mountpoint }}</td>
+        <td>{{ template "prom_query_drilldown" (args (printf "100 - node_filesystem_avail_bytes{job='node-exporter',instance='%s',mountpoint='%s'} / node_filesystem_size_bytes{job='node-exporter'} * 100" .Labels.instance .Labels.mountpoint) "%" "roughlyNearZero") }}</td>
+      </tr>
+      {{ end }}
+    </table>
+  </div>
+  <div>
+    <h3>CPU Usage</h3>
+    <div id="cpuGraph"></div>
+    <script>
+      new PromConsole.Graph({
+        node: document.querySelector("#cpuGraph"),
+        expr: [
+          `sum by (mode)(irate(node_cpu_seconds_total{job='node-exporter',instance='{{ .Params.instance }}',mode!='idle',mode!='iowait',mode!='steal'}[5m]))`,
+        ],
+        renderer: 'area',
+        max: {{ with printf "count(count by (cpu)(node_cpu_seconds_total{job='node-exporter',instance='%s'}))" .Params.instance | query }}{{ . | first | value }}{{ else}}undefined{{end}},
+        yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
+        yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
+        yTitle: 'Cores'
+      })
+    </script>
+  </div>
+  <div>
+    <h3>Disk I/O Utilization</h3>
+    <div id="diskioGraph"></div>
+    <script>
+      new PromConsole.Graph({
+        node: document.querySelector("#diskioGraph"),
+        expr: [
+          `irate(node_disk_io_time_seconds_total{job='node-exporter',instance='{{ .Params.instance }}',device!~'^(md\\\\d+$|dm-)'}[5m]) * 100`,
+        ],
+        min: 0,
+        name: '[[ device ]]',
+        yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
+        yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
+        yUnits: "%",
+        yTitle: 'Disk I/O Utilization'
+      })
+    </script>
+  </div>
+  <div>
+    <h3>Memory</h3>
+    <div id="memoryGraph"></div>
+    <script>
+      new PromConsole.Graph({
+        node: document.querySelector("#memoryGraph"),
+        renderer: 'area',
+        expr: [
+          `node_memory_Cached_bytes{job='node-exporter',instance='{{ .Params.instance }}'}`,
+          `node_memory_Buffers_bytes{job='node-exporter',instance='{{ .Params.instance }}'}`,
+          `node_memory_MemTotal_bytes{job='node-exporter',instance='{{ .Params.instance }}'} - node_memory_MemFree_bytes{job='node-exporter',instance='{{.Params.instance}}'} - node_memory_Buffers_bytes{job='node-exporter',instance='{{.Params.instance}}'} - node_memory_Cached_bytes{job='node-exporter',instance='{{.Params.instance}}'}`,
+          `node_memory_MemFree{job='node-exporter',instance='{{ .Params.instance }}'}`,
+        ],
+        name: ["Cached", "Buffers", "Used", "Free"],
+        min: 0,
+        yUnits: "B",
+        yAxisFormatter: PromConsole.NumberFormatter.humanize1024,
+        yHoverFormatter: PromConsole.NumberFormatter.humanize1024,
+        yTitle: 'Memory'
+      })
+    </script>
+  </div>
+</div>
+{{ template "prom_content_tail" . }}
+
+{{ template "tail" . }}