asfsd 发表于 2019-1-26 07:45:58

Zabbix Custom monitoring learning

  Services Status

  agent:
  UserParameter=mysqld.status,/etc/init.d/mysqld status | grep -c running
servers agentd restart  server:
/usr/local/bin/zabbix_get -s -k "mysqld.status"  

  Mysql Master slave synchronization
  slave agent:
  UserParameter=mysql.replication,/usr/bin/mysql -uzabbix -e 'show slave status\G' |grep -E "Slave_IO_Running|Slave_SQL_Running"|awk '{print $2}'|grep -c Yes
servers agentd restart  server:
/usr/local/bin/zabbix_get -s -k "mysql.replication"  

  Mysql Processlist
  master&slave agent:
  UserParameter=mysql.process,/usr/bin/mysql -uroot -ppassword -sNe "show full processlist" | egrep -v "Sleep|Id|show full processlist" | wc -l
servers agentd restart  server:
/usr/local/bin/zabbix_get -s -k "mysql.process"  

  System localtime Contrast
  NTP time synchronization
  #cat ntp.sh
#!/bin/sh
yes|cp /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
yum -y install ntp
ntpdate stdtime.gov.hk
/etc/init.d/ntpd start
chkconfig ntpd on  Items
  key:system.localtime
  Type of information:Numeric(float)
  Units:unixtime
  Triggers
  Expression:{Template_Linux:system.localtime.fuzzytime(60)}=0



页: [1]
查看完整版本: Zabbix Custom monitoring learning