Zabbix MySQL Monitoring Client Configuration

Source: Internet
Author: User
Tags snmp

There are four general directions for Zabbix monitoring:

1,zabbix Agent Type

2,SNMP type

3,JMX type

4,impi type


There are basically two types of agents, Agent type and SNMP type.


The agent type of item is to use the agent deployed on the server side to obtain data, can be divided into active and passive mode.

SNMP is a very good way to monitor devices outside the server, such as the ability to monitor network devices, printers, and so on, as long as there is SNMP function, Zabbix can be monitored.


Today we are going to say that MySQL monitoring is based on agent type monitoring.

Let's take a look at the default templates on the server side:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/B2/wKiom1W7l4eggA3VAADdu9M82Lw486.jpg "title=" 1.png " alt= "Wkiom1w7l4egga3vaaddu9m82lw486.jpg"/>

Item has 14, which is generated with 2 graphic types based on these 14 item (x).


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/AF/wKioL1W7mdOj8bUlAAUhRA47Tmc667.jpg "title=" 2.png " alt= "Wkiol1w7mdoj8bulaauhra47tmc667.jpg"/>


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/B2/wKiom1W7mFGzI6fyAAK2A5cp5aQ632.jpg "title=" 3.png " alt= "Wkiom1w7mfgzi6fyaak2a5cp5aq632.jpg"/> The first item information, the monitoring type is Zabbix Agent,key to mysql.version, the output type is a string, the update period defaults to 3,600 seconds. The value is saved for 7 days ....


After the Zabbix agent is installed on the monitor side, add the MySQL monitor template and then after viewing the log on the zabbix_server side you will find

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/B2/wKiom1W7mm_RT6vfAAREG17eoX8850.jpg "title=" 4.png " alt= "wkiom1w7mm_rt6vfaareg17eox8850.jpg"/> Prompt monitoring can be value on the monitored side is not supported.

So we also need to modify the zabbix_agentd.conf of the monitored side to manually add the corresponding key to execute the Data collection statement (multi-use shell statement writing).


The client adds a custom monitoring entry by adding a statement after the configuration file as Userparameter=app.key,/some/shell/output

For example: To monitor mysql.version, the statement is

Mysql.version,mysqladmin-u-P Version | grep ' Server version ' | awk ' {printf ' MySQL Server Version: "$ $} '

The output value is MySQL Server version:5.1.73

So add to the configuration file and add a monitoring item at the end.


As shown, there are many values for MySQL, and these values are generally in the mysqladmin status | Mysqladmin extended-status inside. So just write a shell script so you can monitor all the rest.

I've provided a shell script example here

#!/bin/bashcase $1 inuptime)         mysqladmin -u  -p status | awk  ' {print$2} '         ;; Com_update)         mysqladmin -u -p extended-status  | grep  ' com_update  '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Slow_queries)         mysqladmin -u -p extended-status  | grep  ' slow_queries '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_select)         mysqladmin -u -p extended-status  | grep  ' com_select '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_rollback)         mysqladmin -u -p extended-status | grep  ' Com_rollback   '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Questions)         mysqladmin -u -p extended-status  | grep  ' Questions '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_insert)         mysqladmin -u -p extended-status  | grep  ' com_insert  '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_delete)         mysqladmin -u -p extended-status  | grep  ' com_delete  '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_commit)  &NBsp;      mysqladmin -u -p extended-status | grep  ' Com_commit '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Bytes_sent)         mysqladmin -u -p extended-status  | grep  ' bytes_sent '   | awk  ' begin{fs= ' | '} {print $3} '         ;; bytes_received)         mysqladmin -u -p extended-status  | grep  ' bytes_received '   | awk  ' begin{fs= ' | '} {print $3} '         ;; Com_begin)         mysqladmin -u -p extended-status  | grep  ' com_begin '   | awk  ' begin{fs= ' | '} {print $3} '         ;; *)         echo  "please choise one optinon  ( Uptime| com_update| slow_queries| Com_select| com_rollback| questions| Com_insert| com_delete| Com_commit| Bytes_sent| bytes_received| com_begin ) "        ;; Esac

Zabbix_agentd.conf inside the monitoring item is ↓

Userparameter=mysql.version,mysqladmin-u-P Version | grep ' Server version ' | awk ' {printf ' MySQL Server Version: ' $ userparameter=mysql.status[*],bash/usr/local/zabbix/etc/check_mysql_status} ' _per.sh $1userparameter=mysql.ping,mysqladmin-u-P status >/dev/null 2>&1 && echo 1 | | Echo 0

When added, we can go to Zabbix and open monitoring→latest data to select the host.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/B2/wKiom1W7nkfwKm9JAAKPa4XyS_M970.jpg "title=" 5.png " alt= "Wkiom1w7nkfwkm9jaakpa4xys_m970.jpg"/> has been successively getting the value of the response.


Wait a moment to complete the monitoring.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/AF/wKioL1W7oKHANNA4AAaJLLlR-mw795.jpg "title=" 6.png " alt= "Wkiol1w7okhanna4aaajlllr-mw795.jpg"/>

This article is from the "Professor" blog, please be sure to keep this source http://professor.blog.51cto.com/996189/1680740

Zabbix MySQL Monitoring Client Configuration

Related Article

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.