Home Database Mysql Tutorial Zabbix 监控MySQL主从状态(Python脚本)

Zabbix 监控MySQL主从状态(Python脚本)

Jun 07, 2016 pm 05:23 PM
zabbix

1、在被监控机(Mysql Slave端)放置检查脚本: /usr/local/zabbix/bin/check_mysql_repl.py #!/usr/bin/python #coding:utf-8

1、在被监控机(Mysql Slave端)放置检查脚本:

/usr/local/zabbix/bin/check_mysql_repl.py

2、配置zabbix_agent.conf,添加Key和监控脚本:

vi /usr/local/zabbix/etc/zabbix_agentd.conf,文件最后添加以下两行:

UserParameter=mysql.repl_io,/usr/local/zabbix/bin/check_mysql_repl.py io UserParameter=mysql.repl_sql,/usr/local/zabbix/bin/check_mysql_repl.py sql

UserParameter是固定的

mysql.repl_io 是自定的Key,,下面添加监控项的时候用到

/usr/local/zabbix/bin/check_mysql_repl.py io  这一段就是上面的脚本及参数

重启zabbix_agentd

3、添加监控项:

4、添加触发器:

此触发器的作用是检测到脚本的返回值不是1就会报警。

就这样一个简单的监控主从配置就完成!~~

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to monitor redis memory in zabbix How to monitor redis memory in zabbix Jun 03, 2023 am 10:00 AM

1. Download the import template directly and import the template through the following steps: Click configuration->templates>import->Import the downloaded xml file. 2. Configure the client key on the monitored host, open the /etc/zabbix/zabbix_agentd.conf configuration file, and add in the last line: UserParameter=redis_stats[*],redis-cli-h127.0.0.1-p$1info |grep$2|cut-d:-f2 After the configuration is completed, pass /etc/init.d/zabbix_agentdre

How zabbix monitors traceroute data How zabbix monitors traceroute data May 19, 2023 am 11:10 AM

1. Zabbixserver and proxy install the mtrmtr script and place it in the following path of zabbixserver and proxy: execute chownzabbix:zabbixmtrtrace.shzabbix to create the mtrtrace template: 5. Associate the host to the template and observe the data in zabbix: [monitoring]-[latestdata]:

What are the network devices that Zabbix 3.0 monitors? What are the network devices that Zabbix 3.0 monitors? Jun 04, 2023 am 08:44 AM

Introduction to SNMP 1 Overview of SNMP SNMP has developed to become the most widely used network management protocol. The currently applied versions mainly include SNMPv1, SNMPv2c and SNMPv3. The main differences between the versions are in the definition of information, the operation of communication protocols and the security mechanism. At the same time, two extensions of SNMP applications, remote network monitoring RMON (Remote Network Monitoring) and RMON2, have also appeared. From the perspective of the physical layer, using SNMP to manage the network should include: network management station (NMS), agent (Agent), and proxy server (proxy). NMS can generate commands and receive notification information. There must be at least one in the network management

How to use Zabbix custom script to monitor nginx and WeChat alarms How to use Zabbix custom script to monitor nginx and WeChat alarms May 21, 2023 pm 05:10 PM

Project Description The purpose of this project is to build a zabbix monitoring system that can implement WeChat alarms, conveniently monitor the entire NGINX cluster, and at the same time deploy and manage the entire cluster in batches. Project steps: Install zabbixserver on the zabbix server (192.168.2.138), install zabbixagent (192.168.2.58) on the nginx side, configure the Nginx load balancing cluster, and turn on status statistics. Write a monitoring script on the nginx side to get the status of nginx. The server-side web adds monitoring items and outputs pictures. Register the enterprise WeChat and configure the WeChat interface. Add the interface push script to the zabbix server and test that the interface is normal. in we

Using Zabbix for monitoring and management in Java API development Using Zabbix for monitoring and management in Java API development Jun 18, 2023 am 08:25 AM

In JavaAPI development, monitoring management is a very important part. In order to ensure the stability and reliability of the application, we need to monitor various indicators, such as CPU usage, memory usage, network traffic, etc., and respond in a timely manner. In this case, Zabbix is ​​an excellent monitoring tool. Zabbix is ​​an open source monitoring solution that can monitor various parameters and services, including networks, servers, applications, databases, etc. It provides a powerful We

How to configure nginx monitoring in zabbix How to configure nginx monitoring in zabbix May 12, 2023 pm 08:31 PM

Case: zabbix configures nginx monitoring 1. Modify the configuration file vim/usr/local/nginx/conf/nginx.conflocation/nginx_status{stub_status;} Description: nginx_status custom field, access address (example: 192.168.169.131/nginx_status) stub_status fixed Parameter #Restart nginx./nginxreload Browser access status description: ActiveconnectionsNginx is processing the number of active links; important serverNginx starts to the present

How to monitor Nginx/Tomcat/MySQL with zabbix How to monitor Nginx/Tomcat/MySQL with zabbix May 17, 2023 pm 08:31 PM

Zabbix monitors nginxa machine: zabbix server (192.168.234.128) b machine: zabbix client (192.168.234.125) Operation on b machine (zabbix client): edit nginx virtual host configuration file: [root@centos~]#vi/ etc/nginx/conf.d/default.conf Add the following content in server{}: location/nginx_status{stub_statuson;access_logoff;allow127.0.0.1;denyall;}Reload ngi

How to use zabbix to monitor multiple mysql How to use zabbix to monitor multiple mysql Jun 02, 2023 pm 02:25 PM

The main tools used: Macros (divided into template macros, host macros, and automatically discovered macros) Host macro format: $MACRO (can fill in the value directly) Automatically discovered macros: #MACRO (needs to match the value of the created key) General structure 1. Agent host—the agent host creates the macro variable $MYSQLPORT. The value of the macro variable is the automatic discovery script parameter of Discoveryrules. 2. Template—Create automatic discovery rules in the template, relying on the automatic discovery script to obtain the automatic discovery macro variable. 3. Monitoring items – Create monitoring items in Discoveryrules. The names and key values ​​of the monitoring items are automatically sent.

See all articles