how to Nagiosxi could test himself SQL?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
damned
Posts: 4
Joined: Mon Jun 30, 2014 7:25 am

how to Nagiosxi could test himself SQL?

Post by damned »

Hi, sometimes happens that nagiosxi's sql goes wrong and i must do the repair procedure and this always worked.
But is there a way to automatically check the nagiosxi sql to report possible corruptions problems?
Someone has any experience on this?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: how to Nagiosxi could test himself SQL?

Post by slansing »

Well, it is done as part of the maintenance cron, you would see the issues immediately anyways in the WebUI, so that is essentially the same as having a plugin do it for you, :). If this is happening often, you must be doing something incorrectly, the leading cause for this is incorrectly shutting down the XI server. You must use a derivative of "shutdown -h now" to gracefully close processes/services/etc or you will see corruption.
damned
Posts: 4
Joined: Mon Jun 30, 2014 7:25 am

Re: how to Nagiosxi could test himself SQL?

Post by damned »

uhm...i've about 30 nagiosxi installed and when this happens (luckily so rare) i never see an error reported..
damned
Posts: 4
Joined: Mon Jun 30, 2014 7:25 am

Re: how to Nagiosxi could test himself SQL?

Post by damned »

i will try to explain better: i never received a mail that signaled the problem..if i login to webpage i see the problem, but if i don't login i don't notice any problem..
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: how to Nagiosxi could test himself SQL?

Post by abrist »

Depends which tables are failing and how. If tables are crashing, you could just check the mysql log for "crashed" and then alert on that.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: how to Nagiosxi could test himself SQL?

Post by lmiltchev »

You can set up a simple check using a bash script, maybe something like this:

Code: Select all

#!/bin/bash

tail /var/log/mysqld.log | grep crashed

if [ $? -eq 0 ]
then
        echo "There are crashed tables in mysql database."
        exit 1
else
        echo "No errors in mysql database."
        exit 0
fi
Be sure to check out our Knowledgebase for helpful articles and solutions!
damned
Posts: 4
Joined: Mon Jun 30, 2014 7:25 am

Re: how to Nagiosxi could test himself SQL?

Post by damned »

uh...sound interesting..i will give it a try!
Thank you!!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: how to Nagiosxi could test himself SQL?

Post by slansing »

Yep, it's really as simple as that, you could also use a log check plugin that offers a more robust set of parameters, its up to you.
Locked