Page 1 of 1

Nagios MSSQL Query Monitoring

Posted: Thu Oct 05, 2017 11:35 am
by FrontlineIT
Hello,

We have a MSSQL monitor we would like to error if the result is less than 1. How would we go about setting that up? Below is an example of a monitor that's going into error when the result is > 1. However, we'd like it to error if < 1. Also, we'd like to collect performance data results so that we can analyze graph trends.

check_xi_mssql_query!--username ********* --password "**********" --database ********* --instance ********** --query "SELECT COUNT(1) AS [JobsExecuted] FROM JAMS.dbo.hist WITH (NOLOCK) WHERE start_time > DATEADD(MINUTE,-5,GETUTCDATE())" --result "" --decode --warning 50 --critical 200 --querywarning 0 --querycritical 1!!!!!!!

Re: Nagios MSSQL Query Monitoring

Posted: Thu Oct 05, 2017 4:36 pm
by dwhitfield
What version of XI are you running? There are some bugs related to this that you may be hitting. Also, make sure you are using the latest versions of the wizards. The wizards do not get automatically update with you update XI. You can update the wizards from Admin > Manage Config Wizards.

Can you PM me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.

You can also generate a profile manually using the script at /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh

That should generate a profile in /usr/local/nagiosxi/var/components/ which you can get off the server with an application such as FileZilla.

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.

If you get an error that PROFILE BUILD FAILED, please see https://support.nagios.com/kb/article.p ... ategory=44

Re: Nagios MSSQL Query Monitoring

Posted: Fri Oct 06, 2017 2:39 pm
by FrontlineIT
We were able to figure out how to do this by simply adding a colon after the monitoring threshold. Now the monitor alerts if the queue is less than 1. Example of the working monitor below:

check_xi_mssql_query --username ********* --password "**********" --database ********* --instance ********** --query "SELECT COUNT(1) AS [JobsExecuted] FROM JAMS.dbo.hist WITH (NOLOCK) WHERE start_time > DATEADD(MINUTE,-5,GETUTCDATE())" --result "" --decode --warning 50 --critical 200 --querycritical 1:

Thanks

Re: Nagios MSSQL Query Monitoring

Posted: Fri Oct 06, 2017 2:51 pm
by dwhitfield
Did you have any other questions or are we ready to lock it up?

Re: Nagios MSSQL Query Monitoring

Posted: Wed Oct 18, 2017 7:56 am
by FrontlineIT
This has been resolved and closed.

Re: Nagios MSSQL Query Monitoring

Posted: Wed Oct 18, 2017 9:02 am
by kyang
Sounds great! I'll be closing this topic as resolved!

If you have any more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!