Page 3 of 5
Re: MS SQL
Posted: Thu Jun 21, 2012 2:00 pm
by lmiltchev
Try to run these two commands in the command line and show us the output (removing sensitive data):
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H '<mssql IP address>' -U '<local username>' -P '<user's password>' -T 'stepwise_subset' -I 'db001a' -p 1433 --activetrans --warning 10 --critical 20
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H '<mssql IP address>' -U '<local username>' -P '<user's password>' -T 'stepwise_subset' -I 'db001a' --activetrans --warning 10 --critical 20
Also, just in case, check if you can actually access port 1433:
or
Re: MS SQL
Posted: Thu Jun 21, 2012 2:30 pm
by ecarrasq
Command:
telnet <mssql IP address> 1433
- Result:
Trying <mssql IP address>...
telnet: connect to address <mssql IP address>: Connection refused
telnet: Unable to connect to remote host: Connection refused
-----------------------------------------------------------------------------------------------------------------
Command:
# nc -z <mssql IP address> 1433
----------------------------------------------------------------------------------------------------------------
Command:
# /usr/local/nagios/libexec/check_mssql_database.py -H '<mssql IP address>' -U '<local username>' -P '<user's password>' -T 'stepwise_subset' -I 'db001a' -p 1433 --activetrans --warning 10 --critical 20
- Result:
CRITICAL:Unable to access SQL Server.
----------------------------------------------------------------------------------------------------------------
Command:
# /usr/local/nagios/libexec/check_mssql_database.py -H '<mssql IP address>' -U '<local username>' -P '<user's password>' -T 'stepwise_subset' -I 'db001a' --activetrans --warning 10 --critical 20
- Result:
CRITICAL:Can access server but cannot query.
Re: MS SQL
Posted: Thu Jun 21, 2012 2:39 pm
by lmiltchev
If you cannot telnet into port 1433, it means it is not accessible and your checks will not work either. You need to fix this first.
Re: MS SQL
Posted: Thu Jun 21, 2012 2:48 pm
by ecarrasq
I will check with the Net Admins on that; However, I removed the "-p 1433" from the command line, and it seems I can connect just not query:
I'm using a local MS SQL Account with Read Only access, should that account be able to query?
Thanks, and I'll get back to you guys after verifying port 1433.
Re: MS SQL
Posted: Thu Jun 21, 2012 3:18 pm
by lmiltchev
I believe we are moving to the right direction but it seems like you don't have enough permission rights to the database that you are trying to access.
Re: MS SQL
Posted: Thu Jun 21, 2012 3:28 pm
by ecarrasq
Looks like the script is looking at the "master" table, which the account I was given only has read only for the database specified. We were looking at your other script in "MSSQL Query Wizard" and found this may be the option that will work, for what they are seeking; However, I just did a "./check_mysql_query --help" , but do not see an option for "instance". Is that something you guys can add?
check_mysql_query v2034 (nagios-plugins 1.4.13)
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.
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]
Re: MS SQL
Posted: Thu Jun 21, 2012 3:30 pm
by lmiltchev
Try running:
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -h
Re: MS SQL
Posted: Thu Jun 21, 2012 3:47 pm
by ecarrasq
the "check_mssql_database.py" does have the "Instance" option, but I don't see that option in the "check_mysql_query".
Re: MS SQL
Posted: Thu Jun 21, 2012 4:10 pm
by lmiltchev
This is a completely different plugin... Are you trying to monitor a MySQL or MSSQL? Are these on the same machine? I am confused.
Re: MS SQL
Posted: Thu Jun 21, 2012 4:14 pm
by ecarrasq
Sorry! typo...
I am trying to monitor MSSQL (Microsoft SQL), but we need the ability to query the MSSQL database that is on a Instance.