#!/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 1else 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";; esacfi
This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1769117
Count of item host template trigger in Zabbix