Skip to content

Commit

Permalink
fixes #8 - cpu-temperature not always present
Browse files Browse the repository at this point in the history
  • Loading branch information
lampwins committed Dec 11, 2017
1 parent 2a3665b commit 9755ad2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ def get_route_engine_metrics(registry, dev):
registry.add_metric('chassisTemp', temp_element.attrib['celsius'], {**meta, **{'fahrenheit': temp_f}})

# cpu temp
temp_f = route_engine.find('cpu-temperature').text.strip().split('/')[1].split(' ')[1]
registry.add_metric('cpuTemp', route_engine.find('cpu-temperature').attrib['celsius'], {**meta, **{'fahrenheit': temp_f}})
temp_f = route_engine.find('cpu-temperature')
if temp_f is not None:
temp_f = temp_f.text.strip().split('/')[1].split(' ')[1]
registry.add_metric('cpuTemp', route_engine.find('cpu-temperature').attrib['celsius'], {**meta, **{'fahrenheit': temp_f}})

# cpu
cpu_user = route_engine.find('cpu-user').text.strip()
Expand Down

0 comments on commit 9755ad2

Please sign in to comment.