DolphinDB提供网页的形式检查各个集群的指标状态,只需要进入网页即可: http://ip地址:控制节点端口/default.html
如果要要动态的获取数据,有一种方案,可以在某台服务器上,单独起一个DolphinDB单节点,端口默认8848就可以【建议这里的dolphindb名称做修改,不然停服务很容易被一起关闭】,然后:
1)通过,xdb 函数获取到集群控制节点的连接
2)通过,remoteRun(conn,getClusterPerf) 获取集群的各个指标项
3)获取的指标项作为表数据保存到单节点流表或者分布式表中(如果只是临时用,就放在流表中,如果是单代理节点,3个数据节点,每秒获取一次指标,一天的数据量占用内存在百兆左右)
参考脚本(在单节点中执行):
// 单节点8848端口 login(`admin, `123456, false) // 8900 为控制节点端口 conn = xdb("xx.xx.xx.xx",8900) a=remoteRun(conn,getClusterPerf) names = a.schema().colDefs.name join "timest" types = a.schema().colDefs.typeString join TIMESTAMP // dropStreamTable(`nodestat); share streamTable(1:0,names, types) as nodestat def getstat(){ conn = xdb("xx.xx.xx.xx",8900) do{ t = remoteRun(conn,getClusterPerf); // 打上时间戳 t = select *,now() as timest from t; nodestat.append!(t) // 每隔1秒获取一次 sleep(1*1000); }while(true) } //getstat(); submitJob(`statWatch,`statWatch,getstat) // cancelJob(`statWatch) // 将监控指标数据保存到csv中 t = select * from nodestat saveText(t,"/home/stat.csv")
获取了csv数据后,可以使用excel或者wps的,插入 - 数据透视图,以timest时间戳为轴,获取各个指标的趋势图