-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathprinting.dashboard.py
More file actions
86 lines (78 loc) · 2.09 KB
/
printing.dashboard.py
File metadata and controls
86 lines (78 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from grafanalib.core import Dashboard, Templating, Template, TimeSeries, Target, GridPos
from grafanalib.formatunits import PERCENT_UNIT, SECONDS
from wrapper import SceGrafanalibWrapper, ExpressionAndLegendPair
from common import PROMETHEUS_DATASOURCE_NAME
wrapper = SceGrafanalibWrapper(title='Quasar')
wrapper.AddPanel(
title='Ink Level',
queries=[
ExpressionAndLegendPair(
'snmp_metric{name=\"ink_level\",ip=\"192.168.69.149\"} / ignoring(name) group_left() snmp_metric{name=\"ink_capacity\",ip=\"192.168.69.149\"}',
'Left Printer {{ip}}'
),
ExpressionAndLegendPair(
'snmp_metric{name=\"ink_level\",ip=\"192.168.69.208\"} / ignoring(name) group_left() snmp_metric{name=\"ink_capacity\",ip=\"192.168.69.208\"}',
'Right Printer {{ip}}'
)
],
unit=PERCENT_UNIT,
dydt=False,
lineWidth=2,
stacking={'group': 'A','mode': 'none'},
tooltipMode='all',
tooltipSort='desc',
)
wrapper.AddPanel(
title='# of Pages Printed',
queries=[
ExpressionAndLegendPair(
'snmp_metric{name=\"page_count\"}',
'{{ip}}',
)
],
dydt=False,
lineWidth=2,
tooltipMode='all',
tooltipSort='desc',
)
wrapper.AddPanel(
title='SNMP Request Duration',
unit=SECONDS,
queries=[
ExpressionAndLegendPair(
'snmp_request_duration_sum/snmp_request_duration_count',
'__auto',
)
],
dydt=False,
lineWidth=2,
tooltipMode='all',
tooltipSort='desc',
)
wrapper.AddPanel(
title='Print Jobs Recieved',
queries=[
ExpressionAndLegendPair(
'rate(print_jobs_recieved_total[$__rate_interval])',
'__auto',
)
],
dydt=False,
lineWidth=2,
tooltipMode='all',
tooltipSort='desc',
)
wrapper.AddPanel(
title='Active SNMP Errors',
queries=[
ExpressionAndLegendPair(
'snmp_error == 1',
'{{ip}} {{name}}',
)
],
dydt=False,
lineWidth=2,
tooltipMode='all',
tooltipSort='desc',
)
dashboard = wrapper.Render()