#!/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
zabbix中統計item host template trigger的數量
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.