Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Koch
monitoring-ws20
Commits
b91fac1d
Commit
b91fac1d
authored
Nov 28, 2021
by
wolfsack
Browse files
Update metrics.py
parent
50a150ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
project/pi/app/metrics.py
View file @
b91fac1d
import
platform
import
platform
,
time
import
psutil
...
...
@@ -11,8 +11,10 @@ def metrics(node: int):
cores_physical
=
psutil
.
cpu_count
(
logical
=
False
)
memory
=
psutil
.
virtual_memory
()
boot_time
=
psutil
.
boot_time
()
system_time
=
time
.
time
()
partitions
=
psutil
.
disk_partitions
()
metrics_list
=
[
Metric
(
metric_name
=
"cpu_usage"
,
metric_type
=
"gauge"
,
...
...
@@ -42,11 +44,19 @@ def metrics(node: int):
),
Metric
(
metric_name
=
"boot_time"
,
metric_type
=
"gauge"
,
comment
=
"Time in
m
s"
,
comment
=
"Time in s
ec since epoch
"
,
value
=
boot_time
,
params
=
{
"node"
:
f
"
{
node
}
"
}
),
Metric
(
metric_name
=
"system_time"
,
metric_type
=
"gauge"
,
comment
=
"Time in sec since epoch"
,
value
=
system_time
,
params
=
{
"node"
:
f
"
{
node
}
"
}
),
Metric
(
metric_name
=
"memory_usage"
,
metric_type
=
"gauge"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment