How to make Nagios play nice with MySQL?
David R. Guntner
Dguntner at doit.nv.gov
Mon Nov 17 02:23:51 CET 2003
Running Nagios 1.1 on a SuSE 8.2 system. Compiled it with MySQL support.
Something that I've noticed is that if MySQL goes down for some reason, even for a second (say, a /etc/init.d/mysql restart (or even "reload")), then Nagios starts duming its information to files in the /var/lib/mysql directory. For example:
# ls -la /var/lib/mysql
total 411891
drwxr-xr-x 5 mysql daemon 504 Nov 16 17:10 .
drwxr-xr-x 22 root root 600 Nov 16 00:17 ..
drwx------ 2 mysql root 528 Nov 3 23:23 mysql
srwxrwxrwx 1 mysql daemon 0 Nov 16 17:10 mysql.sock
-rw-rw---- 1 mysql root 103 Nov 16 17:10 mysqld.log
-rw-rw---- 1 mysql root 414 Nov 3 23:23 mysqld.log-20031105.gz
-rw-rw---- 1 mysql root 376 Nov 6 20:38 mysqld.log-20031107.gz
-rw-rw---- 1 mysql root 432 Nov 11 22:49 mysqld.log-20031112.gz
-rw-rw---- 1 mysql root 556 Nov 15 23:50 mysqld.log-20031116.gz
-rw-rw---- 1 mysql daemon 4 Nov 16 17:10 mysqld.pid
drwx------ 2 mysql daemon 4152 Nov 15 17:51 nagios
-rw-rw---- 1 mysql daemon 420175361 Nov 16 17:08 nagios-bin.001
-rw-rw---- 1 mysql daemon 890789 Nov 16 17:10 nagios-bin.002
-rw-rw---- 1 mysql daemon 260907 Nov 16 17:11 nagios-bin.003
-rw-rw---- 1 mysql daemon 17 Nov 16 17:10 nagios-bin.index
drwx------ 2 mysql root 48 Nov 3 23:23 test
Notice the nagios-bin.* files in there. The .index file simply contains the names of those other three files. If I were to restart MySQL again, I'd end up with .004, and the .index file would reflect that as well.
Is there some way to get Nagios to NOT do this? Even though MySQL is back up, once it starts writing to files, it keeps doing so until I shut down the Nagios process and restart it. Needless to say, since logrotate runs every night and cycles the MySQL logs (and restarts the process when it's done), I come back every morning to find that we've got the Really Big Nagios File(s) sitting in the /var/lib/mysql directory again. So, is there some way to make Nagios deal with a MySQL restart in a more "friendly" way?
Any help would be apprecaited.
--Dave
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list