Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8391955
pergamon.uptime.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
793 B
Subscribers
None
pergamon.uptime.py
View Options
from
grafanalib.core
import
*
def
cpu_usage_graph
(
cpu
=
0
,
time_from
=
None
):
if
time_from
is
not
None
:
timeFrom
=
"
%s
"
%
(
time_from
,)
else
:
timeFrom
=
None
return
Graph
(
title
=
'Uptime'
,
dataSource
=
"Prometheus"
,
timeFrom
=
timeFrom
,
targets
=
[
Target
(
expr
=
'time() - node_boot_time_seconds{instance="192.168.100.29:9100"}'
,
legendFormat
=
"uptime"
,
refId
=
'A'
,
),
],
yAxes
=
[
YAxis
(
format
=
SECONDS_FORMAT
),
YAxis
(
format
=
SHORT_FORMAT
),
],
)
dashboard
=
Dashboard
(
title
=
"Pergamon uptime auto-generated"
,
rows
=
[
Row
(
title
=
'Uptime'
,
panels
=
[
cpu_usage_graph
(
'0'
),
cpu_usage_graph
(
'0'
,
"1y"
),
],
repeat
=
'cpu'
,
),
],)
.
auto_panel_ids
()
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Jun 4 2025, 6:52 PM (12 w, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3241028
Attached To
rDSNIP Code snippets
Event Timeline
Log In to Comment