Error message when check sql servers with Nagios Client Inst

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

Do you have any special characters in the password, such as "!"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kxfrancois
Posts: 48
Joined: Mon Nov 19, 2018 9:38 am

Re: Error message when check sql servers with Nagios Client

Post by Kxfrancois »

I have a #, $, and ) in the pw.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

When using special characters in usernames and passwords, they need to be escaped so when they get used in the command, it sends the password formatted correctly.
Typically to escape a character you would put a \ in front of the character. For example, you could try this

Code: Select all

"P\#as\$wor\)"
You also need the double quotes so it is grouped together.

Using the $ sometimes needs to be escaped differently so try this example of escaping the $ with another $ in double quotes.

Code: Select all

"P\#as$"$"wor\)"
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kxfrancois
Posts: 48
Joined: Mon Nov 19, 2018 9:38 am

Re: Error message when check sql servers with Nagios Client

Post by Kxfrancois »

No change. The funny thing is that I can login with that user to SQL Management Studio with no problem.

When I look on the SQL server, I see this message in the event viewer: Login failed for user 'SRV-Nagios-Monitor'. Reason: Could not find a login matching the name provided.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

Can you set the password to a simple password and and try it again?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kxfrancois
Posts: 48
Joined: Mon Nov 19, 2018 9:38 am

Re: Error message when check sql servers with Nagios Client

Post by Kxfrancois »

I tried a very basic password. Still no change
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

I could not find any documentation that says that the plugin can use Active Directory authentication or Windows logins to the SQL database so it may not be compatible.
I could not get it to work unless I used a SQL Authentication account for the MSSQL credentials.
Try that and see if it works.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

I figured out the AD / Windows login problem.
The Windows Authentication / AD issue for the plugin is caused by a incompatibility issue with the pymssql Python module. Older versions don't work and newer ones don't work as well.
The version of that module that did work is version 2.1.1 and to install in on the Centos6 system, you will have to run this command as root.

Code: Select all

pip install pymssql==2.1.1
Then test the plugin to see if it works using the domain login like your example below.

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.py -H 172.28.48.24 -U 'firstlightpower\SRV-Nagios-Monitor' -P 'correct_PW' -p 1433 --averagewait --warning 1500 --critical 2000
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kxfrancois
Posts: 48
Joined: Mon Nov 19, 2018 9:38 am

Re: Error message when check sql servers with Nagios Client

Post by Kxfrancois »

I tried to run the "pip install pymssql==2.1.1" however, it failed with this error:
pip install pymssql==2.1.1
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/late ... ormwarning.
InsecurePlatformWarning
You are using pip version 7.1.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pymssql==2.1.1
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/late ... ormwarning.
InsecurePlatformWarning
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/late ... ormwarning.
InsecurePlatformWarning
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/late ... ormwarning.
InsecurePlatformWarning
Downloading https://files.pythonhosted.org/packages ... 1.1.tar.gz (2.4MB)
100% |████████████████████████████████| 2.4MB 201kB/s
Complete output from command python setup.py egg_info:
setup.py: platform.system() => 'Linux'
setup.py: platform.architecture() => ('64bit', 'ELF')
setup.py: platform.linux_distribution() => ('CentOS', '6.9', 'Final')
setup.py: platform.libc_ver() => ('glibc', '2.2.5')
setup.py: Not using bundled FreeTDS
setup.py: include_dirs = ['/usr/local/include']
setup.py: library_dirs = ['/usr/local/lib']
Couldn't find index page for 'setuptools_git' (maybe misspelled?)
No local packages or download links found for setuptools-git
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-6oVGLL/pymssql/setup.py", line 450, in <module>
ext_modules = ext_modules(),
File "/usr/lib64/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 538, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 780, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 792, in obtain
return installer(requirement)
File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 293, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 466, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools-git')

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6oVGLL/pymssql
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error message when check sql servers with Nagios Client

Post by tgriep »

Lets upgrade the pip installer and the urllib3 module on the system as they need to be updated for the pymssql module.

Run this as root to do the upgrades for the required packages.

Code: Select all

pip install --upgrade pip
pip install urllib3[secure] --upgrade
pip install urllib3 --upgrade
Then after those are upgraded, run this to install the pymssql version 2.1.1 on the server.

Code: Select all

pip install pymssql==2.1.1
Let us know if the package installs on the server after the other packages are installed and that the plugin works as well.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked