[[Email protected] Client zabbix]# grep-v "^$" etc/zabbix_agentd.conf|grep-v "^#" logfile=/tmp/zabbix_agentd.logserver= 127.0.0.1,zabbix_server_ipserveractive=zabbix_server_ip:10051# Note The addition port number hostname=113.86.103.100# and Zabbix_ Server side to maintain one to, such as: (A) include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/unsafeuserparameters=1userparameter= Mysql.version,mysql-vuserparameter=mysql.status[*],/usr/local/zabbix/scripts/chk_mysql.sh $1UserParameter= mysql.ping,mysqladmin-uzabbix-pzabbix-p3306-h127.0.0.1 Ping|grep-c Alive
A
#!/bin/sh#set-xmysql_sock= "/tmp/mysql.sock" mysql_pwd=xxxxxargs=1mysqladmin=/alidata/server/mysql/bin/ mysqladmin# Note that commands must be used in the script in the absolute path if [$#-ne "$ARGS"];then echo "please input onearguement:" Ficase $ in Uptime) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock status|cut-f2-d ":" |cut-f1-d "T" ' Echo $resu lt;; com_update) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_update" |cu T-d "|"-f3 ' echo $result;; slow_queries) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock status |cut-f5-d ":" |cut-f1-d "O" echo $result;; Com_select) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_select" |cut-d "|"-f3 ' echo $result;; Com_rollback) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_rollback" |cut-d "|"-f3 ' echo $result;; Questions) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock status|cut-f4-d ":" |cut-f1-d "S" ' echo $result;; Com_insert) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_insert" |cut-d "|"-f3 ' echo $result;; Com_delete) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_delete" |cut-d "|"-f3 ' echo $result;; Com_commit) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_commit" |cut-d "|"-f3 ' echo $result;; bytes_sent) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Bytes_sent" |cut-d "|"-f3 ' echo $result;; bytes_received) result= ' $MYSQLADMIN-UZABBIX-P${MYSQL_PWD}-S $MYSQL _sock extended-status |grep-w "bytes_received" |cut-d "|"-f3 ' echo $result;; Com_begin) result= ' $MYSQLADMIN-uzabbix-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w "Com_begin" |cut-d "| "-f3 ' echo $result;; *) echo "usage:$0 (uptime| com_update| slow_queries| Com_select| com_rollback| Questions) ";; Esac
[[Email protected] Client scripts]# service Zabbix_agentd restartshutting down zabbix_agentd: [ OK ]starting ZABBIX_AGENTD: [ OK ]
Zabbix Monitoring Client Database Zabbix Client