Page 1 of 2
MSSQL Checks to show result in "Status Information"
Posted: Thu Oct 05, 2017 9:38 pm
by FrontlineIT
Hello all, I was hoping to have the MSSQL Checks to show the result in "Status Information".
It shows us the mssql query duration which i would rather not see when looking at the service checks.
Is there a way that could be done just like what we have for other normal checks?
Re: MSSQL Checks to show result in "Status Information"
Posted: Fri Oct 06, 2017 9:05 am
by mcapra
I'm not sure which plugin gets used by the MSSQL Configuration Wizard, but
check_mssql.php has options for returning query results as part of the status information:
Code: Select all
[root@nagios libexec]# ./check_mssql.php --hostname 1.1.1.1 --username username --password password --port 1443 --database database --query "EXEC some_sp @field1=2815, @field2=76;"
OK: Query duration=0.023742 seconds. Query result=2815 Query result=09 Query result=4.2199999999999998 Query result=45.5 Query result=3.9780000000000002 Query result=0 Query result=4.2199999999999998 Query result=3.9780000000000002 Query result=89 Query result=1 Query result=1 Query result=1 Query result=1|query_duration=0.023742s;
In this case, each "Query result" is a column that was returned. Unfortunately that plugin doesn't name the columns.
Re: MSSQL Checks to show result in "Status Information"
Posted: Fri Oct 06, 2017 1:48 pm
by lmiltchev
I am using check_mssql ver. 0.8.1, which seems to be working fine.
Code: Select all
/usr/local/nagios/libexec/check_mssql -V
0.8.1
Code: Select all
/usr/local/nagios/libexec/check_mssql -H x.x.x.x --username xxx --password "xxx" --database master --instance xxx --query "SELECT+COUNT%28%2A%29+FROM+sys.sysperfinfo" --result "1008" --decode --warning 1500 --critical 2000
OK: Query results matched "1008", query duration=0.000771 seconds.|query_duration=0.000771s;1500;2000 'computed0'=1008;
example01.PNG
Can you show us the command that you are running from the command line, along with the output of it?
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 11:35 am
by FrontlineIT
Thank you all. Upgraded to MSSQL to the newest version that i could find (8.0.) The only thing that i have had an issue with are the monitors that are connecting to a database & instance.
Has anyone had any issues with that? Monitors that only connect to the database work just fine.
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 11:52 am
by dwhitfield
Can you show us the command that you are running from the command line, along with the output of it? If you need to PM it instead, feel free.
I have attached check_mysql .8.1 since you were not able to find it. If that does not resolve your issue, can you send me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button in the top right corner. *If* for whatever reason you cannot download the profile, please put the output of View System Info (5.3.4+, Show Profile if older). 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.
If zip files are not allowed, or the attachment is too large, feel free to use
http://otrs.nagios.com/upload.php but please make sure you fill in the ticket# appropriately. If you do not see the ticket # in your subject, I will be happy to give it to you.
If you get an error that PROFILE BUILD FAILED, please see
https://support.nagios.com/kb/article.p ... ategory=44
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 2:13 pm
by FrontlineIT
Its actually the newer version of check_mssql (8.0) not mysql.
Here is the complete check command and result:
/usr/local/nagios/libexec/check_mssql_new -H HOSTNAME --username itsitepomp --password "***********" --database ******* --instance ****** --query "SELECT COUNT(1) AS [JobsExecuted]" --result "" --decode --warning 50 --critical 200 --querycritical 1
CRITICAL: Could not connect to as itsitescope (Exception: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (phledusql2.aesopprod.com) (severity 9)).
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 2:54 pm
by tgriep
There are some issues with using instances and the older version of that plugin. To upgrade the to the latest version, go to the Admin > Manage Config Wizards buttons, check for updated and upgrade the MSSQL query wizard.
The plugin has to be at version 0.8.2 for this to work.
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 2:58 pm
by scottwilkerson
Also, depending on your instance name you may need to be sure it is escaped properly, like
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 4:34 pm
by FrontlineIT
Scott Wilkerson,
--instance "MSSQL\$$MICROSOFTWID"
If my host is: prddb1.us.net
My database is: PRDDBA
My Instance is: PRDPROD
What would my instance look like?
Re: MSSQL Checks to show result in "Status Information"
Posted: Tue Oct 10, 2017 4:44 pm
by dwhitfield
FrontlineIT wrote:Its actually the newer version of check_mssql (8.0) not mysql.
Were you able to upgrade to 0.8.2 using the wizard method mentioned above?
Apologies for the wrong plugin. I checked the correct one and then copied the wrong one. If the wizard method doesn't work, I can drop .0.8.2 in here for you.