Home Directory Plugins Databases MySQL check_mk_heartbeat

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_mk_heartbeat

Rating
0 votes
Favoured:
0
Current Version
1.01
Last Release Date
2012-12-23
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
Hits
44728
Files:
FileDescription
check_mk_heartbeat.pycheck_mk_heartbeat.py
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This plugin is checking timestamp of the last table update (on the slave side) and comparing it with the current system time.

It is suitable for checking MASTER-SLAVE
and MASTER-MASTER replication.

Requirements:
- latest mk-heartbeat (http://www.maatkit.org/download)
- Python MySQL connector (http://dev.mysql.com/downloads/connector/python/)
This plugin is checking timestamp of the last table update (on the slave side)
and comparing it with the current system time.

You must choose server_id, warning and critical interval in seconds.

The latest version of mk-heartbeat should be installed and running with options:
--update --daemonize

The heartbeat table should be such:

CREATE TABLE heartbeat (
ts varchar(26) NOT NULL,
server_id int unsigned NOT NULL PRIMARY KEY,
file varchar(255) DEFAULT NULL, -- SHOW MASTER STATUS
position bigint unsigned DEFAULT NULL, -- SHOW MASTER STATUS
relay_master_log_file varchar(255) DEFAULT NULL, -- SHOW SLAVE STATUS
exec_master_log_pos bigint unsigned DEFAULT NULL -- SHOW SLAVE STATUS
);

(latest mk-heartbeat can create this table via option '--create-table')

Requirements:
- latest mk-heartbeat (http://www.maatkit.org/download)
- Python MySQL connector (http://dev.mysql.com/downloads/connector/python/)

Example usage:

1) MASTER -> SLAVE Replication:

1. Run on MASTER mk-heartbeat:

mk-heartbeat -u heartbeat -p hfnLgg1 -D my_db --update --daemonize

(or with --create-table if you run mk-heartbeat in first time)

2. Check table data:

mysql -u heartbeat -phfnLgg1 my_db -e "select * from heartbeat";

+----------------------------+-----------+-------------------+----------+-----------------------+---------------------+
| ts | server_id | file | position | relay_master_log_file | exec_master_log_pos |
+----------------------------+-----------+-------------------+----------+-----------------------+---------------------+
| 2012-12-23T20:14:18.000960 | 1 | MASTER-bin.000004 | 944011 | NULL | NULL |
+----------------------------+-----------+-------------------+----------+-----------------------+---------------------+
1 row in set (0.00 sec)


3. Run on SLAVE:

$ check_mk_heartbeat.py user:heartbeat pw:hfnLgg1 db:my_db host:localhost sid:1 warn:60 crit:120

Output:
SLAVE OK: 0.23 seconds behind master (warn - 60.00, crit - 120.00), master_log_file = MASTER-bin.000004, master_log_pos = 944011


2) MASTER <-> MASTER Replication:

1. Run on each MASTER:

mk-heartbeat -u heartbeat -p hfnLgg1 -D my_db --update --daemonize

(by default mk-heartbeat uses server_id of local mysql server,
so you do not have to worry - mk-heartbeat data are not mixed)

2. Check each SLAVE:

$ check_mk_heartbeat.py user:heartbeat pw:hfnLgg1 db:my_db host:localhost sid:1 warn:60 crit:120

where 'sid' - server_id of MASTER for current SLAVE.

LAST CHANGES:
- Fixed plugin OUTPUT (old version shows wrong master_log_file and master_log_pos)
- Fixed UNKNOWN state (old version shows UNKNOWN sate on MASTER-SLAVE replication)