Page 2 of 3
Re: Nagios SQL Plugin
Posted: Tue Oct 10, 2017 4:37 am
by mindspring
Tried the tests as well and they also fail:
Code: Select all
24/24 tests failed.
[root]@nagiosxi.sam.cpt ~] $ /usr/local/nagios/libexec/check_mssql_server.py -H hostname -U 'uuuuuuuuu' -P 'zzzzzzzzzz' -I 'DB' --test
pagelooks failed with: 'NoneType' object is unsubscriptable
batchreq failed with: 'NoneType' object is unsubscriptable
lockwaits failed with: 'NoneType' object is unsubscriptable
pagereads failed with: 'NoneType' object is unsubscriptable
totalpages failed with: 'NoneType' object is unsubscriptable
readahead failed with: 'NoneType' object is unsubscriptable
pagewrites failed with: 'NoneType' object is unsubscriptable
stolenpages failed with: 'NoneType' object is unsubscriptable
targetpages failed with: 'NoneType' object is unsubscriptable
fullscans failed with: 'NoneType' object is unsubscriptable
locktimeouts failed with: 'NoneType' object is unsubscriptable
freepages failed with: 'NoneType' object is unsubscriptable
bufferhitratio failed with: list index out of range
averagewait failed with: list index out of range
checkpoints failed with: 'NoneType' object is unsubscriptable
lockrequests failed with: 'NoneType' object is unsubscriptable
pagelife failed with: 'NoneType' object is unsubscriptable
databasepages failed with: 'NoneType' object is unsubscriptable
deadlocks failed with: 'NoneType' object is unsubscriptable
cachehit failed with: list index out of range
pagesplits failed with: 'NoneType' object is unsubscriptable
lockwait failed with: 'NoneType' object is unsubscriptable
lazywrites failed with: 'NoneType' object is unsubscriptable
sqlcompilations failed with: 'NoneType' object is unsubscriptable
24/24 tests failed.
Re: Nagios SQL Plugin
Posted: Tue Oct 10, 2017 8:55 am
by tgriep
Can you run the following commands and post the /tmp/info.txt file?
Code: Select all
pip list >/tmp/info.txt
yum list installed |grep -i python >>/tmp/info.txt
grep Version /usr/local/nagios/libexec/check_mssql_server.py >>/tmp/info.txt
cat /etc/freetds.conf >>/tmp/info.txt
Re: Nagios SQL Plugin
Posted: Tue Oct 24, 2017 4:36 am
by mindspring
Here you go
Code: Select all
[root]@nagiosxi ~] $ cat /tmp/info.txt
backports.ssl-match-hostname (3.4.0.2)
distribute (0.6.10)
ethtool (0.6)
iniparse (0.3.1)
iwlib (1.0)
lxml (2.2.3)
nose (0.10.4)
numpy (1.4.1)
ordereddict (1.2)
pip (7.1.0)
py-rrdtool (0.2.1)
pycurl (7.19.0)
pygpgme (0.1)
pymongo (2.5.2)
pymssql (1.0.2)
pyxdg (0.18)
setuptools (0.6rc11)
simplejson (2.0.9)
urlgrabber (3.9.1)
yum-metadata-parser (1.1.2)
next command
Code: Select all
[root]@nagiosxi ~] $ cat /tmp/info.txt
dbus-python.x86_64 0.83.0-6.1.el6 @base
libproxy-python.x86_64 0.3.0-10.el6 @base
newt-python.x86_64 0.52.11-4.el6 @base
notify-python.x86_64 0.1.1-10.el6 @base
python.x86_64 2.6.6-66.el6_8 @updates
python-backports.x86_64 1.0-5.el6 @base
python-backports-ssl_match_hostname.noarch
python-bson.x86_64 2.5.2-3.el6.1 @epel
python-ethtool.x86_64 0.6-6.el6 @base
python-iniparse.noarch 0.3.1-2.1.el6 @anaconda-CentOS-201106060106.x86_64/6.0
python-iwlib.x86_64 0.1-1.2.el6 @base
python-libs.x86_64 2.6.6-66.el6_8 @updates
python-lxml.x86_64 2.2.3-1.1.el6 @base
python-nose.noarch 0.10.4-3.1.el6 @base
python-pip.noarch 7.1.0-1.el6 @epel
python-pycurl.x86_64 7.19.0-9.el6 @base
python-pymongo.x86_64 2.5.2-3.el6.1 @epel
python-setuptools.noarch 0.6.10-3.el6 @base
python-simplejson.x86_64 2.0.9-3.1.el6 @base
python-urlgrabber.noarch 3.9.1-11.el6 @base
rpm-python.x86_64 4.8.0-55.el6 @base
rrdtool-python.x86_64 1.3.8-10.el6 @base
next command
Code: Select all
[root]@nagiosxi ~] $ cat /tmp/info.txt
# Version 2.0.2
last command
Code: Select all
[root]@nagiosxi ~] $ cat /tmp/info.txt
# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
# A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
Re: Nagios SQL Plugin
Posted: Tue Oct 24, 2017 2:23 pm
by tgriep
Something is corrupted in your plugin and it is an older version, go to the following link to update it.
https://github.com/NagiosEnterprises/ch ... _server.py
Updating it through the Admin > Manage Config Wizards did not work for some reason.
Download the file to your desktop, then in the XI GUI, go to the Admin > Manage Plugins menu.
Browse to the downloaded plugin and check the box called Convert line endings and upload the plugin.
Then see if that fixes the issue with that check.
Also, what version of Nagios XI are you running and what version of MSSQL is the remote server running?
Re: Nagios SQL Plugin
Posted: Fri Oct 27, 2017 9:46 am
by mindspring
Nagios XI is version 5.4.0 and the SQL is running is 2012, 2014 and 2016.
Ok great I am getting different errors now.
It changed from
Code: Select all
File "/usr/local/nagios/libexec/check_mssql_server.py", line 469, in <module>
main()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 435, in main
execute_query(mssql, options, host)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 448, in execute_query
mssql_query.do(mssql)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 284, in do
self.run_on_connection(connection)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 271, in run_on_connection
self.query_result = cur.fetchone()[0]
TypeError: 'NoneType' object is unsubscriptable
To this error:
Code: Select all
<type 'exceptions.TypeError'>
Caught unexpected error. This could be caused by your sysperfinfo not containing the proper entries for this query, and you may delete this service check.
Does this shelp?
Re: Nagios SQL Plugin
Posted: Fri Oct 27, 2017 10:04 am
by tgriep
Are you running the freepages option when you run the test?
If so, it will fail as newer versions on MSSQL do not have the Free Pages counter and was was removed in 2012.
http://blogs.msdn.com/b/vsanil/archive/ ... -2012.aspx
Re: Nagios SQL Plugin
Posted: Wed Nov 01, 2017 2:50 am
by mindspring
I don't think I am using this option.
Just a note that the issue is on SQL 2014 but here are other SQL 2014 servers that I am monitoring that doesn't bring up this error and they are not meant to be anything different in the configuration.
Any other ideas?
Re: Nagios SQL Plugin
Posted: Wed Nov 01, 2017 2:29 pm
by npolovenko
@mindspring , Are you able to manually query MySQL from your Nagios server?
Have you tried running a query using a different check_mysql plugin? I think you should have another one written in C instead of Python in libexec folder.
In your freetds file uncomment tds version line under global settings
[global]
# TDS protocol version
; tds version = 4.2
And change it to
tds version = 7.0
And you said you're able to query all other MySQL servers using the same plugin and the same command, right?
Finally, can you post the exact command you tried to run the last time so i can try to replicate this issue?
Re: Nagios SQL Plugin
Posted: Thu Nov 02, 2017 9:27 am
by mindspring
Thanks I made the tds change but it still complains. So the connection time responds but things like Deadlocks and Lock request, lock wait times and average wait times are coming up with that error.
I found the check_mssql php script but it just makes a connection. I can't see how to use this script to test the options above that are not working.
Re: Nagios SQL Plugin
Posted: Thu Nov 02, 2017 5:03 pm
by npolovenko
@mindspring, I'd like to see the exact commands you're running. Could you post them here? I spinned up MSSQL 2014 and so far all the commands from your original post worked fine. We need to see the exact syntax to be able to troubleshoot.