zabbix 自动发现tomcat的war包并实现监控
作者:互联网
如 /usr/local/dir_samba/apache-tomcat-7.0.64-0/webapps 表示8080端口的tomcat
每个tomtcat对应一个端口,每个tomcat都有若干的war包(应用)以下描述用zabbix自动去扫描发现每个tomcat上的war,并自动添加为监控的过程
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#!/bin/bash
findtomcatwar()
{
printf '{\n'
printf '\t"data":[ '
for war in 0 1 2 3
do
for i in ` ls /usr/local/dir_samba/apache-tomcat-7 .0.64-${war} /webapps | grep - v 'host-manager\|ROOT\|manager\|.war\|indexes\|examples\|doc' `
do
printf '\n\t\t{'
printf "\"{#PORTWARS}\":\"8${war}80:${i}\"}"
printf ","
echo $num
done
done
printf '\n\t]\n'
printf '}\n'
}
findtomcatwar| tac| sed '4s/.$//' |tac
|
标签:tomcat,printf,7.0,zabbix,done,tac,包并,war 来源: https://www.cnblogs.com/zhoading/p/12153115.html