I have a mssql query where query returns backup history of all database nodes for which backup has not happened for more than 1 day and output contains database name and time frame of backup last happened. Now I need a script to monitor mssql query and trigger critical state alert when query returns any output and if query returns null script should show ok.
Appreciate quick help here
mssql query monitoring
Re: mssql query monitoring
The /usr/local/nagios/libexec/check_mssql plugin may be able to help here. It may be easier to work with a count of databases that don't have a backup. The example provided in check_mssql's help has:
Test this from the command line first and then once that works you can use the MS SQL wizard to create a check in the XI UI.
Code: Select all
check_mssql -H myserver -U myuser -P mypass -q "SELECT COUNT(*) FROM mytable" -r "632" -c 10 -W 2 -C 5As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: mssql query monitoring
If query returns numeric value, script provided by you will work.
But my query itself will Returns string data + date . I want to alert them if query returns any output and if query returns null I want to show ok.
But my query itself will Returns string data + date . I want to alert them if query returns any output and if query returns null I want to show ok.
Re: mssql query monitoring
Have you tested anything with the check_mssql plugin? From my testing, this looks like it should do the trick:
/usr/local/nagios/libexec/check_mssql -H DATABASEIP --username "USERNAME" --password "PASSWORD" --database DATABASENAME --port 1433 --query "YOURQUERY" --decode --warning 50 --critical 200 --result ""
/usr/local/nagios/libexec/check_mssql -H DATABASEIP --username "USERNAME" --password "PASSWORD" --database DATABASENAME --port 1433 --query "YOURQUERY" --decode --warning 50 --critical 200 --result ""
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: mssql query monitoring
Query will result string data .it will not result number value .
Re: mssql query monitoring
Correct, the last query I provided will result in a string being returned. It checks to see if a string is returned and if there is one returned it will trigger a CRITICAL. If nothing is returned it will be OK.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: mssql query monitoring
Can you give me link to download check_mssql plugin script?
Re: mssql query monitoring
The check_mssql plugin is installed by default in Nagios XI. You should have it on your system... You can confirm that by running:
Code: Select all
/usr/local/nagios/libexec/check_mssql -hBe sure to check out our Knowledgebase for helpful articles and solutions!