1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/bash
#by cuizhiliang at 2016-04-29
get_item_number(){
echo
`mysql -h127.0.0.1 -uzabbix -pzabbix_password -Dzabbix -e
"select count(*) from items;"
2>
/dev/null
|
tail
-1`
}
get_trigger_number(){
echo
`mysql -h127.0.0.1 -uzabbix -pzabbix_password -Dzabbix -e
"select count(*) from triggers;"
2>
/dev/null
|
tail
-1`
}
get_template_number(){
echo
`mysql -h127.0.0.1 -uzabbix -pzabbix_password -Dzabbix -e
"select count(*) from hosts where status=3;"
2>
/dev/null
|
tail
-1`
}
get_host_number(){
echo
`mysql -h127.0.0.1 -uzabbix -pzabbix_password -Dzabbix -e
"select count(*) from hosts where status=0;"
2>
/dev/null
|
tail
-1`
}
get_notsupport_number(){
echo
`mysql -h127.0.0.1 -uzabbix -pzabbix_password -Dzabbix -e
"select count(*) from items where state=1;"
2>
/dev/null
|
tail
-1`
}
if
[ $
# -ne 1 ];then
echo
"Usage: sh $0 [item|trigger|template|host]"
exit
1
else
case
$1
in
item)
get_item_number;;
trigger)
get_trigger_number;;
template)
get_template_number;;
host)
get_host_number;;
notsupport)
get_notsupport_number;;
*)
echo
"None"
;;
esac
fi
本文转自残剑博客51CTO博客,原文链接http://blog.51cto.com/cuidehua/1769117如需转载请自行联系原作者 cuizhiliang
|