Imported Upstream version 2.11.1
This commit is contained in:
commit
1450a50dd9
201
LICENSE
Normal file
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
87
NOTICE
Normal file
87
NOTICE
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
The Prometheus systems and service monitoring server
|
||||||
|
Copyright 2012-2015 The Prometheus Authors
|
||||||
|
|
||||||
|
This product includes software developed at
|
||||||
|
SoundCloud Ltd. (https://soundcloud.com/).
|
||||||
|
|
||||||
|
|
||||||
|
The following components are included in this product:
|
||||||
|
|
||||||
|
Bootstrap
|
||||||
|
https://getbootstrap.com
|
||||||
|
Copyright 2011-2014 Twitter, Inc.
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
bootstrap3-typeahead.js
|
||||||
|
https://github.com/bassjobsen/Bootstrap-3-Typeahead
|
||||||
|
Original written by @mdo and @fat
|
||||||
|
Copyright 2014 Bass Jobsen @bassjobsen
|
||||||
|
Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
|
fuzzy
|
||||||
|
https://github.com/mattyork/fuzzy
|
||||||
|
Original written by @mattyork
|
||||||
|
Copyright 2012 Matt York
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
bootstrap-datetimepicker.js
|
||||||
|
https://github.com/Eonasdan/bootstrap-datetimepicker
|
||||||
|
Copyright 2015 Jonathan Peterson (@Eonasdan)
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
moment.js
|
||||||
|
https://github.com/moment/moment/
|
||||||
|
Copyright JS Foundation and other contributors
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
Rickshaw
|
||||||
|
https://github.com/shutterstock/rickshaw
|
||||||
|
Copyright 2011-2014 by Shutterstock Images, LLC
|
||||||
|
See https://github.com/shutterstock/rickshaw/blob/master/LICENSE for license details
|
||||||
|
|
||||||
|
mustache.js
|
||||||
|
https://github.com/janl/mustache.js
|
||||||
|
Copyright 2009 Chris Wanstrath (Ruby)
|
||||||
|
Copyright 2010-2014 Jan Lehnardt (JavaScript)
|
||||||
|
Copyright 2010-2015 The mustache.js community
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
jQuery
|
||||||
|
https://jquery.org
|
||||||
|
Copyright jQuery Foundation and other contributors
|
||||||
|
Licensed under the MIT License
|
||||||
|
|
||||||
|
Protocol Buffers for Go with Gadgets
|
||||||
|
https://github.com/gogo/protobuf/
|
||||||
|
Copyright (c) 2013, The GoGo Authors.
|
||||||
|
See source code for license details.
|
||||||
|
|
||||||
|
Go support for leveled logs, analogous to
|
||||||
|
https://code.google.com/p/google-glog/
|
||||||
|
Copyright 2013 Google Inc.
|
||||||
|
Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
|
Support for streaming Protocol Buffer messages for the Go language (golang).
|
||||||
|
https://github.com/matttproud/golang_protobuf_extensions
|
||||||
|
Copyright 2013 Matt T. Proud
|
||||||
|
Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
|
DNS library in Go
|
||||||
|
https://miek.nl/2014/august/16/go-dns-package/
|
||||||
|
Copyright 2009 The Go Authors, 2011 Miek Gieben
|
||||||
|
See https://github.com/miekg/dns/blob/master/LICENSE for license details.
|
||||||
|
|
||||||
|
LevelDB key/value database in Go
|
||||||
|
https://github.com/syndtr/goleveldb
|
||||||
|
Copyright 2012 Suryandaru Triandana
|
||||||
|
See https://github.com/syndtr/goleveldb/blob/master/LICENSE for license details.
|
||||||
|
|
||||||
|
gosnappy - a fork of code.google.com/p/snappy-go
|
||||||
|
https://github.com/syndtr/gosnappy
|
||||||
|
Copyright 2011 The Snappy-Go Authors
|
||||||
|
See https://github.com/syndtr/gosnappy/blob/master/LICENSE for license details.
|
||||||
|
|
||||||
|
go-zookeeper - Native ZooKeeper client for Go
|
||||||
|
https://github.com/samuel/go-zookeeper
|
||||||
|
Copyright (c) 2013, Samuel Stauffer <samuel@descolada.com>
|
||||||
|
See https://github.com/samuel/go-zookeeper/blob/master/LICENSE for license details.
|
82
console_libraries/menu.lib
Normal file
82
console_libraries/menu.lib
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{{/* vim: set ft=html: */}}
|
||||||
|
|
||||||
|
{{/* Navbar, should be passed . */}}
|
||||||
|
{{ define "navbar" }}
|
||||||
|
<nav class="navbar fixed-top navbar-expand-sm navbar-dark bg-dark">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Brand and toggle get grouped for better mobile display -->
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false" aria-controls="navbar-nav" aria-label="toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="{{ pathPrefix }}/">Prometheus</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="{{ pathPrefix }}/alerts">Alerts</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="https://www.pagerduty.com/">PagerDuty</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* LHS menu, should be passed . */}}
|
||||||
|
{{ define "menu" }}
|
||||||
|
<div class="prom_lhs_menu row">
|
||||||
|
<nav class="col-md-2 md-block bg-dark sidebar prom_lhs_menu_nav">
|
||||||
|
<div class="sidebar-sticky">
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
|
||||||
|
{{ template "_menuItem" (args . "index.html.example" "Overview") }}
|
||||||
|
|
||||||
|
{{ if query "up{job='node'}" }}
|
||||||
|
{{ template "_menuItem" (args . "node.html" "Node") }}
|
||||||
|
{{ if match "^node" .Path }}
|
||||||
|
{{ if .Params.instance }}
|
||||||
|
<ul>
|
||||||
|
<li {{ if eq .Path "node-overview.html" }}class="prom_lhs_menu_selected nav-item"{{ end }}>
|
||||||
|
<a class="nav-link" href="node-overview.html?instance={{ .Params.instance }}">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</a>
|
||||||
|
</li>
|
||||||
|
<ul>
|
||||||
|
<li {{ if eq .Path "node-cpu.html" }}class="prom_lhs_menu_selected nav-item"{{ end }}>
|
||||||
|
<a class="nav-link" href="node-cpu.html?instance={{ .Params.instance }}">CPU</a>
|
||||||
|
</li>
|
||||||
|
<li {{ if eq .Path "node-disk.html" }}class="prom_lhs_menu_selected nav-item"{{ end }}>
|
||||||
|
<a class="nav-link" href="node-disk.html?instance={{ .Params.instance }}">Disk</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if query "up{job='prometheus'}" }}
|
||||||
|
{{ template "_menuItem" (args . "prometheus.html" "Prometheus") }}
|
||||||
|
{{ if match "^prometheus" .Path }}
|
||||||
|
{{ if .Params.instance }}
|
||||||
|
<ul>
|
||||||
|
<li {{ if eq .Path "prometheus-overview.html" }}class="prom_lhs_menu_selected nav-item"{{ end }}>
|
||||||
|
<a class="nav-link" href="prometheus-overview.html?instance={{ .Params.instance }}">{{.Params.instance }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* Helper, pass (args . path name) */}}
|
||||||
|
{{ define "_menuItem" }}
|
||||||
|
<li {{ if eq .arg0.Path .arg1 }} class="prom_lhs_menu_selected nav-item" {{ end }}><a class="nav-link" href="{{ .arg1 }}">{{ .arg2 }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
|
138
console_libraries/prom.lib
Normal file
138
console_libraries/prom.lib
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
{{/* vim: set ft=html: */}}
|
||||||
|
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
|
||||||
|
{{ define "prom_console_head" }}
|
||||||
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-4.3.1/css/bootstrap.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css">
|
||||||
|
<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>
|
||||||
|
<script src="{{ pathPrefix }}/static/vendor/js/jquery-3.3.1.min.js"></script>
|
||||||
|
<script src="{{ pathPrefix }}/static/vendor/js/popper.min.js"></script>
|
||||||
|
<script src="{{ pathPrefix }}/static/vendor/bootstrap-4.3.1/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var PATH_PREFIX = "{{ pathPrefix }}";
|
||||||
|
</script>
|
||||||
|
<script src="{{ pathPrefix }}/static/js/prom_console.js"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* Top of all pages. */}}
|
||||||
|
{{ define "head" -}}
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
{{ template "prom_console_head" }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ template "navbar" . }}
|
||||||
|
|
||||||
|
{{ template "menu" . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ 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 }}
|
||||||
|
{{ define "humanizePercentage" }}{{ humanizePercentage . }}{{ end }}
|
||||||
|
{{ define "humanizeTimestamp" }}{{ humanizeTimestamp . }}{{ end }}
|
||||||
|
{{ define "printf.1f" }}{{ printf "%.1f" . }}{{ end }}
|
||||||
|
{{ 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" }}
|
||||||
|
{{ $expr := .arg0 }}{{ $suffix := (or .arg1 "") }}{{ $renderTemplate := (or .arg2 "__prom_query_drilldown_noop") }}
|
||||||
|
<a class="prom_query_drilldown" href="{{ pathPrefix }}{{ graphLink $expr }}">{{ with query $expr }}{{tmpl $renderTemplate ( . | first | value )}}{{ $suffix }}{{ else }}-{{ end }}</a>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "prom_path" }}/consoles/{{ .Path }}?{{ range $param, $value := .Params }}{{ $param }}={{ $value }}&{{ end }}{{ end }}"
|
||||||
|
|
||||||
|
{{ define "prom_right_table_head" }}
|
||||||
|
<div class="prom_console_rhs">
|
||||||
|
<table class="table table-bordered table-hover table-sm">
|
||||||
|
{{ end }}
|
||||||
|
{{ define "prom_right_table_tail" }}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* 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>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "avg by(job)(irate(process_cpu_seconds_total{job='%s'}[5m]))" .) "s/s" "humanizeNoSmallPrefix") }}</td>
|
||||||
|
</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>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ define "prom_content_head" }}
|
||||||
|
<div class="prom_console_content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
{{ template "prom_graph_timecontrol" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ define "prom_content_tail" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "prom_graph_timecontrol" }}
|
||||||
|
<div class="prom_graph_timecontrol">
|
||||||
|
<div class="prom_graph_timecontrol_inner">
|
||||||
|
<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.">
|
||||||
|
<i class="glyphicon glyphicon-minus"></i>
|
||||||
|
</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.">
|
||||||
|
<i class="glyphicon glyphicon-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<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.">
|
||||||
|
<i class="glyphicon glyphicon-backward"></i>
|
||||||
|
</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.">
|
||||||
|
<i class="glyphicon glyphicon-forward"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="prom_graph_timecontrol_group ">
|
||||||
|
<div class="btn-group dropup prom_graph_timecontrol_refresh pull-left">
|
||||||
|
<button type="button" class="btn btn-light pull-left" id="prom_graph_refresh_button" title="Refresh.">
|
||||||
|
<i class="glyphicon glyphicon-repeat"></i>
|
||||||
|
<span class="icon-repeat"></span>
|
||||||
|
(<span id="prom_graph_refresh_button_value">Off</span>)
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light pull-left dropdown-toggle" data-toggle="dropdown" title="Set autorefresh."aria-haspopup="true" aria-expanded="false">
|
||||||
|
<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>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* Bottom of all pages. */}}
|
||||||
|
{{ define "tail" }}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
{{ end }}
|
28
consoles/index.html.example
Normal file
28
consoles/index.html.example
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Overview</h1>
|
||||||
|
<p>These are example consoles for Prometheus.</p>
|
||||||
|
|
||||||
|
<p>These consoles expect exporters to have the following job labels:</p>
|
||||||
|
<table class="table table-sm table-striped table-bordered" style="width: 0%">
|
||||||
|
<tr>
|
||||||
|
<th>Exporter</th>
|
||||||
|
<th>Job label</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Node Exporter</td>
|
||||||
|
<td><code>node</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Prometheus</td>
|
||||||
|
<td><code>prometheus</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
60
consoles/node-cpu.html
Normal file
60
consoles/node-cpu.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">CPU(s): {{ template "prom_query_drilldown" (args (printf "scalar(count(count by (cpu)(node_cpu_seconds_total{job='node',instance='%s'})))" .Params.instance)) }}</th>
|
||||||
|
</tr>
|
||||||
|
{{ range printf "sum by (mode)(irate(node_cpu_seconds_total{job='node',instance='%s'}[5m])) * 100 / scalar(count(count by (cpu)(node_cpu_seconds_total{job='node',instance='%s'})))" .Params.instance .Params.instance | query | sortByLabel "mode" }}
|
||||||
|
<tr>
|
||||||
|
<td>{{ .Labels.mode | title }} CPU</td>
|
||||||
|
<td>{{ .Value | printf "%.1f" }}%</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
<tr><th colspan="2">Misc</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>Processes Running</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "node_procs_running{job='node',instance='%s'}" .Params.instance) "" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Processes Blocked</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "node_procs_blocked{job='node',instance='%s'}" .Params.instance) "" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Forks</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_forks_total{job='node',instance='%s'}[5m])" .Params.instance) "/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Context Switches</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_context_switches_total{job='node',instance='%s'}[5m])" .Params.instance) "/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Interrupts</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_intr_total{job='node',instance='%s'}[5m])" .Params.instance) "/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>1m Loadavg</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "node_load1{job='node',instance='%s'}" .Params.instance)) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Node CPU - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
|
||||||
|
|
||||||
|
<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',instance='{{ .Params.instance }}',mode!='idle'}[5m]))",
|
||||||
|
renderer: 'area',
|
||||||
|
max: {{ with printf "count(count by (cpu)(node_cpu_seconds_total{job='node',instance='%s'}))" .Params.instance | query }}{{ . | first | value }}{{ else}}undefined{{end}},
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: 'Cores'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
77
consoles/node-disk.html
Normal file
77
consoles/node-disk.html
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Node Disk - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
|
||||||
|
|
||||||
|
<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',instance='{{ .Params.instance }}',device!~'^(md\\\\d+$|dm-)'}[5m]) * 100",
|
||||||
|
],
|
||||||
|
min: 0,
|
||||||
|
name: '[[ device ]]',
|
||||||
|
yUnits: "%",
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: 'Disk I/O Utilization'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<h3>Filesystem Usage</h3>
|
||||||
|
<div id="fsGraph"></div>
|
||||||
|
<script>
|
||||||
|
new PromConsole.Graph({
|
||||||
|
node: document.querySelector("#fsGraph"),
|
||||||
|
expr: "100 - node_filesystem_avail_bytes{job='node',instance='{{ .Params.instance }}'} / node_filesystem_size_bytes{job='node'} * 100",
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
name: '[[ mountpoint ]]',
|
||||||
|
yUnits: "%",
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: 'Filesystem Fullness'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<th colspan="2">Disks</th>
|
||||||
|
</tr>
|
||||||
|
{{ range printf "node_disk_io_time_seconds_total{job='node',instance='%s'}" .Params.instance | query | sortByLabel "device" }}
|
||||||
|
<th colspan="2">{{ .Labels.device }}</th>
|
||||||
|
<tr>
|
||||||
|
<td>Utilization</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_io_time_seconds_total{job='node',instance='%s',device='%s'}[5m]) * 100" .Labels.instance .Labels.device) "%" "printf.1f") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Throughput</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_read_bytes_total{job='node',instance='%s',device='%s'}[5m]) + irate(node_disk_written_bytes_total{job='node',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Avg Read Time</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_read_time_seconds_total{job='node',instance='%s',device='%s'}[5m]) / irate(node_disk_reads_completed_total{job='node',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device .Labels.instance .Labels.device) "s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Avg Write Time</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(node_disk_write_time_seconds_total{job='node',instance='%s',device='%s'}[5m]) / irate(node_disk_writes_completed_total{job='node',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device .Labels.instance .Labels.device) "s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
<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',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',instance='%s',mountpoint='%s'} / node_filesystem_size_bytes{job='node'} * 100" .Labels.instance .Labels.mountpoint) "%" "roughlyNearZero") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
<tr>
|
||||||
|
</tr>
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
122
consoles/node-overview.html
Normal file
122
consoles/node-overview.html
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Node Overview - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</h1>
|
||||||
|
|
||||||
|
<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',instance='{{ .Params.instance }}',mode!='idle'}[5m]))",
|
||||||
|
renderer: 'area',
|
||||||
|
max: {{ with printf "count(count by (cpu)(node_cpu_seconds_total{job='node',instance='%s'}))" .Params.instance | query }}{{ . | first | value }}{{ else}}undefined{{end}},
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: 'Cores'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<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',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>
|
||||||
|
|
||||||
|
<h3>Memory</h3>
|
||||||
|
<div id="memoryGraph"></div>
|
||||||
|
<script>
|
||||||
|
new PromConsole.Graph({
|
||||||
|
node: document.querySelector("#memoryGraph"),
|
||||||
|
renderer: 'area',
|
||||||
|
expr: [
|
||||||
|
"node_memory_Cached_bytes{job='node',instance='{{ .Params.instance }}'}",
|
||||||
|
"node_memory_Buffers_bytes{job='node',instance='{{ .Params.instance }}'}",
|
||||||
|
"node_memory_MemTotal_bytes{job='node',instance='{{ .Params.instance }}'} - node_memory_MemFree_bytes{job='node',instance='{{.Params.instance}}'} - node_memory_Buffers_bytes{job='node',instance='{{.Params.instance}}'} - node_memory_Cached_bytes{job='node',instance='{{.Params.instance}}'}",
|
||||||
|
"node_memory_MemFree{job='node',instance='{{ .Params.instance }}'}",
|
||||||
|
],
|
||||||
|
name: ["Cached", "Buffers", "Used", "Free"],
|
||||||
|
min: 0,
|
||||||
|
yUnits: "B",
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanize1024,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanize1024,
|
||||||
|
yTitle: 'Memory'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<tr><th colspan="2">Overview</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>User CPU</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "sum(irate(node_cpu_seconds_total{job='node',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(node_cpu_seconds_total{job='node',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',instance='%s',mode='system'}[5m])) * 100 / count(count by (cpu)(node_cpu_seconds_total{job='node',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',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',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Network</th>
|
||||||
|
</tr>
|
||||||
|
{{ range printf "node_network_receive_bytes_total{job='node',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',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',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Disks</th>
|
||||||
|
</tr>
|
||||||
|
{{ range printf "node_disk_io_time_seconds_total{job='node',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',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',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',instance='%s',device='%s'}[5m]) + irate(node_disk_written_bytes_total{job='node',instance='%s',device='%s'}[5m])" .Labels.instance .Labels.device .Labels.instance .Labels.device) "B/s" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
<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',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',instance='%s',mountpoint='%s'} / node_filesystem_size_bytes{job='node'} * 100" .Labels.instance .Labels.mountpoint) "%" "roughlyNearZero") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tr>
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
34
consoles/node.html
Normal file
34
consoles/node.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<tr>
|
||||||
|
<th>Node</th>
|
||||||
|
<th>{{ template "prom_query_drilldown" (args "sum(up{job='node'})") }} / {{ template "prom_query_drilldown" (args "count(up{job='node'})") }}</th>
|
||||||
|
</tr>
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Node</h1>
|
||||||
|
|
||||||
|
<table class="table table-condensed table-striped table-bordered" style="width: 0%">
|
||||||
|
<tr>
|
||||||
|
<th>Node</th>
|
||||||
|
<th>Up</th>
|
||||||
|
<th>CPU<br/>Used</th>
|
||||||
|
<th>Memory<br/> Available</th>
|
||||||
|
</tr>
|
||||||
|
{{ range query "up{job='node'}" | sortByLabel "instance" }}
|
||||||
|
<tr>
|
||||||
|
<td><a href="node-overview.html?instance={{ .Labels.instance }}">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Labels.instance }}</a></td>
|
||||||
|
<td{{ if eq (. | value) 1.0 }}>Yes{{ else }} class="alert-danger">No{{ end }}</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "100 * (1 - avg by(instance)(irate(node_cpu_seconds_total{job='node',mode='idle',instance='%s'}[5m])))" .Labels.instance) "%" "printf.1f") }}</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "node_memory_MemFree_bytes{job='node',instance='%s'} + node_memory_Cached_bytes{job='node',instance='%s'} + node_memory_Buffers_bytes{job='node',instance='%s'}" .Labels.instance .Labels.instance .Labels.instance) "B" "humanize1024") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ else }}
|
||||||
|
<tr><td colspan=4>No nodes found.</td></tr>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
96
consoles/prometheus-overview.html
Normal file
96
consoles/prometheus-overview.html
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Overview</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>CPU</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(process_cpu_seconds_total{job='prometheus',instance='%s'}[5m])" .Params.instance) "s/s" "humanizeNoSmallPrefix") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Memory</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "process_resident_memory_bytes{job='prometheus',instance='%s'}" .Params.instance) "B" "humanize1024") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Version</td>
|
||||||
|
<td>{{ with query (printf "prometheus_build_info{job='prometheus',instance='%s'}" .Params.instance) }}{{. | first | label "version"}}{{end}}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Storage</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Ingested Samples</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(prometheus_tsdb_head_samples_appended_total{job='prometheus',instance='%s'}[5m])" .Params.instance) "/s" "humanizeNoSmallPrefix") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Head Series</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "prometheus_tsdb_head_series{job='prometheus',instance='%s'}" .Params.instance) "" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Blocks Loaded</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "prometheus_tsdb_blocks_loaded{job='prometheus',instance='%s'}" .Params.instance) "" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">Rules</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Evaluation Duration</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(prometheus_evaluator_duration_seconds_sum{job='prometheus',instance='%s'}[5m]) / irate(prometheus_evaluator_duration_seconds_count{job='prometheus',instance='%s'}[5m])" .Params.instance .Params.instance) "" "humanizeDuration") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Notification Latency</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(prometheus_notifications_latency_seconds_sum{job='prometheus',instance='%s'}[5m]) / irate(prometheus_notifications_latency_seconds_count{job='prometheus',instance='%s'}[5m])" .Params.instance .Params.instance) "" "humanizeDuration") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Notification Queue</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "prometheus_notifications_queue_length{job='prometheus',instance='%s'}" .Params.instance) "" "humanize") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">HTTP Server</th>
|
||||||
|
</tr>
|
||||||
|
{{ range printf "prometheus_http_request_duration_seconds_count{job='prometheus',instance='%s'}" .Params.instance | query | sortByLabel "handler" }}
|
||||||
|
<tr>
|
||||||
|
<td>{{ .Labels.handler }}</td>
|
||||||
|
<td>{{ template "prom_query_drilldown" (args (printf "irate(prometheus_http_request_duration_seconds_count{job='prometheus',instance='%s',handler='%s'}[5m])" .Labels.instance .Labels.handler) "/s" "humanizeNoSmallPrefix") }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<div class="prom_content_div">
|
||||||
|
<h1>Prometheus Overview - {{ .Params.instance }}</h1>
|
||||||
|
|
||||||
|
<h3>Ingested Samples</h3>
|
||||||
|
<div id="samplesGraph"></div>
|
||||||
|
<script>
|
||||||
|
new PromConsole.Graph({
|
||||||
|
node: document.querySelector("#samplesGraph"),
|
||||||
|
expr: "irate(prometheus_tsdb_head_samples_appended_total{job='prometheus',instance='{{ .Params.instance }}'}[5m])",
|
||||||
|
name: 'Ingested Samples',
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: "Samples",
|
||||||
|
yUnits: "/s",
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h3>HTTP Server</h3>
|
||||||
|
<div id="serverGraph"></div>
|
||||||
|
<script>
|
||||||
|
new PromConsole.Graph({
|
||||||
|
node: document.querySelector("#serverGraph"),
|
||||||
|
expr: "irate(prometheus_http_request_duration_seconds_count{job='prometheus',instance='{{ .Params.instance }}'}[5m])",
|
||||||
|
name: '[[handler]]',
|
||||||
|
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
|
||||||
|
yTitle: "Requests",
|
||||||
|
yUnits: "/s",
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
34
consoles/prometheus.html
Normal file
34
consoles/prometheus.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{{ template "head" . }}
|
||||||
|
|
||||||
|
{{ template "prom_right_table_head" }}
|
||||||
|
<tr>
|
||||||
|
<th>Prometheus</th>
|
||||||
|
<th>{{ template "prom_query_drilldown" (args "sum(up{job='prometheus'})") }} / {{ template "prom_query_drilldown" (args "count(up{job='prometheus'})") }}</th>
|
||||||
|
</tr>
|
||||||
|
{{ template "prom_right_table_tail" }}
|
||||||
|
|
||||||
|
{{ template "prom_content_head" . }}
|
||||||
|
<h1>Prometheus</h1>
|
||||||
|
|
||||||
|
<table class="table table-sm table-striped table-bordered" style="width: 0%">
|
||||||
|
<tr>
|
||||||
|
<th>Prometheus</th>
|
||||||
|
<th>Up</th>
|
||||||
|
<th>Ingested Samples</th>
|
||||||
|
<th>Memory</th>
|
||||||
|
</tr>
|
||||||
|
{{ range query "up{job='prometheus'}" | sortByLabel "instance" }}
|
||||||
|
<tr>
|
||||||
|
<td><a href="prometheus-overview.html?instance={{ .Labels.instance }}">{{ .Labels.instance }}</a></td>
|
||||||
|
<td {{ if eq (. | value) 1.0 }}>Yes{{ else }} class="alert-danger">No{{ end }}</td>
|
||||||
|
<td class="text-right">{{ template "prom_query_drilldown" (args (printf "irate(prometheus_tsdb_head_samples_appended_total{job='prometheus',instance='%s'}[5m])" .Labels.instance) "/s" "humanizeNoSmallPrefix") }}</td>
|
||||||
|
<td class="text-right">{{ template "prom_query_drilldown" (args (printf "process_resident_memory_bytes{job='prometheus',instance='%s'}" .Labels.instance) "B" "humanize1024")}}</td>
|
||||||
|
</tr>
|
||||||
|
{{ else }}
|
||||||
|
<tr><td colspan=4>No devices found.</td></tr>
|
||||||
|
{{ end }}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{ template "prom_content_tail" . }}
|
||||||
|
|
||||||
|
{{ template "tail" }}
|
BIN
prometheus
Executable file
BIN
prometheus
Executable file
Binary file not shown.
29
prometheus.yml
Normal file
29
prometheus.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# my global config
|
||||||
|
global:
|
||||||
|
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||||
|
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||||
|
# scrape_timeout is set to the global default (10s).
|
||||||
|
|
||||||
|
# Alertmanager configuration
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- static_configs:
|
||||||
|
- targets:
|
||||||
|
# - alertmanager:9093
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||||
|
rule_files:
|
||||||
|
# - "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
# Here it's Prometheus itself.
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
|
||||||
|
# metrics_path defaults to '/metrics'
|
||||||
|
# scheme defaults to 'http'.
|
||||||
|
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
Loading…
Reference in New Issue
Block a user