def get_environment(self):
environment = {}<EOL>sys_resources = self._send_command("<STR_LIT>")<EOL>temp_cmd = "<STR_LIT>"<EOL>environment.setdefault("<STR_LIT>", {})<EOL>environment["<STR_LIT>"]["<STR_LIT:0>"] = {}<EOL>environment["<STR_LIT>"]["<STR_LIT:0>"]["<STR_LIT>"] = -<NUM_LIT:1.0><EOL>system_resources_cpu = helpers.textfsm_extractor(<EOL>self, "<STR_LIT>", sys_resources<EOL>)<EOL>for cpu in system_resources_cpu:<EOL><INDENT>cpu_dict = {<EOL>cpu.get("<STR_LIT>"): {<EOL>"<STR_LIT>": round(<NUM_LIT:100> - float(cpu.get("<STR_LIT>")), <NUM_LIT:2>)<EOL>}<EOL>}<EOL>environment["<STR_LIT>"].update(cpu_dict)<EOL><DEDENT>environment.setdefault("<STR_LIT>", {})<EOL>for line in sys_resources.splitlines():<EOL><INDENT>if "<STR_LIT>" in line:<EOL><INDENT>proc_total_mem, proc_used_mem, _ = line.split("<STR_LIT:U+002C>")<EOL>proc_used_mem = re.search(r"<STR_LIT>", proc_used_mem).group(<NUM_LIT:0>)<EOL>proc_total_mem = re.search(r"<STR_LIT>", proc_total_mem).group(<NUM_LIT:0>)<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(line))<EOL><DEDENT>environment["<STR_LIT>"]["<STR_LIT>"] = int(proc_used_mem)<EOL>environment["<STR_LIT>"]["<STR_LIT>"] = int(proc_total_mem)<EOL>output = self._send_command(temp_cmd)<EOL>environment.setdefault("<STR_LIT>", {})<EOL>for line in output.splitlines():<EOL><INDENT>if re.match(r"<STR_LIT>", line):<EOL><INDENT>module, sensor, is_critical, is_alert, temp, _ = line.split()<EOL>is_critical = float(is_critical)<EOL>is_alert = float(is_alert)<EOL>temp = float(temp)<EOL>env_value = {<EOL>"<STR_LIT>": temp >= is_alert,<EOL>"<STR_LIT>": temp >= is_critical,<EOL>"<STR_LIT>": temp,<EOL>}<EOL>location = "<STR_LIT>".format(sensor, module)<EOL>environment["<STR_LIT>"][location] = env_value<EOL><DEDENT><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