Skip to content

Commit

Permalink
Update platformutil name and plugin code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirut Getbamrung committed Dec 3, 2018
1 parent d3126f6 commit 5cf5217
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,34 @@
__author__ = 'Wirut G.<wgetbumr@celestica.com>'
__license__ = "GPL"
__version__ = "0.1.0"
__status__ = "Development"
__status__ = "Development"


import subprocess
import requests


class CpuTempUtil():
"""Platform-specific CpuTempUtil class"""

def __init__(self):
self.temp_url = "http://[fe80::1:1%eth0.4088]:8080/api/sys/temp"

pass

def get_cpu_temp(self):

# Get list of temperature of CPU cores.
p = subprocess.Popen(['sensors', '-Au', 'coretemp-isa-0000'], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p = subprocess.Popen(['sensors', '-Au', 'coretemp-isa-0000'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
raw_data_list = out.splitlines()
temp_string_list = [i for i, s in enumerate(raw_data_list) if '_input' in s]
temp_string_list = [i for i, s in enumerate(
raw_data_list) if '_input' in s]
tmp_list = [0]

for temp_string in temp_string_list:
tmp_list.append(float(raw_data_list[temp_string].split(":")[1]))

return tmp_list

return tmp_list

def get_max_cpu_tmp(self):
# Get maximum temperature from list of temperature of CPU cores.
Expand Down
2 changes: 1 addition & 1 deletion platform/broadcom/sonic-platform-modules-cel

0 comments on commit 5cf5217

Please sign in to comment.