def createProcInfoPoint (self, node, proc, end_time=None): #change 01/17/2021: change to one_month.node_proc_info, hostname+jid as tag point = {'measurement':'node_proc_info2', 'time': (int)(proc['create_time'])} point['tags'] = {'hostname':node, 'pid': proc['pid']} point['fields'] = MyTool.flatten(MyTool.sub_dict(proc, ['ppid', 'uid', 'jid', 'name', 'cmdline'])) if end_time: point['fields']['end_time'] = end_time point['fields']['status'] = proc['status'] point['fields'].update (MyTool.flatten(MyTool.sub_dict(proc, ['mem', 'io', 'num_fds', 'cpu'], default=0))) return point
def hostperf2point(self, msg): #{'load': [0.29, 0.29, 0.44], 'cpu_times': {'iowait': 553.4, 'idle': 6050244.96, 'user': 12374.76, 'system': 2944.12}, 'proc_total': 798, 'hdr': {'hostname': 'ccalin007', 'msg_process': 'cluster_host_mon', 'msg_type': 'cluster/hostperf', 'msg_ts': 1541096161.66126}, 'mem': {'available': 196645462016, 'used': 8477605888, 'cached': 3937718272, 'free': 192701874176, 'total': 201179480064, 'buffers': 5869568}, 'net_io': {'rx_err': 0, 'rx_packets': 6529000, 'rx_bytes': 5984570284, 'tx_err': 0, 'tx_drop': 0, 'tx_bytes': 6859935273, 'tx_packets': 6987776, 'rx_drop': 0}, 'proc_run': 1, 'disk_io': {'write_bytes': 7890793472, 'read_count': 130647, 'write_count': 221481, 'read_time': 19938, 'read_bytes': 2975410176, 'write_time': 6047344}} ts = msg['hdr']['msg_ts'] point = {'measurement':'cpu_load', 'time': (int)(ts)} point['tags'] = {'hostname' : msg['hdr']['hostname']} point['fields'] = MyTool.flatten(MyTool.sub_dict(msg, ['cpu_times', 'mem', 'net_io', 'disk_io'])) point['fields'].update ({'load_1min':msg['load'][0], 'load_5min':msg['load'][1], 'load_15min':msg['load'][2], 'proc_total':msg['proc_total'], 'proc_run': msg['proc_run']}) return [point]
def createProcMonPoint (self, node, ts, proc): #point['fields'] = MyTool.flatten(MyTool.sub_dict(proc, ['create_time', 'jid', 'mem', 'io', 'num_fds', 'cpu'], default=0)) #change 01/23/2020: change name from cpu_proc_mon to node_proc_mon # remove uid from tags #change 01/17/2021: change to one_month.node_proc_mon, hostname+jid as tag #change 01/19/2021: change to one_month.node_proc_mon, hostname+jid+pid as tag #point = {'measurement':'node_proc_mon1', 'time': ts} #point['tags'] = {'hostname':node, 'jid':proc['jid'], 'pid':proc['pid']} #point['fields'] = MyTool.flatten(MyTool.sub_dict(proc, ['uid', 'io', 'num_fds', 'cpu'], default=0)) point = {'measurement':'node_proc_mon2', 'time': ts} point['tags'] = {'hostname':node, 'pid':proc['pid']} point['fields'] = MyTool.flatten(MyTool.sub_dict(proc, ['uid', 'jid', 'io', 'num_fds', 'cpu'], default=0)) point['fields']['status'] = querySlurm.SlurmStatus.getStatusID(proc['status']) point['fields']['mem_data'] = round(proc['mem']['data'] / 1024) point['fields']['mem_rss'] = round(proc['mem']['rss'] / 1024) point['fields']['mem_shared']= round(proc['mem']['shared'] / 1024) point['fields']['mem_text'] = round(proc['mem']['text'] / 1024) point['fields']['mem_vms'] = round(proc['mem']['vms'] / 1024) if 'cpu_affinity' in point['fields']: point['fields'].pop('cpu_affinity') return point