after the installation of Zabbix , the default control MySQL template is not available, even if added, is also shown as a red unsupper, so we need to do some configuration . The first thing you need to do is to create a new license on the MySQL server that you want to control, so that the zabbix_agent can look up the repository and the status monitoring.
Mysql-uroot-p<pass>-E "GRANT USAGE on * * to ' Zabbix ' @ ' 127.0.0.1 ' identifiedby ' Zabbix '";
Mysql-uroot-p<pass>-E "GRANT USAGE on * * to ' zabbix ' @ ' localhost ' identifiedby ' Zabbix '";
Mysql-uroot-p<pass>-E "flush privileges"
Test to see if the user is successful and has a corresponding limitation.
Mysql–uzabbix–pzabbix–e "Status"
if the output below is It's OK.
connectionid:9561
CurrentDatabase:
Currentuser: [Email protected]
Ssl:not in use
Currentpager:stdout
Usingoutfile: "
Usingdelimiter:;
Serverversion:5.1.72-2 (Debian)
Protocolversion:10
Connection:localhost via UNIX socket
Servercharacterset:utf8
Db Characterset:utf8
Clientcharacterset:utf8
Conn. Characterset:utf8
Unixsocket:/var/run/mysqld/mysqld.sock
Uptime:4 Days Hours 4 sec
Threads:1 questions:153764 Slow queries:25 opens:1746 Flush tables:1
Enter zabbix_agent configuration , as I am here /usr/local/etc/zabbix24, Create a new file to save the login MySQL User and password , the file name is. MY.CNF ( Note that there is a small dot in front )
[MySQL]
User=zabbix
Password=zabbix
[Mysqladmin]
User=zabbix
Password=zabbix
in the profile, there is also a configuration document, which is used to add the zabbix_agentd.conf.d of other custom configurations , to create a new profile userparameter_mysql.conf in this catalogue, Add the following content
Userparameter=mysql.status[*],echo "show global status where Variable_name= ' $ ';" | home=/usr/local/etc/zabbix24 Mysql-n | awk ' {print $$2} '
Userparameter=mysql.size[*],echo "Select SUM ($ (case" $ "in both|" ") echo" data_length+index_length ";; data|index) echo "$3_length";; Free) echo "Data_free";; ESAC)) from information_schema.tables$ ([["$" = "All" | |! "$"] | | echo "Wheretable_schema=" $ ([[["$] =" All "| |!" $ "] | | echo "and Table_name= '"); "| home=/usr/local/etc/zabbix24 Mysql–n
Userparameter=mysql.ping,home=/usr/local/etc/zabbix24mysqladmin Ping | Grep-c Alive
Userparameter=mysql.version,mysql–v
A total of 4 lines , if your zabbix_agent configuration is not here, please replace the upper side of the HOME for the correct path .
Modify The zabbix_agentd.conf to activate the custom configuration .
Enableremotecommands=1 # Activate a remote execute command.
unsafeuserparameters=1# activation with unsafe user parameters, you can encrypt the password directly after the
include=/usr/local/etc/zabbix24/zabbix_agentd.conf.d/*.conf# Remove the annotations and modify the correct path
re-activate zabbix_agentd service . then add the MySQL template to the server that needs to be monitored on the Zabbix server.
Add and then turn to items to see the MYSQL project , no red unsupper, but become green enabled is the success.
Note:
This article is done according to a foreigner's blog. Because the foreigner wrote the thing did not write complete, led me also groped for a long time. Interested friends can also go to see . The original is here:
http://blog.themilkyway.org/2013/12/zabbix-mysql-monitoring-notes/
This pen can only be configured as a control template feature for Zabbix, and if you need a higher level of other controls, you have to write your own key. This one doesn't dig into it. Be interested in yourself to study . The web found a variety of tutorials, is not wrong, is that many years ago , Zabbix 2.0 time of the thing, just started to get the time is also various kinds of not, so wrote this notebook, to the crowd like me as a novice to help, less a bit curved road .
Zabbix monitoring MySQL server (notebook)