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_total_mem, proc_used_mem, _ = line.split()[:<NUM_LIT:5>]<EOL><DEDENT>elif "<STR_LIT>" in line or "<STR_LIT>" in line:<EOL><INDENT>_, _, io_total_mem, io_used_mem, _ = line.split()[:<NUM_LIT:5>]<EOL><DEDENT><DEDENT>total_mem = int(proc_total_mem) + int(io_total_mem)<EOL>used_mem = int(proc_used_mem) + int(io_used_mem)<EOL>environment.setdefault("<STR_LIT>", {})<EOL>environment["<STR_LIT>"]["<STR_LIT>"] = used_mem<EOL>environment["<STR_LIT>"]["<STR_LIT>"] = total_mem<EOL>environment.setdefault("<STR_LIT>", {})<EOL>re_temp_value = re.compile("<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>m = re_temp_value.match(line)<EOL>if m is not None:<EOL><INDENT>temp_name = m.group(<NUM_LIT:1>).lower()<EOL>temp_value = float(line.split("<STR_LIT::>")[<NUM_LIT:1>].split()[<NUM_LIT:0>])<EOL>env_value = {<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": temp_value,<EOL>}<EOL>environment["<STR_LIT>"][temp_name] = env_value<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>if temp_value > system_temp_alert:<EOL><INDENT>env_value["<STR_LIT>"] = True<EOL><DEDENT><DEDENT>elif "<STR_LIT>" in line:<EOL><INDENT>system_temp_crit = float(line.split("<STR_LIT::>")[<NUM_LIT:1>].split()[<NUM_LIT:0>])<EOL>if temp_value > system_temp_crit:<EOL><INDENT>env_value["<STR_LIT>"] = True<EOL><DEDENT><DEDENT><DEDENT><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>"] = {<EOL>"<STR_LIT:status>": True,<EOL>"<STR_LIT>": -<NUM_LIT:1.0>,<EOL>"<STR_LIT>": -<NUM_LIT:1.0>,<EOL>}<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)