I'm in need of a check to run a query against a MSSQL DB and alert/chart the value returned.
Several checks out there are great at showing response times, SQL stats, etc. I've attempted to modify the check_mssql, but I'm not having much success.
Any ideas to help me get this knocked out?
MSSQL check that will return query value as perf data
MSSQL check that will return query value as perf data
Andrew J. - Do you even grok?
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: MSSQL check that will return query value as perf data
Have you taken a look at the mssql query wizard that is included with XI by default? I guess I'm assuming that this is for your XI system, correct me if I am wrong there.
http://exchange.nagios.org/directory/Ad ... rd/details
http://exchange.nagios.org/directory/Ad ... rd/details
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: MSSQL check that will return query value as perf data
Yes, the XI wizard only charts/alerts the response time of the query. I'm looking to monitoring the integer value returned by the query. Response time in addition to that would be fine, similar to check_http where it shows time & size.
Andrew J. - Do you even grok?
Re: MSSQL check that will return query value as perf data
The query I need to run tells me how many records were written to given table in the last X minutes.
I want it to return a low value and warn if >15, critical >30. But I usually expect around 1-5.
The "expected result" field here in the wizard appears to want a higher expected value or it ignores it?
-Andrew
Andrew J. - Do you even grok?
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: MSSQL check that will return query value as perf data
Is it that the plugin is ignoring it, or the wizard is? Once you've gone through the wizard could you provide the command within the service definition that it is giving? I just want to be sure we are getting the same things.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: MSSQL check that will return query value as perf data
I've got the query running successfully with the MS SQL Query wizard, but as you can see, it's only charting the response time...
Andrew J. - Do you even grok?
Re: MSSQL check that will return query value as perf data
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_mssql -H sqldbc1*********.com --username nagiossqluser --password '*************' --database DataCenters_Logs --port 1433 --query 'SELECT count\(\*\) 'PaymentProcessingErrors' FROM DataCenters_Logs.dbo.DataVaultErrorLog WITH \(NOLOCK\) WHERE ErrorTime \> DATEADD\(MI,-5,getdate\(\)\)' --result "1" --decode --warning 1 --critical 2 --querywarning 3 --querycritical 5 --result 0
Andrew J. - Do you even grok?
Re: MSSQL check that will return query value as perf data
I can tell you that the wizard used double quotes instead of singles, also adds special chars in the spaces...
CCM won't run this as a test, but once it's committed, the engine runs it just fine.
CCM won't run this as a test, but once it's committed, the engine runs it just fine.
Andrew J. - Do you even grok?
Re: MSSQL check that will return query value as perf data
Can you go to the Advanced tab of the service view and see what perfdata is being returned? If you want to graph the actual SQL result it will need to be in the perfdata.
Former Nagios employee
Re: MSSQL check that will return query value as perf data
Code: Select all
Performance Data: query_duration=0.053464s;1;2;0;
Andrew J. - Do you even grok?