Check MSSQL Database
Check MSSQL Database
Hello,
I'm having difficulties getting the check_mssql_database.py check to successfully connect to a database. I'm able to connect to the database using tsql, and just pymssql in a python interpreter. But when I try to connect using the Nagios check, I get the following error:
(20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (10.48.168.22:1443)\nNet-Lib error during Connection refused (111)\n')
Any adivse?
Thanks !
I'm having difficulties getting the check_mssql_database.py check to successfully connect to a database. I'm able to connect to the database using tsql, and just pymssql in a python interpreter. But when I try to connect using the Nagios check, I get the following error:
(20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (10.48.168.22:1443)\nNet-Lib error during Connection refused (111)\n')
Any adivse?
Thanks !
Re: Check MSSQL Database
Try resolving your issue by following the steps, outlined in the KB article below:
https://support.nagios.com/kb/article/n ... d-735.html
https://support.nagios.com/kb/article/n ... d-735.html
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check MSSQL Database
Thanks. I've tried troubleshooting steps, but still getting the error. Is the check_mssql_database.py my only option for connecting to a mssql database with nagios?
Re: Check MSSQL Database
What exactly have you tried? Can you explain?I've tried troubleshooting steps, but still getting the error.
Please show us the exact command that you are using, run from the command line, along with the output of it.
There may be some 3rd party plugins on the Nagios Exchange. If you find one that looks promising, you can test it, add a new command and a service to Nagios XI, following the document below:Is the check_mssql_database.py my only option for connecting to a mssql database with nagios?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check MSSQL Database
So far, I've tried the following:
First, I initially entered the check_mssql_database.py command which failed: (20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (10.152.15.196)\nNet-Lib error during Connection refused (111)\nDB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (10.152.15.196)\nNet-Lib error during Connection refused (111)\n')
Then, I followed the suggestion in the article you replied with, by changing the tds protocol versin to 7.2:
After that, I tried running the ./check_mssql_database.py, which failed again.(20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (10.152.15.196)\nNet-Lib error during Connection refused (111)\n')
I'm even able to access the database using tsqllocale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
First, I initially entered the check_mssql_database.py command which failed:
Code: Select all
$ ./check_mssql_database.py -H '******' -p 1443 -U 'nagios' -P '*****' -T '******''
Then, I followed the suggestion in the article you replied with, by changing the tds protocol versin to 7.2:
After that, I tried running the ./check_mssql_database.py, which failed again.
Code: Select all
$ ./check_mssql_database.py -H '******' -p 1443 -U 'nagios' -P '*****' -T '******''
I'm even able to access the database using tsql
Code: Select all
$ tsql -S testdb -U nagios -P ******
locale charset is "UTF-8"
using default charset "UTF-8"
Re: Check MSSQL Database
OK, it seems like the python versions check_mssql_database.py and check_mssql_server.py were combined and rewritten in PHP as check_mssql_server.php.
Can you try using the "check_mssql_server.php" plugin to see if it's going to work better for you?
Example:
Valid modes are (from the plugin's usage):
Can you try using the "check_mssql_server.php" plugin to see if it's going to work better for you?
Example:
Code: Select all
/usr/local/nagios/libexec/check_mssql_server.php -H x.x.x.x --checktype 'database' -U 'username' -P 'password' --instancename 'master' --perftype default -p 1433 --mode test --warning 10 --critical 20
activetrans passed!
datasize passed!
logbytesflushed passed!
logcachehit passed!
logfilessize passed!
logfilesused passed!
logfileusage passed!
logflushes passed!
logflushwaits passed!
loggrowths passed!
logshrinks passed!
logtruncs passed!
logwait passed!
transpsec passed!
0/14 tests failed.
--mode Required: Must specify one and only one test, from the list, below...
(-h or --help for more information)
Available Tests
activetrans
datasize
logbytesflushed
logcachehit
logfilessize
logfilesused
logfileusage
logflushes
logflushwaits
loggrowths
logshrinks
logtruncs
logwait
transpsec
custom
time2connect
test
runall
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check MSSQL Database
I don't have the_mssql_server.php check. Do you know where I could download it?
Re: Check MSSQL Database
What is the version of Nagios XI and MSSQL Database wizard that you are currently using?
The plugin is installed by the MSSQL Database wizard ver. 2.0.0. You may be able to update the wizard to the latest version by going to Admin > System Extensions > Manage Config Wizards > Check for Updates > Install Updates. If you Nagios XI version is too old, you may need to update XI in order to get the latest wizards.
The plugin is installed by the MSSQL Database wizard ver. 2.0.0. You may be able to update the wizard to the latest version by going to Admin > System Extensions > Manage Config Wizards > Check for Updates > Install Updates. If you Nagios XI version is too old, you may need to update XI in order to get the latest wizards.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check MSSQL Database
I updated XI, and I now have the "check_mssql_server.php check, and it returns an OK when I use on an MSSQL server to check the database.
Now, when attempting to check for a specific instance, on the databse, it returns an OK even if I enter an invalid instance name.
Example:
Thanks for all your help with this, so far!
Now, when attempting to check for a specific instance, on the databse, it returns an OK even if I enter an invalid instance name.
Example:
Code: Select all
/usr/local/nagios/libexec/check_mssql_server.php -H **** -U '****' -P '****' --perftype default -p 1433 --checktype 'database' -i 'blahblah' --mode time2connect --warning 10 --critical 20
OK: Time to connect was 0.006271s|time=0.006271s;10;20;;
Thanks for all your help with this, so far!
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check MSSQL Database
Instance name is a capital I
Code: Select all
-I, --instance Optional: MSSQL Instance. (Overrides port)