From 11375a5be94d6d53003844b415dc6664e6c91927 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Sun, 2 Aug 2015 15:41:15 +0100 Subject: [PATCH] Add SNMP consoles --- console_libraries/menu.lib | 14 +++++++++++++ consoles/snmp-overview.html | 36 ++++++++++++++++++++++++++++++++ consoles/snmp.html | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 consoles/snmp-overview.html create mode 100644 consoles/snmp.html diff --git a/console_libraries/menu.lib b/console_libraries/menu.lib index 3619d3c81..261aea6a4 100644 --- a/console_libraries/menu.lib +++ b/console_libraries/menu.lib @@ -83,6 +83,20 @@ {{ end }} +{{ if query "up{job='snmp'}" }} +{{ template "_menuItem" (args . "snmp.html" "SNMP") }} +{{ if match "^snmp" .Path }} + {{ if .Params.instance }} + + {{ end }} +{{ end }} +{{ end }} + + {{ if query "up{job='cloudwatch'}" }} {{ template "_menuItem" (args . "cloudwatch.html" "CloudWatch") }} {{ end }} diff --git a/consoles/snmp-overview.html b/consoles/snmp-overview.html new file mode 100644 index 000000000..d81c42f96 --- /dev/null +++ b/consoles/snmp-overview.html @@ -0,0 +1,36 @@ +{{ template "head" . }} + +{{ template "prom_content_head" . }} +

SNMP Device Overview - {{ .Params.instance }}

+ + + + + + + + + + + +{{ range query (printf "ifOperStatus{job='snmp',instance='%s'}" .Params.instance) | sortByLabel "ifDescr" }} + + + + + + + + + +{{ end }} +{{ template "prom_content_tail" . }} + +{{ template "tail" }} diff --git a/consoles/snmp.html b/consoles/snmp.html new file mode 100644 index 000000000..cb4e3ddb4 --- /dev/null +++ b/consoles/snmp.html @@ -0,0 +1,41 @@ +{{ template "head" . }} + +{{ template "prom_right_table_head" }} + + + + +{{ template "prom_right_table_tail" }} + +{{ template "prom_content_head" . }} +

SNMP

+ +
PortStatusSpeedInOutDiscardsErrors
{{ .Labels.ifDescr }}up + {{ else if eq (. | value) 2.0}}">down + {{ else if eq (. | value) 3.0}}">testing + {{ else if eq (. | value) 4.0}}">unknown + {{ else if eq (. | value) 5.0}}">dormant + {{ else if eq (. | value) 6.0}}">notPresent + {{ else if eq (. | value) 7.0}}">lowerLayerDown + {{else}}">{{ end }}{{ template "prom_query_drilldown" (args (printf "ifHighSpeed{job='snmp',instance='%s',ifDescr='%s'} * 1e6 or ifSpeed{job='snmp',instance='%s',ifDescr='%s'}" .Labels.instance .Labels.ifDescr .Labels.instance .Labels.ifDescr) "b/s" "humanize")}}{{ template "prom_query_drilldown" (args (printf "rate(ifHCInOctets{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8 or rate(ifInOctets{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8" .Labels.instance .Labels.ifDescr .Labels.instance .Labels.ifDescr) "b/s" "humanize")}}{{ template "prom_query_drilldown" (args (printf "rate(ifHCOutOctets{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8 or rate(ifOutOctets{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8" .Labels.instance .Labels.ifDescr .Labels.instance .Labels.ifDescr) "b/s" "humanize")}}{{ template "prom_query_drilldown" (args (printf "rate(ifInDiscards{job='snmp',instance='%s',ifDescr='%s'}[5m]) + rate(ifOutDiscards{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8" .Labels.instance .Labels.ifDescr .Labels.instance .Labels.ifDescr) "/s" "humanizeNoSmallPrefix")}}{{ template "prom_query_drilldown" (args (printf "rate(ifInErrors{job='snmp',instance='%s',ifDescr='%s'}[5m]) + rate(ifOutErrors{job='snmp',instance='%s',ifDescr='%s'}[5m]) * 8" .Labels.instance .Labels.ifDescr .Labels.instance .Labels.ifDescr) "/s" "humanizeNoSmallPrefix")}}
SNMP{{ template "prom_query_drilldown" (args "sum(up{job='snmp'})") }} / {{ template "prom_query_drilldown" (args "count(up{job='snmp'})") }}
+ + + + + + + + + + +{{ range query "up{job='snmp'}" | sortByLabel "instance" }} + + + + + + + + + + +{{ else }} + +{{ end }} + +{{ template "prom_content_tail" . }} + +{{ template "tail" }}
DeviceUpPorts UpPorts TotalInOutDiscardsErrors
{{ .Labels.instance }}Yes{{ else }} class="alert-danger">No{{ end }}{{ query (printf "ifOperStatus{job='snmp',instance='%s'} == 1" .Labels.instance) | len }}{{ template "prom_query_drilldown" (args (printf "count(ifOperStatus{job='snmp',instance='%s'})" .Labels.instance) ) }}{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(rate(ifHCInOctets{job='snmp',instance='%s'}[5m]) or rate(ifInOctets{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "b/s" "humanize")}}{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(rate(ifHCOutOctets{job='snmp',instance='%s'}[5m]) or rate(ifOutOctets{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "b/s" "humanize")}}{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(rate(ifInDiscards{job='snmp',instance='%s'}[5m]) or rate(ifOutDiscards{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "/s" "humanizeNoSmallPrefix")}}{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(rate(ifInErrors{job='snmp',instance='%s'}[5m]) or rate(ifOutErrors{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "/s" "humanizeNoSmallPrefix")}}
No devices found.