What's this dbAlerter stuff?
Database Alerter = Something wrong with your DB? Well now you know what!
After suffering at the hands of external monitoring tools, I decided to write something that would run standalone and provide detailed notification for database issues that often elude a busy DBA. Initially focussing on MySQL, I recently rewrote the daemon with a view to supporting more database platforms in the near future (watch this space).
dbAlerter is written in Python which keeps things simple and lightweight.
Features
- Standalone Operation (Daemon) - no separate server required
- E-Mail Notification
- XMPP Notification
MySQL
- Database operational check through common queries (CREATE, INSERT, UPDATE, DELETE, DROP)
- Error Log monitor
- Excessive Slow Query notification
- Replication status notification
- Empty Password notification
- Daily Statistics
Requirements
Supported Databases
Installation
Configuration File Format
The configuration file for dbAlerter is pretty much identical to the my.cnf format. Based on RFC 822 the configuration file consists of sections, led by a "[dbAlerter]" header and followed by "name: value" entries as outlined below.
Configuration File Header [dbAlerter] |
||||
Name |
Example |
Description |
Optional/Required |
Default |
check_interval |
20 |
Check interval in seconds |
Optional |
42 |
dbalerter_log |
/var/log/dbAlerter.log |
Output log for dbAlerter daemon |
Required |
None |
pid_file |
/var/run/dbalerter.pid |
pid file location |
Optional |
None |
smtp_server |
localhost |
SMTP Server to send mail |
Optional |
localhost |
smtp_from |
Address that notifications should originate from |
Required |
None |
|
smtp_to |
Address to send notifications to |
Required |
None |
|
xmpp_from |
XMPP Account to send notifications from |
Required |
None |
|
xmpp_password |
password |
XMPP Password for from account |
Required |
None |
xmpp_to |
XMPP Account to send notifications to |
Required |
None |
|
MySQL specific parameters |
||||
Name |
Example |
Description |
Optional/Required |
Default |
mysql_hostname |
localhost |
MySQL Hostname |
Optional |
localhost |
mysql_port |
3306 |
MySQL Port |
Optional |
3306 |
mysql_username |
monitor |
MySQL User |
Required |
None |
mysql_password |
password |
MySQL Password |
Required |
None |
mysql_basedir_threshold |
75 |
MySQL installation directory usage notification threshold (%) |
Optional |
75 |
mysql_datadir_threshold |
75 |
MySQL data directory usage notification threshold (%) |
Optional |
75 |
mysql_plugindir_threshold |
75 |
MySQL plugin directory usage notification threshold (%) |
Optional |
75 |
mysql_tmpdir_threshold |
75 |
MySQL temporary directory usage notification threshold (%) |
Optional |
75 |
mysql_connection_usage_threshold |
75 |
MySQL connection usage notification threshold (%) |
Optional |
75 |
mysql_open_files_threshold |
75 |
MySQL open file usage notification threshold (%) |
Optional |
75 |
Example Configuration (dbalerter.config)
[dbAlerter] check_interval=30 dbalerter_log=/var/log/dbAlerter.log smtp_server=localhost smtp_from=dbAlerter@mydomain.org smtp_to=me@mydomain.org mysql_hostname=localhost mysql_port=3306 mysql_username=monitor mysql_password=monitor
MySQL dbAlerter Account Creation
GRANT PROCESS, SELECT, REPLICATION CLIENT, SHOW DATABASES, SUPER ON *.* TO 'mysqluser'@'localhost' IDENTIFIED BY 'dbAlerter_password'; GRANT CREATE, INSERT, DELETE, DROP ON dbAlerter.* TO 'mysqluser'@'localhost' IDENTIFIED BY 'dbAlerter_password';
Download
Coming soon - check out the source if you can't wait
FreeMind MindMap: dbAlerter.mm
Help improve dbAlerter
The best way to improve dbAlerter is to try it out and let me know what works, what doesn't and what's missing. You can do that using the Issue Tracker - it's easy.







