def get_environment(self):
environment = {}<EOL>cpu_cmd = '<STR_LIT>'<EOL>mem_cmd = '<STR_LIT>'<EOL>temp_cmd = '<STR_LIT>'<EOL>output = self._send_command(cpu_cmd)<EOL>environment.setdefault('<STR_LIT>', {})<EOL>environment['<STR_LIT>'][<NUM_LIT:0>] = {}<EOL>environment['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>'] = <NUM_LIT:0.0><EOL>for line in output.splitlines():<EOL><INDENT>if '<STR_LIT>' in line:<EOL><INDENT>cpu_regex = r'<STR_LIT>'<EOL>match = re.search(cpu_regex, line)<EOL>environment['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>'] = float(match.group(<NUM_LIT:1>))<EOL>break<EOL><DEDENT><DEDENT>output = self._send_command(mem_cmd)<EOL>for line in output.splitlines():<EOL><INDENT>if '<STR_LIT>' in line:<EOL><INDENT>_, _, _, proc_used_mem, proc_free_mem = line.split()[:<NUM_LIT:5>]<EOL><DEDENT>elif '<STR_LIT>' in line or '<STR_LIT>' in line:<EOL><INDENT>_, _, _, io_used_mem, io_free_mem = line.split()[:<NUM_LIT:5>]<EOL><DEDENT><DEDENT>used_mem = int(proc_used_mem) + int(io_used_mem)<EOL>free_mem = int(proc_free_mem) + int(io_free_mem)<EOL>environment.setdefault('<STR_LIT>', {})<EOL>environment['<STR_LIT>']['<STR_LIT>'] = used_mem<EOL>environment['<STR_LIT>']['<STR_LIT>'] = free_mem<EOL>environment.setdefault('<STR_LIT>', {})<EOL>output = self._send_command(temp_cmd)<EOL>if '<STR_LIT>' not in output:<EOL><INDENT>for line in output.splitlines():<EOL><INDENT>if '<STR_LIT>' in line:<EOL><INDENT>system_temp = float(line.split('<STR_LIT::>')[<NUM_LIT:1>].split()[<NUM_LIT:0>])<EOL><DEDENT>elif '<STR_LIT>' in line:<EOL><INDENT>system_temp_alert = float(line.split('<STR_LIT::>')[<NUM_LIT:1>].split()[<NUM_LIT:0>])<EOL><DEDENT>elif '<STR_LIT>' in line:<EOL><INDENT>system_temp_crit = float(line.split('<STR_LIT::>')[<NUM_LIT:1>].split()[<NUM_LIT:0>])<EOL><DEDENT><DEDENT>env_value = {'<STR_LIT>': system_temp >= system_temp_alert,<EOL>'<STR_LIT>': system_temp >= system_temp_crit, '<STR_LIT>': system_temp}<EOL>environment['<STR_LIT>']['<STR_LIT>'] = env_value<EOL><DEDENT>else:<EOL><INDENT>env_value = {'<STR_LIT>': False, '<STR_LIT>': False, '<STR_LIT>': -<NUM_LIT:1.0>}<EOL>environment['<STR_LIT>']['<STR_LIT>'] = env_value<EOL><DEDENT>environment.setdefault('<STR_LIT>', {})<EOL>environment['<STR_LIT>']['<STR_LIT>'] = {'<STR_LIT:status>': True, '<STR_LIT>': -<NUM_LIT:1.0>, '<STR_LIT>': -<NUM_LIT:1.0>}<EOL>environment.setdefault('<STR_LIT>', {})<EOL>environment['<STR_LIT>']['<STR_LIT>'] = {'<STR_LIT:status>': True}<EOL>return environment<EOL>
Get environment facts.

power and fan are currently not implemented
cpu is using 1-minute average
cpu hard-coded to cpu0 (i.e. only a single CPU)