首页 > 其他 > 详细

zabbix中统计item host template trigger的数量

时间:2016-04-30 01:09:33      阅读:196      评论:0      收藏:0      [点我收藏+]
#!/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




本文出自 “崔德华运维打工从业路” 博客,请务必保留此出处http://cuidehua.blog.51cto.com/5449828/1769117

zabbix中统计item host template trigger的数量

原文:http://cuidehua.blog.51cto.com/5449828/1769117

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!