#!/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