Zabbix failed to monitor MySQL backup

Source: Internet
Author: User
Tags mysql backup

Zabbix failed to monitor MySQL backup

Environment:

A: 172.16.16.1 (MySQL machine)
B: 172.16.16.2 (backup machine)
C: 172.16.16.3 (zabbix server)

Introduction
As A result of the company's development needs, we need to back up the Intranet Test Database A. B .C, and package and back up the database to machine B at every day.

Plan

1. Use mysqldump and script on machine B to back up the database locally.
2. Set monitoring items on the zabbix machine. If the backup fails, send an email to the O & M department.

1. The script content is deployed in/data1/local_backup/mysqlbak/IP of machine B.

#! /Bin/sh
Messages_dir =/data1/backup/local_backup/mysqlbak/172.16.16.1/
Cd/data1/backup/local_backup/mysqlbak/172.16.16.1/
Now = $ (date + "% d-% m-% Y ")
File = web_mysql_172.16.16.1 _ 3306 _ $ Now. SQL
Mysqldump-uroot-p 'Password'-h 172.16.16.1-B a B c | gzip-9>/data1/backup/local_backup/mysqlbak/172.16.16.1/$File. SQL .gz
/Usr/bin/find $ {messages_dir}-name '* web_mysql_172.16.16.1 _ 3306 *'-mtime + 7-exec rm-f {}\;
Echo $? >/Data1/backup/local_backup/mysqlbak/172.16.16.1/mysqlbak172.16.16.1.log

2. Set a scheduled task

[Root @ git ~] # Vi/etc/crontab
00 02 ***/bin/sh/data1/backup/local_backup/mysqlbak/172.16.16.1/backup-172.16.16.1.sh
[Root @ git ~] #/Sbin/service crond restart
[Root @ git ~] # Chkconfig-level 35 crond on

3. Define the key variable

12 [root @ git ~] # Cat/usr/local/zabbix_agent/etc/zabbix_agentd.conf | grep "UserParameter"
UserParameter = mysqlbak. log,/bin/cat/data1/backup/local_backup/mysqlbak/172.16.16.1/mysqlbak172.16.16.1.log

# Restart zabbix-agent

4. Add a template to the host and call the key variable.

5. Set the trigger

Some Zabbix Tutorials:

Compile and install Zabbix2.4.5 source code in Ubuntu 14.04

Install and deploy the distributed monitoring system Zabbix 2.06

Install and deploy the distributed monitoring system Zabbix 2.06

Install and deploy Zabbix in CentOS 6.3

Zabbix distributed monitoring system practice

Under CentOS 6.3, Zabbix monitors apache server-status

Monitoring MySQL database Parameters Using Zabbix in CentOS 6.3

Install Zabbix 2.0.6 in 64-bit CentOS 6.2

ZABBIX details: click here
ZABBIX: click here

This article permanently updates the link address:

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.