Commit ec3366aa authored by Rizwan Shakoor's avatar Rizwan Shakoor

Added JVM Dashboard Jsonnet with multiple panels

parent a70de349
Pipeline #4064 passed with stages
in 13 seconds
local grafana = import 'grafonnet-lib/grafonnet/grafana.libsonnet';
local barGaugePanel = grafana.barGaugePanel;
local dashboard = grafana.dashboard;
local row = grafana.row;
local template = grafana.template;
local logPanel = grafana.logPanel;
local prometheus = grafana.prometheus;
local tablePanel = grafana.tablePanel;
local tablePanel = grafana.tablePanel;
local singleStat = grafana.singlestat;
local gaugePanel = grafana.gaugePanel;
local steps = [
{color: 'green', value: 0, op: 'gt'},
{color: 'orange', value: 52428800, op: 'gt'},
{color: 'red', value: 419430400, op: 'gt'},
];
local steps_1 = [
{color: 'green', value: 0, op: 'gt'},
{color: 'orange', value: 21474836480, op: 'gt'},
{color: 'red', value: 42949672960, op: 'gt'},
];
local steps_2 = [
{color: 'green', value: 10, text: 'High'},
{color: 'orange', value: 10, text: 'Low', },
];
grafana.dashboard.new(
'JVM',
uid='ABCXYZ123',
refresh='1m',
time_from='now-1h',
editable=true,
tags=['java']
)
.addTemplate(
grafana.template.datasource(
'prometheus',
'prometheus',
'Prometheus',
hide='label',
)
).addTemplate(
template.new(
'instance',
'Prometheus',
'label_values(jvm_threads_daemon_threads, instance)',
label='instance',
refresh='time',
)
)
.addTemplate(
template.new(
'job',
'Prometheus',
'label_values(jvm_threads_daemon_threads{instance="$instance"}, job)',
label='Job',
refresh='time',
)
).addRow(
row.new(
'Basic Stats',
)
.addPanel(
singleStat.new(
'Jvm GC Memory allocation(in GegaBytes)',
span=4,
prefix='',
postfix='',
colorBackground=true,
colorValue=true,
thresholds="10,25",
colors=[
'rgba(237, 129, 40, 0.89)',
'rgba(255, 255, 0, 1)',
'#d44a3a',
]
)
.addTarget(
prometheus.target(
'((jvm_gc_memory_allocated_bytes_total{job="$job",instance="$instance"}) / (1024 * 1024 * 1024))',
datasource='Prometheus',
)
)
).addPanel(gaugePanel.new('Jvm buffer capacity',
datasource='Prometheus',
min=0,
max=1073741824,
unit='bytes',
showThresholdLabels=false,
showThresholdMarkers=true,
transparent=false,
).addThresholds(steps)
.addTarget(
prometheus.target(
expr='max(jvm_buffer_total_capacity_bytes{job="$job",instance="$instance"})',
datasource='Prometheus',
legendFormat='buffer capacity'
)
),
gridPos={ h: 15, w: 30, x: 0, y: 0 }
).addPanel(gaugePanel.new('Jvm Memory Max Bytes',
datasource='Prometheus',
min=0,
max=53687091200,
unit='bytes',
showThresholdLabels=false,
showThresholdMarkers=true,
transparent=false,
).addThresholds(steps_1)
.addTarget(
prometheus.target(
expr='max(jvm_memory_max_bytes{job="$job",instance="$instance"})',
datasource='Prometheus',
legendFormat='buffer capacity'
)
),
gridPos={ h: 15, w: 30, x: 0, y: 0 }
)
).addRow(
row.new(
'Graph Stats',
).addPanel(
grafana.graphPanel.new('Graph representation of Jvm GC pause',
datasource='Prometheus',
legend_show=true,
shared_tooltip=true,
show_xaxis=true,
x_axis_mode="Time",
format='short',
span=12,
labelY1='Short',
fill=0,
bars = { // add the 'bars' object here
mode: 'stackedPercent',
width: 1.5 // increase bar width
}
)
.addTarget(
prometheus.target(
hide=false,
expr='jvm_gc_pause_seconds_sum{job="$job",instance="$instance"}',
legendFormat='Jvm GC pause second sum',
)
),
gridPos={ h: 8, w: 6, x: 6, y: 0 }
).addPanel(
grafana.statPanel.new('Stat Panel representation of Jvm Threads state',
datasource='Prometheus',
allValues=false,
colorMode='background',
graphMode='none'
).addThresholds(steps_2)
.addTarget(
prometheus.target(
hide=false,
expr='jvm_threads_states_threads{job="$job",instance="$instance"}',
legendFormat='{{state}}',
)
),
gridPos={ h: 10, w: 20, x: 0, y: 20 }
).addPanel(
barGaugePanel.new(
title='Jvm GC Allocated memory in Bytes',
datasource='Prometheus',
thresholds=steps,
)
.addTarget(
grafana.prometheus.target(
expr='sum(jvm_classes_loaded_classes{job="$job",instance="$instance"})',
)
) + {
options: {
displayMode:'lcd'
},
},
gridPos = { h: 8, w: 8, x: 8, y: 10 }
)
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment