[PYTHON] [blackbird-mysql] Monitor mysql with blackbird

blackbird mysql plugin

This plugin gets various information from mysql and sends the data to the backend Currently, you can monitor the following information: (I am targeting mysql 5.5 series, but I think that there is no particular problem with 5.6)

Each acquisition item is in the unit of component. Zabbix Template is prepared for each component, so please use the component you want to monitor and Zabbix Template as a set. The correspondence table between component and Zabbix Template is as follows.

Each component of blackbird mysql plugin

component content zabbix template
(defaultt) get mysql version and check mysql health MySQL_5.5_general.xml
global_variables get information by SHOW GLOBAL VARIABLES MySQL_5.5_variables.xml
global_status get information by SHOW GLOBAL STATUS MySQL_5.5_status.xml
innodb_status get information by SHOW ENGINE INNODB STATUS MySQL_5.5_innodb.xml
slave_status get information by SHOW SLAVE STATUS MySQL_5.5_slave.xml
table_count discovery number of tables in database (lld) MySQL_5.5_general.xml

** Each Zabbix Template, but created with Zabbix 2.4 ** ** Since the definition of Trigger has changed, it cannot be used in 2.2 series **

Install

blackbird body

Please install by referring to here

Install mysql plugin

You can either use setup.py or rpm. There is also a way to insert it manually, but in that case please use the module of MySQLdb of python separately

install with setup.py

git clone https://github.com/Vagrants/blackbird-mysql.git
cd blackbird-mysql
python setup.py install

install with rpm

yum install blackbird-mysql --enablerepo=blackbird

Dependency requires MySQL-python

Create a monitoring user on the MySQL side

Create a user to which blackbird connects

mysql> GRANT SELECT, REPLICATION CLIENT, SHOW DATABASES, PROCESS ON *.* TO  'bbd'@'127.0.0.1' IDENTIFIED BY 'bbd';

Please change ip address, username and password as appropriate. Connection user information can be set freely with config If you already have a user for monitoring, you don't have to create it.

Set plugin

config is in /etc/blackbird/conf.d/mysql.cfg You can set component and monitoring interval

ini:/etc/blackbird/conf.d/mysql.cfg


[mysql]
module = 'mysql'

# mysql setting
#
# - Please create monitor user like this.
#
#   mysql> GRANT SELECT, REPLICATION CLIENT, SHOW DATABASES, PROCESS ON *.* TO  'bbd'@'127.0.0.1' IDENTIFIED BY 'bbd';
#
# mysqlhost = '127.0.0.1'
# mysqluser = 'bbd'
# mysqlpass = 'bbd'

# components
# - global_variables : SHOW GLOBAL VARIABLES;
# - global_status    : SHOW GLOBAL STATUS;
# - innodb_status    : SHOW ENGINE INNODB STATUS;
# - slave_status     : SHOW SLAVE STATUS;
# - table_count (LLD): SELECT table_schema, COUNT(table_name) FROM information_schema.TABLES GROUP BY table_schema;
#
components = 'global_variables,global_status,innodb_status,slave_status,table_count'

# interval for this module
#
# interval = 60
# lld_interval = 600

#
# You can set the different interval time for each component.
#
# [mysql]
# module = 'mysql'
# components = 'version,global_variables,global_status,innodb_status'
# interval = 60
#
# [mysql_slave_monitor_frequent_intervals]
# module = 'mysql'
# components = 'slave_status'
# interval = 10

At the back of config, there is a setting method when you want to change the monitoring interval only for a specific component as TIPS.

Reboot blackbird when you're done

sudo /etc/init.d/blackbird restart

Check if data is coming in on Zabbix

Zabbix Templates can be found in the github repository Please import to Zabbix and apply to the target server

** If the host name on Zabbix and the host name of the server on which blackbird is running are different, you need to set the hostname on /etc/blackbird/conf.d/mysql.cfg ** Please match with Zabbix

ini:/etc/blackbird/conf.d/mysql.cfg


hostname = your_static_hostname

Precautions, etc.

Please customize Zabbix Template Trigger etc. for each environment.
Zabbix Template is made with the policy of ** take what you can get for the time being **
Looking for acclaim
I want to use it in Zabbix 2.2 series
What about PostgreSQL, not just MySQL?

Recommended Posts

[blackbird-mysql] Monitor mysql with blackbird
[blackbird-redis] Monitor Redis with blackbird
[blackbird-rabbitmq] Monitor rabbitmq with blackbird
[blackbird-nginx] Monitor Nginx with blackbird
[blackbird-xfs] Monitor xfs with blackbird
[blackbird-memcached] Monitor Memcached with blackbird
[blackbird-fio-status] Monitor ioDrive (Fusion-IO) with blackbird
[blackbird-named] Monitor Bind (named) with blackbird
Use MySQL with Django
[blackbird-ntp] Monitor ntpq information (offset, jitter, etc.) with blackbird
Connect Vagrant's MySQL with MySQL Workbench
Monitor Tomcat process with Zabbix-agent
Note: Differences with mysql apidriver
Connection pooling with Python + MySQL
Monitor Python web apps with Prometheus
Monitor Python application performance with Dynatrace ♪
Monitor ISC DHCP status with ZABBIX
Use Unicode 6.0 emoji with django / MySQL