Linux steps to monitor database systems with Zabbix

  
                

Zabbix is ​​a tool for network monitoring and system monitoring on Linux systems, but Zabbix cannot directly monitor the database. If you want to use Zabbix to monitor the database, you need to make the relevant settings. Here is a brief introduction for everyone: using Zabbix to monitor the database system.

Description:

If you want to use zabbix to monitor mysql, the default template will not work, because there is no key, so you must write your own script and define your own key. Scripts can be implemented in any language, but it is still convenient under Linux. Unlike php, which needs to install the php environment, python needs to install the python-MySQL library, and perl is the same.

Probably:

zabbix monitoring mysql probably has the following steps:

mysql add zabbix users, allow zabbix to view mysql status

zabbix agent add mysql_status script, Used to get the mysql status value;

zabbix agend adds the mysql_status.conf configuration file to define the key value. Restart the zabbix agentd after the configuration file ok;

Add the corresponding host mysql template on the zabbix server web interface (bring your own)

Specific:

1. mysql add zabbix users, After setting the usage permission, zabbix can only view mysql status, etc., cannot view other libraries

” grant usage on *.* to zabbix@‘zabbix agentd's intranet ip’ identified by ‘zabbix’;

》flush privileges

2. mysql_status script

# cat /usr/local/zabbix/bin/mysql_status

#! /bin/bash

#use zabbix to monitor mysql status

mysql=/usr/local/mysql/bin/mysql

var=$1

MYSQL_USER=$2

MYSQL_PASSWORD=$3

MYSQL_Host=$4

[ “${MYSQL_USER}” = ‘’ ] && MYSQL_USER=zabbix # Mysql zabbix user

[ “${MYSQL_PASSWORD}” = ‘’ ] && MYSQL_PASSWORD=zabbix #mysql zabbix password

[ “${MYSQL_Host} ” = ‘’ ] && MYSQL_Host=10.10.10.10 #zabbix agentd's intranet ip

[ “${var}” = ‘’ ] && echo “”

Copyright © Windows knowledge All Rights Reserved