diff --git a/console_libraries/menu.lib b/console_libraries/menu.lib index cd12e993a..a6acc51e6 100644 --- a/console_libraries/menu.lib +++ b/console_libraries/menu.lib @@ -57,6 +57,9 @@ {{ end }} {{ end }} +{{ if query "up{job='cassandra'}" }} +{{ template "_menuItem" (args . "cassandra.html" "Cassandra") }} +{{ end }} {{ if query "up{job='node'}" }} {{ template "_menuItem" (args . "node.html" "Node") }} diff --git a/console_libraries/prom.lib b/console_libraries/prom.lib index 32a5837e4..632a31577 100644 --- a/console_libraries/prom.lib +++ b/console_libraries/prom.lib @@ -36,11 +36,11 @@ 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")}} -{{ with query $expr }}{{ tmpl $renderTemplate ( . | first | value ) }}{{ $suffix }}{{else}}-{{ end }} +{{ $expr := .arg0 }}{{ $suffix := (or .arg1 "") }}{{ $renderTemplate := (or .arg2 "__prom_query_drilldown_noop") }} +{{ with query $expr }}{{tmpl $renderTemplate ( . | first | value )}}{{ $suffix }}{{ else }}-{{ end }} {{ end }} -{{ define "prom_path" }}/consoles/{{ .Path }}?{{range $param, $value := .Params}}{{$param}}={{$value}}&{{end}}{{ end }}" +{{ define "prom_path" }}/consoles/{{ .Path }}?{{ range $param, $value := .Params }}{{ $param }}={{ $value }}&{{ end }}{{ end }}" {{ define "prom_right_table_head" }}
@@ -49,9 +49,25 @@ renderTemplate is the name of the template to use to render the value. {{ define "prom_right_table_tail" }}
- {{ end }} +{{/* RHS table head, pass job name. Should be used after prom_right_table_head. */}} +{{ define "prom_right_table_job_head" }} + + {{ . }} + {{ template "prom_query_drilldown" (args (printf "sum(up{job='%s'})" .)) }} / {{ template "prom_query_drilldown" (args (printf "count(up{job='%s'})" .)) }} + + + CPU + {{ template "prom_query_drilldown" (args (printf "avg by(job)(rate(process_cpu_seconds_total{job='%s'}[5m]))" .) "s/s" "humanizeNoSmallPrefix") }} + + + Memory + {{ template "prom_query_drilldown" (args (printf "avg by(job)(process_resident_memory_bytes{job='%s'})" .) "B" "humanize1024") }} + +{{ end }} + + {{ define "prom_content_head" }}
@@ -83,7 +99,7 @@ renderTemplate is the name of the template to use to render the value. -
+
diff --git a/consoles/cassandra.html b/consoles/cassandra.html new file mode 100644 index 000000000..6ea6b865e --- /dev/null +++ b/consoles/cassandra.html @@ -0,0 +1,77 @@ +{{ template "head" . }} + +{{ template "prom_right_table_head" }} +{{ template "prom_right_table_job_head" "cassandra" }} + + Queries + {{ template "prom_query_drilldown" (args "sum by (job)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "/s" "humanizeNoSmallPrefix") }} + + + Timeout Ratio + {{ template "prom_query_drilldown" (args "sum by (job)(rate(cassandra_clientrequest_timeouts{job='cassandra'}[5m])) / sum by (job)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "" "humanizeNoSmallPrefix") }} + + + Unavailable Ratio + {{ template "prom_query_drilldown" (args "sum by (job)(rate(cassandra_clientrequest_unavailables{job='cassandra'}[5m])) / sum by (job)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "" "humanizeNoSmallPrefix") }} + +Internals + + Hints Inprogress + {{ template "prom_query_drilldown" (args "sum by (job)(cassandra_storage_totalhintsinprogress{job='cassandra'})" "" "humanize") }} + + + Blocked Tasks + {{ template "prom_query_drilldown" (args "sum by (job)(cassandra_threadpools_currentlyblockedtasks{job='cassandra'})" "" "humanize") }} + +Average Node Disk + + Compacted + {{ template "prom_query_drilldown" (args "avg by (job)(rate(cassandra_compaction_bytescompacted{job='cassandra'}[5m]))" "B/s" "humanize1024") }} + + + Live CF + {{ template "prom_query_drilldown" (args "avg by (job)(sum by (job, instance)(cassandra_columnfamily_totaldiskspaceused{job='cassandra'}))" "B" "humanize1024") }} + + + Total CF + {{ template "prom_query_drilldown" (args "avg by (job)(sum by (job, instance)(cassandra_columnfamily_totaldiskspaceused{job='cassandra'}))" "B" "humanize1024") }} + + + Commit Log + {{ template "prom_query_drilldown" (args "avg by (job)(cassandra_commitlog_totalcommitlogsize{job='cassandra'})" "B" "humanize1024") }} + +{{ template "prom_right_table_tail" }} + +{{ template "prom_content_head" .}} +

Cassandra

+ +

Client Queries

+
+ + +

Client Latency

+
+ +{{ template "prom_content_tail" . }} + +{{ template "tail" }} diff --git a/consoles/index.html.example b/consoles/index.html.example index 0b45a0760..f85d7a22c 100644 --- a/consoles/index.html.example +++ b/consoles/index.html.example @@ -25,6 +25,10 @@ CloudWatch Exporter cloudwatch + + Cassandra (JMX Exporter) + cassandra + {{ template "prom_content_tail" . }}