Page 1 of 2

MSSQL database wizard issue

Posted: Fri Dec 09, 2016 6:16 am
by Naveed
I am trying to monitor my databases metrics with nagios XI.

I had executed mssql database monitoring wizard and using my 'sa' user to monitor db metrics.

its giving service check timeout issue after 60 seconds.

I have attached server logs as well, with screenshot.

kindly guide.

Code: Select all

Dec  9 03:11:44 Nagios-VM nagios: wproc:   host=40.78.31.210; service=MSSQL Log Truncations;
Dec  9 03:11:44 Nagios-VM nagios: wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
Dec  9 03:11:44 Nagios-VM nagios: Warning: Check of service 'MSSQL Log Truncations' on host '40.78.31.210' timed out after 60.007s!
Dec  9 03:11:44 Nagios-VM nagios: SERVICE ALERT: 40.78.31.210;MSSQL Log Truncations;CRITICAL;SOFT;3;(Service check timed out after 60.01 seconds)
Dec  9 03:11:44 Nagios-VM nagios: wproc: Core Worker 49864: job 127 (pid=51124): Dormant child reaped
Dec  9 03:11:46 Nagios-VM nagios: wproc: Core Worker 49865: job 128 (pid=51132) timed out. Killing it
Dec  9 03:11:46 Nagios-VM nagios: wproc: CHECK job 128 from worker Core Worker 49865 timed out after 60.01s
Dec  9 03:11:46 Nagios-VM nagios: wproc:   host=40.78.31.210; service=master MSSQL Database Size;
Dec  9 03:11:46 Nagios-VM nagios: wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
Dec  9 03:11:46 Nagios-VM nagios: Warning: Check of service 'master MSSQL Database Size' on host '40.78.31.210' timed out after 60.010s!
Dec  9 03:11:46 Nagios-VM nagios: wproc: Core Worker 49865: job 128 (pid=51132): Dormant child reaped
Dec  9 03:11:52 Nagios-VM nagios: wproc: Core Worker 49864: job 135 (pid=51171) timed out. Killing it
Dec  9 03:11:52 Nagios-VM nagios: wproc: CHECK job 135 from worker Core Worker 49864 timed out after 60.01s
Dec  9 03:11:52 Nagios-VM nagios: wproc:   host=40.78.31.210; service=masterMSSQL Connection Time;
Dec  9 03:11:52 Nagios-VM nagios: wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
Dec  9 03:11:52 Nagios-VM nagios: Warning: Check of service 'masterMSSQL Connection Time' on host '40.78.31.210' timed out after 60.008s!
Dec  9 03:11:52 Nagios-VM nagios: SERVICE ALERT: 40.78.31.210;masterMSSQL Connection Time;CRITICAL;SOFT;2;(Service check timed out after 60.01 seconds)

Re: MSSQL database wizard issue

Posted: Fri Dec 09, 2016 2:31 pm
by avandemore
/usr/local/nagios/etc/nagios.cfg has a setting for global timeout, each plugin may or may not offer a timeout setting(refer to its documentation), and NSClient has its own timeout setting. See their documentation for setting that.

If you run the command from the command line, what is the full output?

Re: MSSQL database wizard issue

Posted: Fri Dec 09, 2016 2:34 pm
by dwhitfield
Also, is 40.78.31.210 the right address? Is MSSQL running on that server?

Re: MSSQL database wizard issue

Posted: Sun Dec 11, 2016 4:09 am
by Naveed
yes

Re: MSSQL database wizard issue

Posted: Mon Dec 12, 2016 10:25 am
by dwhitfield
I think you may have missed this question: If you run the command from the command line, what is the full output? Thanks!

Re: MSSQL database wizard issue

Posted: Tue Dec 13, 2016 10:25 am
by Naveed
query is giving solution now..

check_xi_mssql_query!--username test --password "1234" --database master --port 1433 --query "SELECT+%2A+FROM+sys.databases" --decode --querywarning 1500 --querycritical 2000 --result Expected result

I have tried to monitored another query which is "select * from sys.databases" it also gives the same result.

How can I get the total number of databases and can add action parameters in my command.

Thanks

Re: MSSQL database wizard issue

Posted: Tue Dec 13, 2016 4:06 pm
by dwhitfield
Naveed wrote: I have tried to monitored another query which is "select * from sys.databases" it also gives the same result.
The same result as what? You attached an OK screenshot, but before you had a timeout screenshot.

Re: MSSQL database wizard issue

Posted: Wed Dec 14, 2016 1:59 am
by Naveed
Yes, I had telnet db port on monitoring server which was not working. I allowed port and its start working for me.

Now 2 different queries are giving same result.

I want to monitor total number of databases but its just giving ok status with query execution time.

Please check and guide.

Thanks

Re: MSSQL database wizard issue

Posted: Wed Dec 14, 2016 1:09 pm
by rkennedy
I believe that's the query that is expected, are you looking for it turn return all of the database names?
Now 2 different queries are giving same result.
Please show us these different queries.

Re: MSSQL database wizard issue

Posted: Thu Dec 22, 2016 1:59 pm
by Naveed
I have executed below query which is working fine with below result...

OK: Query results matched, query duration=0.121833 seconds.

I want to add such action parameters those should check that query execution results, e.g query results in tabular form or nothing etc. I dont want query duration.

Please guide.

check_xi_mssql_query!--username abc --password "123" --database Master --port 1433 --query "select++CAPTION%2C+STATUS%2C%0D%0A++CASE+%0D%0A++++WHEN+STATUS+%3D+3+THEN+%27Error%27%0D%0A%09WHEN+status+%3D+4+THEN+%27Finished%27%0D%0A%09WHEN+status+%3D+8+THEN+%27Cancelled%27%0D%0A%09ELSE+%27Unknown%27%0D%0A++END+AS+JobStatus%2C+%0D%0A++BATCHJOBID%2C+%0D%0A++CANCELEDBY%2C%0D%0A++dateadd%28hour%2C+7%2C+STARTDATETIME%29+as+StartTime%2C+dateadd%28hour%2C+7%2C+ENDDATETIME%29+as+EndTime%2C%0D%0Aformat%28ENDDATETIME+-+STARTDATETIME%2C+%27HH%3Amm%3Ass%27%29+as+RunTime+%0D%0Afrom+BATCHJOBHISTORY%0D%0Awhere+dateadd%28hour%2C+7%2CSTARTDATETIME%29+%3E%3D+getdate%28%29+-1+%0D%0Aand+status+in+%283%2C8%29%0D%0A--order+by+%22end+time%22+desc%2C+status%2C+RunTime+DESC+++++++%0D%0AORDER+BY+%5BEndTime%5D%3B" --result "" --decode