1,CONFIGURATION OF DISCOVERY RULES
创建规则,填写ip地址范围,然后已用后面的key 来添加机器,在创建机器的时候也可以用一些先关的标准模板今天挂在,key 是system.uname
2,自定义添加java 端口监控
python脚本
#!/usr/bin/env python import os import json java_pid = os.popen("netstat -ntpl | grep java |grep -v 127 | awk ‘{print $7}‘|awk -F‘/‘ ‘{print $1}‘ | sort | uniq") ports = [] for pid in java_pid.readlines(): pid_s = os.path.basename(pid.strip()) java_ports = os.popen("cat `ps aux |grep %s| grep -e Dcatalina.home | awk ‘{print $23}‘| awk -F‘=‘ ‘{print $2}‘`/conf/catalina.properties | grep http.port | awk -F‘=‘ ‘{print $2}‘" % pid_s) for port in java_ports.readlines(): r = os.path.basename(port.strip()) ports += [{‘{#JAVAPORT}‘:r}] print json.dumps({‘data‘:ports},sort_keys=True,indent=4,separators=(‘,‘,‘:‘))
时间: 2024-10-01 02:35:32