Page 4 of 5

Re: MS SQL

Posted: Thu Jun 21, 2012 4:43 pm
by lmiltchev
In this case you should be using the "check_mssql_database.py" with the "-I" flag (and sufficient permissions rights to the database).

Re: MS SQL

Posted: Thu Jun 21, 2012 5:02 pm
by ecarrasq
/usr/local/nagios/libexec/check_mssql_database.py -H '<mssql IP address>' -U '<local username>' -P '<user's password>' -T 'stepwise_subset' -I '<instance name>' --query 'SELECT TOP 1000 [First] FROM [Stepwise_subset].[dbo].[NagiosTest]' --result 'TestResult' --warning 50 --critical 200
usage: check_mssql_database.py -H hostname -U user -P password -T table --mode

check_mssql_database.py: error: no such option: --query

Re: MS SQL

Posted: Fri Jun 22, 2012 8:37 am
by lmiltchev
Yes, there is no option "--query". See the picture bellow:
example.PNG

Re: MS SQL

Posted: Fri Jun 22, 2012 8:55 am
by ecarrasq
I can't keep going back and forth on this.

Please tell me in detail how to query a database that is on an Instance using Nagios Xi.

Thank you

Re: MS SQL

Posted: Fri Jun 22, 2012 9:52 am
by gwakem
From reading the thread and looking at the output from the plugin's syntax help, it does not appear that the check_mssql_database.py contains that functionality. You could try this wizard, which appears to be for exactly this function:

http://exchange.nagios.org/directory/Ad ... rd/details

I hit exchange.nagios.org and searched for mssql, it was in the top five results. There's a few other items in there that may help also.

Re: MS SQL

Posted: Fri Jun 22, 2012 10:47 am
by lmiltchev
Yes, gwakem is right. This wizard uses the "check_mysql_query" plugin, which has this functionality. See bellow:
[root@localhost libexec]# ./check_mysql_query -h
check_mysql_query v1.4.15-46-gefa2 (nagios-plugins 1.4.15)
Copyright (c) 1999-2007 Nagios Plugin Development Team
<[email protected]>

This program checks a query result against threshold levels


Usage:
check_mysql_query -q SQL_query [-w warn] [-c crit] [-H host] [-P port] [-s socket]
[-d database] [-u user] [-p password]

Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-q, --query=STRING
SQL query to run. Only first column in first row will be read
-w, --warning=RANGE
Warning range (format: start:end). Alert if outside this range
-c, --critical=RANGE
Critical range
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-P, --port=INTEGER
Port number (default: 3306)
-s, --socket=STRING
Use the specified socket (has no effect if -H is used)
-d, --database=STRING
Database to check
-u, --username=STRING
Username to login with
-p, --password=STRING
Password to login with
==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==
Your clear-text password could be visible as a process table entry

A query is required. The result from the query should be numeric.
For extra security, create a user with minimal access.

Notes:
You must specify -p with an empty string to force an empty password,
overriding any my.cnf settings.

Send email to [email protected] if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to [email protected]
You install the wizard the usual way: Admin->System Extensions->Manage Config Wizards->Browse->mssql_query.zip->Open->Upload Wizard

Re: MS SQL

Posted: Mon Jul 02, 2012 1:32 pm
by ecarrasq
The check_mysql_query or mssql_query.zip does not contain the option to log into a, "INSTANCE". I need to log into a "MS SQL INSTANCE" to be able to query it.

Re: MS SQL

Posted: Tue Jul 03, 2012 2:51 pm
by ecarrasq
"The check_mysql_query or mssql_query.zip does not contain the option to log into a, "INSTANCE". I need to log into a "MS SQL INSTANCE" to be able to query it."

Please help. Thanks.

Re: MS SQL

Posted: Thu Jul 05, 2012 11:19 am
by scottwilkerson
Sorry for the confusion, you are correct, the current plugin for MSSQL Query does not support instances. I have spoke with one of our developers and they are looking into implementing this.

I will report back when we have the plugin available.

Re: MS SQL

Posted: Thu Jul 05, 2012 2:01 pm
by nscott
ecarrasq,

I believe I have something for you. Attached to this post I have attached a wizard and updated plugins, I would appreciate if you gave them a shot. Here are some instructions:

Before installing the wizard, please establish a terminal session on the server that runs Nagios XI. You'll need to run a few commands:

#1 delete the old check_mssql plugin:
rm /usr/local/nagios/libexec/check_mssql
#2 Remove perl-DBD-Sybase
yum remove perl-DBD-Sybase -y
#3 Install freetds
yum install freetds -y

Then install the attached wizard as you would any other wizard and give it a try. If it does not work, please drop to the terminal again and try running the command:
/usr/local/nagios/libexec/check_mssql -H <IP or FQDNS of MSSQL> -U <username> -P <password> -I <name of instance, no backslashes, just the name>

That should connect, if it does not, please relay here what the error message was.