2014-11-20 18:41:25 +00:00
|
|
|
{{/* vim: set ft=html: */}}
|
|
|
|
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ define "prom_console_head" }}
|
2017-04-05 14:19:17 +00:00
|
|
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
|
2019-05-28 01:31:14 +00:00
|
|
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-4.3.1/css/bootstrap.min.css">
|
2017-04-05 14:19:17 +00:00
|
|
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css">
|
2019-02-07 21:18:09 +00:00
|
|
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css">
|
2017-04-05 14:19:17 +00:00
|
|
|
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
|
|
|
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
|
|
|
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
|
2019-02-07 21:18:09 +00:00
|
|
|
<script src="{{ pathPrefix }}/static/vendor/js/jquery-3.3.1.min.js"></script>
|
|
|
|
<script src="{{ pathPrefix }}/static/vendor/js/popper.min.js"></script>
|
2019-05-28 01:31:14 +00:00
|
|
|
<script src="{{ pathPrefix }}/static/vendor/bootstrap-4.3.1/js/bootstrap.min.js"></script>
|
2015-03-24 21:04:38 +00:00
|
|
|
|
2017-03-03 20:36:06 +00:00
|
|
|
<script>
|
|
|
|
var PATH_PREFIX = "{{ pathPrefix }}";
|
|
|
|
</script>
|
2017-04-05 14:19:17 +00:00
|
|
|
<script src="{{ pathPrefix }}/static/js/prom_console.js"></script>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
|
|
|
{{/* Top of all pages. */}}
|
2019-02-18 13:14:58 +00:00
|
|
|
{{ define "head" -}}
|
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
2014-11-20 18:41:25 +00:00
|
|
|
<head>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ template "prom_console_head" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ template "navbar" . }}
|
2019-02-07 21:18:09 +00:00
|
|
|
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ template "menu" . }}
|
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
|
|
|
{{ define "__prom_query_drilldown_noop" }}{{ . }}{{ end }}
|
|
|
|
{{ define "humanize" }}{{ humanize . }}{{ end }}
|
|
|
|
{{ define "humanizeNoSmallPrefix" }}{{ if and (lt . 1.0) (gt . -1.0) }}{{ printf "%.3g" . }}{{ else }}{{ humanize . }}{{ end }}{{ end }}
|
|
|
|
{{ define "humanize1024" }}{{ humanize1024 . }}{{ end }}
|
|
|
|
{{ define "humanizeDuration" }}{{ humanizeDuration . }}{{ end }}
|
2019-06-15 07:59:57 +00:00
|
|
|
{{ define "humanizePercentage" }}{{ humanizePercentage . }}{{ end }}
|
2015-10-22 12:57:22 +00:00
|
|
|
{{ define "humanizeTimestamp" }}{{ humanizeTimestamp . }}{{ end }}
|
2015-02-19 10:06:23 +00:00
|
|
|
{{ define "printf.1f" }}{{ printf "%.1f" . }}{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
{{ define "printf.3g" }}{{ printf "%.3g" . }}{{ end }}
|
|
|
|
|
|
|
|
{{/* prom_query_drilldown (args expr suffix? renderTemplate?)
|
|
|
|
Displays the result of the expression, with a link to /graph for it.
|
|
|
|
|
|
|
|
renderTemplate is the name of the template to use to render the value.
|
|
|
|
*/}}
|
|
|
|
{{ define "prom_query_drilldown" }}
|
2015-01-30 11:27:52 +00:00
|
|
|
{{ $expr := .arg0 }}{{ $suffix := (or .arg1 "") }}{{ $renderTemplate := (or .arg2 "__prom_query_drilldown_noop") }}
|
2015-05-18 17:44:40 +00:00
|
|
|
<a class="prom_query_drilldown" href="{{ pathPrefix }}{{ graphLink $expr }}">{{ with query $expr }}{{tmpl $renderTemplate ( . | first | value )}}{{ $suffix }}{{ else }}-{{ end }}</a>
|
2014-11-20 18:41:25 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2015-01-30 11:27:52 +00:00
|
|
|
{{ define "prom_path" }}/consoles/{{ .Path }}?{{ range $param, $value := .Params }}{{ $param }}={{ $value }}&{{ end }}{{ end }}"
|
2014-11-20 18:41:25 +00:00
|
|
|
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ define "prom_right_table_head" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
<div class="prom_console_rhs">
|
2019-02-07 21:18:09 +00:00
|
|
|
<table class="table table-bordered table-hover table-sm">
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ define "prom_right_table_tail" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
</table>
|
|
|
|
</div>
|
2015-01-30 11:27:52 +00:00
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
2015-01-30 11:27:52 +00:00
|
|
|
{{/* RHS table head, pass job name. Should be used after prom_right_table_head. */}}
|
|
|
|
{{ define "prom_right_table_job_head" }}
|
|
|
|
<tr>
|
|
|
|
<th>{{ . }}</th>
|
|
|
|
<th>{{ template "prom_query_drilldown" (args (printf "sum(up{job='%s'})" .)) }} / {{ template "prom_query_drilldown" (args (printf "count(up{job='%s'})" .)) }}</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>CPU</td>
|
2015-10-09 16:58:43 +00:00
|
|
|
<td>{{ template "prom_query_drilldown" (args (printf "avg by(job)(irate(process_cpu_seconds_total{job='%s'}[5m]))" .) "s/s" "humanizeNoSmallPrefix") }}</td>
|
2015-01-30 11:27:52 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Memory</td>
|
|
|
|
<td>{{ template "prom_query_drilldown" (args (printf "avg by(job)(process_resident_memory_bytes{job='%s'})" .) "B" "humanize1024") }}</td>
|
|
|
|
</tr>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
2015-01-30 11:27:52 +00:00
|
|
|
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ define "prom_content_head" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
<div class="prom_console_content">
|
2019-02-07 21:18:09 +00:00
|
|
|
<div class="container-fluid">
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ template "prom_graph_timecontrol" . }}
|
|
|
|
{{ end }}
|
|
|
|
{{ define "prom_content_tail" }}
|
2015-01-22 10:39:41 +00:00
|
|
|
</div>
|
2014-11-20 18:41:25 +00:00
|
|
|
</div>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ define "prom_graph_timecontrol" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
<div class="prom_graph_timecontrol">
|
|
|
|
<div class="prom_graph_timecontrol_inner">
|
2019-02-07 21:18:09 +00:00
|
|
|
<div class="prom_graph_timecontrol_group ">
|
|
|
|
<button class="btn btn-light pull-left" type="button" id="prom_graph_duration_shrink" title="Shrink the time range.">
|
2015-01-22 10:39:41 +00:00
|
|
|
<i class="glyphicon glyphicon-minus"></i>
|
2019-02-07 21:18:09 +00:00
|
|
|
</button><!-- Comments between elements to remove spaces
|
|
|
|
--><input class="input pull-left align-middle" size="3" title="Time range of graph" type="text" id="prom_graph_duration"><!--
|
|
|
|
--><button class="btn btn-light pull-left" type="button" id="prom_graph_duration_grow" title="Grow the time range.">
|
2015-01-22 10:39:41 +00:00
|
|
|
<i class="glyphicon glyphicon-plus"></i>
|
2014-11-20 18:41:25 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
2019-02-07 21:18:09 +00:00
|
|
|
<div class="prom_graph_timecontrol_group ">
|
|
|
|
<button class="btn btn-light pull-left" type="button" id="prom_graph_time_back" title="Rewind the end time.">
|
2015-01-22 10:39:41 +00:00
|
|
|
<i class="glyphicon glyphicon-backward"></i>
|
2019-02-07 21:18:09 +00:00
|
|
|
</button><!--
|
|
|
|
--><input class="input pull-left align-middle" title="End time of graph" placeholder="Until" type="text" id="prom_graph_time_end" size="16" value=""><!--
|
|
|
|
--><button class="btn btn-light pull-left" type="button" id="prom_graph_time_forward" title="Advance the end time.">
|
2015-01-22 10:39:41 +00:00
|
|
|
<i class="glyphicon glyphicon-forward"></i>
|
2014-11-20 18:41:25 +00:00
|
|
|
</button>
|
2015-01-30 11:27:52 +00:00
|
|
|
</div>
|
2019-02-07 21:18:09 +00:00
|
|
|
<div class="prom_graph_timecontrol_group ">
|
2015-01-22 10:39:41 +00:00
|
|
|
<div class="btn-group dropup prom_graph_timecontrol_refresh pull-left">
|
2019-02-07 21:18:09 +00:00
|
|
|
<button type="button" class="btn btn-light pull-left" id="prom_graph_refresh_button" title="Refresh.">
|
2015-01-22 10:39:41 +00:00
|
|
|
<i class="glyphicon glyphicon-repeat"></i>
|
|
|
|
<span class="icon-repeat"></span>
|
|
|
|
(<span id="prom_graph_refresh_button_value">Off</span>)
|
2014-11-20 18:41:25 +00:00
|
|
|
</button>
|
2019-02-07 21:18:09 +00:00
|
|
|
<button type="button" class="btn btn-light pull-left dropdown-toggle" data-toggle="dropdown" title="Set autorefresh."aria-haspopup="true" aria-expanded="false">
|
2014-11-20 18:41:25 +00:00
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu" id="prom_graph_refresh_intervals" role="menu">
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
new PromConsole.TimeControl();
|
|
|
|
</script>
|
|
|
|
</div>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|
2014-11-20 18:41:25 +00:00
|
|
|
|
|
|
|
{{/* Bottom of all pages. */}}
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ define "tail" }}
|
2014-11-20 18:41:25 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
2015-01-23 17:40:48 +00:00
|
|
|
{{ end }}
|