如 /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 '{
' printf ' "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 '
{' printf ""{#PORTWARS}":"8${war}80:${i}"}" printf "," echo $num done done printf '
]
' printf '}
' } findtomcatwar| tac| sed '4s/.$//' |tac |