Cent6.5 under Zabbix monitoring mysql5.6 version

Source: Internet
Author: User

Article reference: http://www.ttlsa.com/zabbix/zabbix-monitor-mysql/

In the original text:

If you find that the monitoring does not have data, please troubleshoot the following issues

1. Zabbix whether the client restarts

2. Whether the script has execute permission

3. Does the database have permissions

4. Is there a problem with the environment variables

5. Look at the Zabbix item column and move the mouse over the Red fork with an error message.

6. If the database password is saved in the script, it will cause the monitoring no data will continue to error warning:using a password on the command line interface can be insecure. Need to add configuration such as account password to MY.C NF.

Problem 6 has a better solution: (my MySQL is source installed to/usr/local/mysql)

With the new features of mysql5.6,--login-path

Specific methods:

1)/usr/local/mysql/bin/mysql_config_editor set--login-path=local--host=localhost--user=zabbix–password

is actually generating the validation file to ~/.mylogin.cnf

Command explanation:

--login-path is set to access the name, I set the local;

--host is the host address that specifies the allowed access, which is configured when you grant;

--user is a user name and is also configured for grant time;

--password is the specified password, which is also the grant configuration.

After running the above command, you will be asked to belong to the password, the input will not have any feedback, you can use the following command to view

/usr/local/mysql/bin/mysql_config_editor Print–all

2) Configure Sudo

Modify/etc/sudoers

Defaults Requiretty = = = "Defaults:zabbix!requiretty

and add a row

Zabbix all= (Root) nopasswd:/usr/local/mysql/bin/mysql,/usr/local/mysql/bin/mysqladmin

3) Modify each script accordingly

Here is a list of the scripts I use and the Zabbix client configuration

 [[Email protected] etc]# cat /usr/local/zabbix/etc/zabbix_agentd.conf.d/check_mysql_ Performance_key userparameter=mysql.version,/usr/local/mysql/bin/mysql -v userparameter= Mysql.ping,sudo /usr/local/mysql/bin/mysqladmin --login-path=local -s /tmp/mysql.sock  ping | grep -c alive userparameter=mysql.status[*],/usr/local/zabbix/shell/ check_mysql_performance.sh $1 $2[[email protected] etc]# 
[[email protected] etc]# cat /usr/local/zabbix/shell/check_mysql_performance.sh #!/ bin/sh  #Create  by zijin 2014.09.28# #Need   "grant select on mysql.*  to [email protected] identified by  ' zabbix_agent ' "#Mysql5.6# mysql_config_ editor set --login-path=local --host=localhost --user=zabbix -pmysql_sock= "/tmp/ Mysql.sock " mysql_pwd=" Zabbix_server "mysql_admin="/usr/local/mysql/bin/mysqladmin "ARGS=1 if [  $# -ne  "$ARGS"  ];then echo  "please input one arguement:"  fi  case $1 in     uptime)           result= ' sudo ${mysql_admin} --login-path=local -s  $MYSQL _sock status|cut  -f2 -d ":" |cut -f1 -d "T"  echo  $result           ;;      com_update)          result= ' Sudo ${MYSQL_ADMIN } --login-path=local -s  $MYSQL _sock extended-status |grep -w  "Com_update" | Cut -d "|"  -f3 '  echo  $result          ;;      slow_queries)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock status |cut -f5 -d ": "|cut -f1 -d" O " echo  $result          ;;      com_select)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock extended-status |grep -w   "Com_select" |cut -d "|"  -f3 '  echo  $result          ;;   &nbsP;  com_rollback)          result= ' sudo ${MYSQL_ admin} --login-path=local -s  $MYSQL _sock extended-status |grep -w  "Com_ Rollback "|cut -d" | "  -f3 '  echo  $result           ;;      questions)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock status|cut -f4 -d ":" |cut  -f1 -d "S" '  echo  $result          ;;      com_insert)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock extended-status |grep -w   "Com_insert" |cut -d "|"  -f3 '  echo  $result          ;;   &nbSp;  com_delete)          result= ' sudo ${MYSQL_ admin} --login-path=local -s  $MYSQL _sock extended-status |grep -w  "Com_ Delete "|cut -d" | "  -f3 '  echo  $result          ;;      com_commit)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock extended-status |grep -w   "Com_commit" |cut -d "|"  -f3 '  echo  $result          ;;      bytes_sent)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -S  $MYSQL _sock extended-status |grep -w   "bytes_sent"  |cut -d "|"  -f3 '  echo  $result         &nbSP;;;      bytes_received)          result= ' sudo ${mysql_admin} --login-path=local -s  $MYSQL _sock extended-status |grep  -w  "bytes_received"  |cut -d "|"  -f3 '  echo  $result          ;;      com_begin)          result= ' sudo  ${MYSQL_ADMIN} --login-path=local -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| Com_insert| com_delete| Com_commit| Bytes_sent| bytes_received| Com_begin) ";;  esac [[email protected] etc]# 

4) Add the appropriate template

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "image" Src= "Http://s3.51cto.com/wyfs02/M02/83/C8/wKioL1d8hFLAwYILAAH4fBG5Rlw216.png" height= "240" />

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "image" Src= "Http://s3.51cto.com/wyfs02/M02/83/C8/wKioL1d8hFKgxpyhAADS2K9oOO0865.png" height= "345" />

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "image" Src= "Http://s3.51cto.com/wyfs02/M00/83/C8/wKioL1d8hFPDAVlcAAFX1drT7oc310.png" height= "410" />

Cent6.5 under Zabbix monitoring mysql5.6 version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.