1,CONFIGURATION OF DISCOVERY RULES
创建规则,填写ip地址范围,然后已用后面的key 来添加机器,在创建机器的时候也可以用一些先关的标准模板今天挂在,key 是system.uname
2,自定义添加java 端口监控
python脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/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}]
本文转自wks9751CTO博客,原文链接:
http://blog.51cto.com/wks97/1956063
,如需转载请自行联系原作者
print json.dumps({
'data'
:ports},sort_keys=True,indent=4,separators=(
','
,
':'
))
|