MS SQL

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MS SQL

Post 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).
Be sure to check out our Knowledgebase for helpful articles and solutions!
ecarrasq
Posts: 244
Joined: Tue Feb 22, 2011 5:58 pm

Re: MS SQL

Post 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
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MS SQL

Post by lmiltchev »

Yes, there is no option "--query". See the picture bellow:
example.PNG
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ecarrasq
Posts: 244
Joined: Tue Feb 22, 2011 5:58 pm

Re: MS SQL

Post 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
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Re: MS SQL

Post 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.
--
Griffin Wakem
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MS SQL

Post 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
<nagiosplug-devel@lists.sourceforge.net>

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 nagios-users@lists.sourceforge.net if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to nagiosplug-devel@lists.sourceforge.net
You install the wizard the usual way: Admin->System Extensions->Manage Config Wizards->Browse->mssql_query.zip->Open->Upload Wizard
Be sure to check out our Knowledgebase for helpful articles and solutions!
ecarrasq
Posts: 244
Joined: Tue Feb 22, 2011 5:58 pm

Re: MS SQL

Post 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.
ecarrasq
Posts: 244
Joined: Tue Feb 22, 2011 5:58 pm

Re: MS SQL

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MS SQL

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: MS SQL

Post 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.
You do not have the required permissions to view the files attached to this post.
Nicholas Scott
Former Nagios employee
Locked