Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
8eb40f83
Commit
8eb40f83
authored
Dec 16, 2022
by
lu.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/ors-amarisoft: fixup check_cpu_temperature
parent
15569ea9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
software/ors-amarisoft/promise/check_cpu_temperature.py
software/ors-amarisoft/promise/check_cpu_temperature.py
+2
-2
No files found.
software/ors-amarisoft/promise/check_cpu_temperature.py
View file @
8eb40f83
...
@@ -79,12 +79,12 @@ class RunPromise(GenericPromise):
...
@@ -79,12 +79,12 @@ class RunPromise(GenericPromise):
data
=
psutil
.
sensors_temperatures
()
data
=
psutil
.
sensors_temperatures
()
cpu_temp
=
data
[
'coretemp'
][
0
][
1
]
cpu_temp
=
data
[
'coretemp'
][
0
][
1
]
l
=
get_data_interval
(
self
.
__log_file
,
max_avg_temp_duration
)
l
=
get_data_interval
(
self
.
__log_file
,
max_avg_temp_duration
)
or
[{
'cpu_temperature'
:
cpu_temp
}]
avg_temp
=
sum
(
map
(
lambda
x
:
x
[
'cpu_temperature'
],
l
))
/
len
(
l
)
avg_temp
=
sum
(
map
(
lambda
x
:
x
[
'cpu_temperature'
],
l
))
/
len
(
l
)
data
=
json
.
dumps
({
'cpu_temperature'
:
cpu_temp
,
'avg_cpu_temperature'
:
avg_temp
})
data
=
json
.
dumps
({
'cpu_temperature'
:
cpu_temp
,
'avg_cpu_temperature'
:
avg_temp
})
self
.
json_logger
.
info
(
"Temperature data"
,
extra
=
{
'data'
:
data
})
self
.
json_logger
.
info
(
"Temperature data"
,
extra
=
{
'data'
:
data
})
promise_success
=
True
promise_success
=
True
if
cpu_temp
>
max_temp
:
if
cpu_temp
>
max_temp
:
self
.
logger
.
error
(
"Temperature reached critical threshold: %s degrees celsius (threshold is %s degrees celsius)"
%
(
cpu_temp
,
max_temp
))
self
.
logger
.
error
(
"Temperature reached critical threshold: %s degrees celsius (threshold is %s degrees celsius)"
%
(
cpu_temp
,
max_temp
))
...
...
Write
Preview
Markdown
is supported
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