def get_cpu_temperature(): """get the current cpu temperature""" server = '${node.metadata['collectd'].get('fritzbox', {}).get('ip', '192.168.168.1')}' password = '******'collectd'].get('fritzbox', {}).get('password', 'fritzbox')}' sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: print 'temp.value %d' % (int(m.group(2).split(',')[0]))
def get_connected_wifi_devices(): """gets the numbrer of currently connected wifi devices""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: connected_devices = int(m.group(1)) print 'wifi.value %d' % connected_devices
def get_power_consumption(): """get the current power consumption usage""" server = '${node.metadata['collectd'].get('fritzbox', {}).get('ip', '192.168.168.1')}' password = '******'collectd'].get('fritzbox', {}).get('password', 'fritzbox')}' sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print'%s.value %d' % (DEVICE_MAPPING[m.group(1)], int(m.group(2)))
def get_connected_wifi_devices(): """gets the numbrer of currently connected wifi devices""" server = '${node.metadata['collectd'].get('fritzbox', {}).get('ip', '192.168.168.1')}' password = '******'collectd'].get('fritzbox', {}).get('password', 'fritzbox')}' sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: connected_devices = int(m.group(1)) print 'wifi.value %d' % connected_devices
def get_power_consumption(): """get the current power consumption usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print '%s.value %d' % (DEVICE_MAPPING[m.group(1)], int(m.group(2)))
def get_cpu_temperature(): """get the current cpu temperature""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: print 'temp.value %d' % (int(m.group(1)))
def get_memory_usage(): """get the current memory usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print'%s.value %d' % (USAGE_MAPPING[m.group(1)], int(m.group(2).split(',')[0]))
def get_connected_wifi_devices(): """gets the numbrer of currently connected wifi devices""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: connected_devices = int(m.group(1)) print('wifi.value %d' % connected_devices)
def get_memory_usage(): """get the current memory usage""" server = '${node.metadata['collectd'].get('fritzbox', {}).get('ip', '192.168.168.1')' password = '******'collectd'].get('fritzbox', {}).get('password', 'fritzbox')}' sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print'%s.value %d' % (USAGE_MAPPING[m.group(1)], int(m.group(2).split(',')[0]))
def get_power_consumption(): """get the current power consumption usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print'%s.value %d' % (DEVICE_MAPPING[m.group(1)], int(m.group(2)))
def get_cpu_usage(): """get the current cpu usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: print 'cpu.value %d' % (int(m.group(2).split(',')[0]))
def get_memory_usage(): """get the current memory usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: data = zip(USAGE, [m.group(1) for m in matches]) for d in data: print'%s.value %s' % (d[0], d[1])
def get_cpu_temperature(): """get the current cpu temperature""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] username = os.environ.get('fritzbox_username') sid = fh.get_sid(server, password, username) data = fh.get_page(server, sid, PAGE) m = re.search(pattern, data) if m: print 'temp.value %d' % (int(m.group(2).split(',')[0]))
def get_power_consumption(): """get the current power consumption usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: data = zip(DEVICES, [m.group(4) for m in matches]) for d in data: print '%s.value %s' % (d[0], d[1])
def get_memory_usage(): """get the current memory usage""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: for m in matches: print '%s.value %d' % (USAGE_MAPPING[m.group(1)], int(m.group(2).split(',')[0]))
def get_uptime(): """get the current uptime""" server = '${node.metadata['collectd'].get('fritzbox', {}).get('ip', '192.168.168.1')}' password = '******'collectd'].get('fritzbox', {}).get('password', 'fritzbox')}' sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: hours = 0.0 for m in matches: if m.group(1) == "uptime_hours": hours += int(m.group(2)) if m.group(1) == "uptime_minutes": hours += int(m.group(2)) / 60.0 uptime = hours / 24 print "uptime.value %.2f" % uptime
def get_uptime(): """get the current uptime""" server = os.environ['fritzbox_ip'] password = os.environ['fritzbox_password'] sid = fh.get_sid(server, password) data = fh.get_page(server, sid, PAGE) matches = re.finditer(pattern, data) if matches: hours = 0.0 for m in matches: if m.group(1) == "uptime_hours": hours += int(m.group(2)) if m.group(1) == "uptime_minutes": hours += int(m.group(2)) / 60.0 uptime = hours / 24 print "uptime.value %.2f" % uptime