Adjust for bootstrap3. Remove long lists from LHS menu.

Put in a table on the node page instead.
This commit is contained in:
Brian Brazil 2015-01-22 10:39:41 +00:00
parent 39d20140c8
commit 2d8bfa0ced
4 changed files with 106 additions and 88 deletions

View file

@ -2,29 +2,38 @@
{{/* Navbar, should be passed . */}} {{/* Navbar, should be passed . */}}
{{ define "navbar" }} {{ define "navbar" }}
<div class="navbar navbar-inverse navbar-static-top"> <nav class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner"> <div class="container-fluid">
<ul class="navbar-nav nav"> <!-- Brand and toggle get grouped for better mobile display -->
<a class="brand" href="/">Prometheus</a> <div class="navbar-header">
<li><a href="/alerts">Alerts</a></li> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<!-- Add in navbar links here --> <span class="sr-only">Toggle navigation</span>
<li><a href="https://pagerduty.com/">PagerDuty</a></li> <span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Prometheus</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/alerts">Alerts</a></li>
<li><a href="https://www.pagerduty.com/">PagerDuty</a></li>
</div>
</ul> </ul>
</div> </div>
</div> </nav>
{{ end }} {{ end }}
{{/* LHS menu, should be passed . */}} {{/* LHS menu, should be passed . */}}
{{ define "menu" }} {{ define "menu" }}
<div class="prom_lhs_menu"> <div class="prom_lhs_menu">
<ul> <ul>
{{ $dot := . }}
{{ template "_menuItem" (args . "index.html.example" "Overview") }} {{ template "_menuItem" (args . "index.html.example" "Overview") }}
{{ template "_menuItem" (args . "node.html" "Node") }} {{ template "_menuItem" (args . "node.html" "Node") }}
{{ if match "^node" .Path }} {{ if match "^node" .Path }}
<ul>
{{ if .Params.instance }} {{ if .Params.instance }}
<ul>
<li {{ if eq .Path "node-overview.html" }}class="prom_lhs_menu_selected"{{end}}> <li {{ if eq .Path "node-overview.html" }}class="prom_lhs_menu_selected"{{end}}>
<a href="node-overview.html?instance={{ .Params.instance }}">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</a> <a href="node-overview.html?instance={{ .Params.instance }}">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}</a>
</li> </li>
@ -36,12 +45,8 @@
<a href="node-disk.html?instance={{ .Params.instance }}">Disk</a> <a href="node-disk.html?instance={{ .Params.instance }}">Disk</a>
</li> </li>
</ul> </ul>
{{ else }}
{{ range query "up{job='node'}" | sortByLabel "instance" }}
<li><a href="node-overview.html?instance={{ .Labels.instance }}">{{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Labels.instance }}</a></li>
{{ end }}
{{ end }}
</ul> </ul>
{{ end }}
{{ end }} {{ end }}

View file

@ -2,13 +2,13 @@
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}} {{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
{{define "prom_console_head"}} {{define "prom_console_head"}}
<link type="text/css" rel="stylesheet" href="/static/vendor/rickshaw/rickshaw.min.css"> <link type="text/css" rel="stylesheet" href="/static/vendor/rickshaw/rickshaw.min.css">
<link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap/css/bootstrap.css"> <link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-3.3.1/css/bootstrap.css">
<link type="text/css" rel="stylesheet" href="/static/css/prom_console.css"> <link type="text/css" rel="stylesheet" href="/static/css/prom_console.css">
<script src="/static/vendor/rickshaw/vendor/d3.min.js"></script> <script src="/static/vendor/rickshaw/vendor/d3.min.js"></script>
<script src="/static/vendor/rickshaw/vendor/d3.layout.min.js"></script> <script src="/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
<script src="/static/vendor/rickshaw/rickshaw.min.js"></script> <script src="/static/vendor/rickshaw/rickshaw.min.js"></script>
<script src="/static/vendor/js/jquery.min.js"></script> <script src="/static/vendor/js/jquery.min.js"></script>
<script src="/static/vendor/bootstrap/js/bootstrap.min.js"></script> <script src="/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
<script src="/static/js/prom_console.js"></script> <script src="/static/js/prom_console.js"></script>
{{end}} {{end}}
@ -42,7 +42,6 @@ renderTemplate is the name of the template to use to render the value.
{{ define "prom_path" }}/consoles/{{.Path}}?{{range $param, $value := .Params}}{{$param}}={{$value}}&amp;{{end}}{{ end }}" {{ define "prom_path" }}/consoles/{{.Path}}?{{range $param, $value := .Params}}{{$param}}={{$value}}&amp;{{end}}{{ end }}"
{{/* Top and bottom of table on RHS */}}
{{define "prom_right_table_head"}} {{define "prom_right_table_head"}}
<div class="prom_console_rhs"> <div class="prom_console_rhs">
<table class="table table-bordered table-hover table-condensed"> <table class="table table-bordered table-hover table-condensed">
@ -53,45 +52,47 @@ renderTemplate is the name of the template to use to render the value.
{{end}} {{end}}
{{/* Top and bottom of main content */}}
{{define "prom_content_head"}} {{define "prom_content_head"}}
<div class="prom_console_content"> <div class="prom_console_content">
<div class="container">
{{template "prom_graph_timecontrol" .}} {{template "prom_graph_timecontrol" .}}
{{end}} {{end}}
{{define "prom_content_tail"}} {{define "prom_content_tail"}}
</div>
</div> </div>
{{end}} {{end}}
{{define "prom_graph_timecontrol"}} {{define "prom_graph_timecontrol"}}
<div class="prom_graph_timecontrol"> <div class="prom_graph_timecontrol">
<div class="prom_graph_timecontrol_inner"> <div class="prom_graph_timecontrol_inner">
<label for="prom_graph_duration">Range:</label> <div class="prom_graph_timecontrol_group">
<div class="input-prepend input-append"> <button class="btn btn-default pull-left" type="button" id="prom_graph_duration_shrink" title="Shrink the time range.">
<button class="btn btn-mini" type="button" id="prom_graph_duration_shrink" title="Shrink the time range."> <i class="glyphicon glyphicon-minus"></i>
<i class="icon-minus"></i>
</button> </button>
<input class="input-mini" title="Time range of graph" type="text" id="prom_graph_duration"> <input class="input pull-left" size="3" title="Time range of graph" type="text" id="prom_graph_duration">
<button class="btn btn-mini" type="button" id="prom_graph_duration_grow" title="Grow the time range."> <button class="btn btn-default pull-left" type="button" id="prom_graph_duration_grow" title="Grow the time range.">
<i class="icon-plus"></i> <i class="glyphicon glyphicon-plus"></i>
</button> </button>
</div> </div>
<label for="prom_graph_duration">End:</label>
<div class="input-prepend input-append"> <div class="prom_graph_timecontrol_group">
<button class="btn btn-mini" type="button" id="prom_graph_time_back" title="Rewind the end time."> <button class="btn btn-default pull-left" type="button" id="prom_graph_time_back" title="Rewind the end time.">
<i class="icon-backward"></i> <i class="glyphicon glyphicon-backward"></i>
</button> </button>
<input class="input-medium" title="End time of graph" placeholder="Until" type="text" id="prom_graph_time_end" size="16" value=""> <input class="input pull-left" title="End time of graph" placeholder="Until" type="text" id="prom_graph_time_end" size="16" value="">
<button class="btn btn-mini" type="button" id="prom_graph_time_forward" title="Advance the end time."> <button class="btn btn-default pull-left" type="button" id="prom_graph_time_forward" title="Advance the end time.">
<i class="icon-forward"></i> <i class="glyphicon glyphicon-forward"></i>
</button> </button>
</div> </div>
<div class="input-prepend input-append">
<div class="btn-group dropup prom_graph_timecontrol_refresh"> <div class="prom_graph_timecontrol_group">
<button type="button" class="btn btn-mini" id="prom_graph_refresh_button"> <div class="btn-group dropup prom_graph_timecontrol_refresh pull-left">
<span class="icon-repeat"></span> <button type="button" class="btn btn-default pull-left" id="prom_graph_refresh_button" title="Refresh.">
(<span id="prom_graph_refresh_button_value">Off</span>) <i class="glyphicon glyphicon-repeat"></i>
<span class="icon-repeat"></span>
(<span id="prom_graph_refresh_button_value">Off</span>)
</button> </button>
<button type="button" class="btn btn-mini dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default pull-left dropdown-toggle" data-toggle="dropdown" title="Set autorefresh." aria-expanded="false">
<span class="caret"></span>&nbsp; <span class="caret"></span>&nbsp;
</button> </button>
<ul class="dropdown-menu" id="prom_graph_refresh_intervals" role="menu"> <ul class="dropdown-menu" id="prom_graph_refresh_intervals" role="menu">

View file

@ -10,7 +10,25 @@
{{template "prom_content_head" .}} {{template "prom_content_head" .}}
<h1>Node</h1> <h1>Node</h1>
Choose an instance on the left. <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)(rate(node_cpu{job='node',mode='idle',instance='%s'}[5m])))" .Labels.instance) "%" "printf.3g") }}</td>
<td>{{ template "prom_query_drilldown" (args (printf "node_memory_MemTotal{job='node',instance='%s'} - node_memory_MemFree{job='node',instance='%s'} - node_memory_Cached{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 "prom_content_tail" .}}
{{template "tail"}} {{template "tail"}}

View file

@ -1,7 +1,11 @@
.prom_lhs_menu { .navbar {
margin-bottom: 0;
}
div.prom_lhs_menu {
float: left; float: left;
margin-right: 2ex; margin-right: 2ex;
background: #000000; background: #222;
min-height: 100%; min-height: 100%;
overflow: auto; overflow: auto;
} }
@ -26,12 +30,11 @@
pointer-events: none; pointer-events: none;
cursor: default; cursor: default;
} }
.prom_lhs_menu_selected { li.prom_lhs_menu_selected {
background: #555555; background: #555555;
background-clip: padding-box; background-clip: padding-box;
} }
.prom_lhs_menu span:hover, .prom_lhs_menu li:hover {
.prom_lhs_menu a:hover {
background: #666666; background: #666666;
} }
@ -56,15 +59,17 @@
margin-bottom: 32px; /* Space for time control. */ margin-bottom: 32px; /* Space for time control. */
} }
.prom_query_drilldown { a.prom_query_drilldown {
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
.prom_query_drilldown:hover, a.prom_query_drilldown:active { a.prom_query_drilldown:hover, a.prom_query_drilldown:active {
text-decoration: underline; text-decoration: underline;
} }
.prom_graph_table {
}
.rickshaw_legend { .rickshaw_legend {
padding: 2px; padding: 2px;
margin-top: 1px; margin-top: 1px;
@ -121,56 +126,45 @@ a.prom_graph_link {
.prom_graph_timecontrol { .prom_graph_timecontrol {
background: #000000; background: #222;
position: fixed; position: fixed;
padding: 2px; padding: 2px;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%;
text-align: center;
z-index: 2; z-index: 2;
width: 100%;
} }
.prom_graph_timecontrol_inner { .prom_graph_timecontrol_inner {
text-align: center;
height: 31px;
}
.prom_graph_timecontrol_group {
display: inline-block; display: inline-block;
margin: 1px 5px;
} }
.prom_graph_timecontrol button { .prom_graph_timecontrol_group .btn {
font-size: 10pt; font-size: 0.8em;
margin-right: .3em; border-radius: 0;
padding-top: 2px; height: 29px;
padding-bottom: 2px;
} }
.prom_graph_timecontrol_refresh button {
padding-top: 0; .prom_graph_timecontrol_group .input {
padding-bottom: 0; height: 29px;
border-bottom: 0; padding: 6px 12px;
border-top: 0; font-size: 14px;
} line-height: 1.42857143;
.prom_graph_timecontrol_refresh .dropdown-menu { color: #555;
min-width: 70px; background-color: #fff;
padding-top: 0; background-image: none;
padding-bottom: 0; border: 1px solid #ccc;
}
.prom_graph_timecontrol input {
font-size: 10pt;
margin-left: -4px;
margin-right: -4px;
text-align: center; text-align: center;
} }
.prom_graph_timecontrol label {
display: inline; .prom_graph_timecontrol_group .dropdown-menu {
color: #999999; min-width: 90px;
} }
.prom_graph_timecontrol .input-append { .prom_graph_timecontrol_group .dropdown-menu li {
margin: 2px; text-align: center;
}
.prom_graph_timecontrol .input-append .btn:first-child i {
margin-right: 4px;
margin-left: 2px;
}
.prom_graph_timecontrol .input-append .btn:last-child i {
margin-left: 6px;
}
.prom_graph_timecontrol .input-append i {
padding-top: -4px;
margin-top: 0;
} }