Page 1 of 2

mssql checks

Posted: Fri Aug 21, 2015 2:12 pm
by emartine
I ran the mssql database and server wizards and noticed that services were flapping due to us using gearman. The gearman host apparently didn't have /usr/local/nagios/libexec/check_mssql_server.py" or /usr/local/nagios/libexec/check_mssql_database.py" We are running RHEL 6 servers. I can easily just go and make my own modifications but I'd rather ask... what is the correct way to add the repos so I can install this package?

Re: mssql checks

Posted: Fri Aug 21, 2015 2:21 pm
by lmiltchev
The document below describes how to install the prereqs for the mssql wizards/plugins:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: mssql checks

Posted: Fri Aug 21, 2015 3:22 pm
by emartine
Thanks. I installed it on both gearman servers. One was ok and the other was not. Any idea what this means?


/usr/local/nagios/libexec/check_mssql_server.py -H <servername> -U '<account>' -P '<password>' -p <port> --targetpages --warning 70000 --critical 90000
DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist
Net-Lib error during Operation now in progress Error 115 - Operation now in progress

Re: mssql checks

Posted: Mon Aug 24, 2015 9:21 am
by ssax
Are you sure the username and password are correct?

Is there a firewall/ACL rule in place, either locally, in between, or on the remote DB?

Re: mssql checks

Posted: Mon Aug 24, 2015 9:30 am
by lmiltchev
In addition to this, can you test running:

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.py -H <servername> -U '<account>' -P '<password>' -I <instance name> --targetpages --warning 70000 --critical 90000
instead of

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.py -H <servername> -U '<account>' -P '<password>' -p <port> --targetpages --warning 70000 --critical 90000
Do you get the same error?

Re: mssql checks

Posted: Mon Aug 31, 2015 11:26 am
by emartine
Yes the password is correct. I am able to obtain data from other checks. Attached is a screenshot of the checks that I am able to get working.
The rest apparently give

[Errno 13] Permission denied: '/tmp/mssql--*

or

[Traceback (most recent call last):

Not sure what these mean.

From what I've tested if I type them into the command line these seem to work:

For the Errno 13 I get this:
/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --pagewrites --warning 3000000 --critical 6000000
OK: Page Writes / Sec is 0.0/sec|page_writes=0.0;3000000;6000000;;;

/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --deadlocks --warning 20 --critical 30
OK: Deadlocks / Sec is 0.00120656735007/sec|deadlocks=0.00120656735007;20;30;;;


For the Tracebacks:

/usr/local/nagios/libexec/check_mssql_server.py <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --stolenpages --warning 500 --critical 700
Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_mssql_server.py", line 464, in <module>
main()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 430, in main
execute_query(mssql, options, host)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 443, in execute_query
mssql_query.do(mssql)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 282, in do
self.run_on_connection(connection)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 269, in run_on_connection
self.query_result = cur.fetchone()[0]
TypeError: 'NoneType' object is unsubscriptable

Re: mssql checks

Posted: Mon Aug 31, 2015 12:24 pm
by lmiltchev
For the Errno 13 I get this:
/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --pagewrites --warning 3000000 --critical 6000000
OK: Page Writes / Sec is 0.0/sec|page_writes=0.0;3000000;6000000;;;

/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --deadlocks --warning 20 --critical 30
OK: Deadlocks / Sec is 0.00120656735007/sec|deadlocks=0.00120656735007;20;30;;;
Are you running these check as root or as nagios user? Can you try running them as nagios user?

Code: Select all

su nagios
/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --pagewrites --warning 3000000 --critical 6000000
/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --deadlocks --warning 20 --critical 30
What are the permissions on the "/tmp" dir and mssql temp files?

Code: Select all

ls -lad /tmp
ls -ls /tmp/mssql*

Re: mssql checks

Posted: Wed Sep 02, 2015 10:56 am
by emartine
Thank you. I forgot about that. I removed the /tmp/mssql* files owned by root and had nagios recreate them. Those all look ok now. Any idea what the traceback calls mean? This same error occurs at the commandline as well.
/usr/local/nagios/libexec/check_mssql_server.py -H <Servername> -U '<USERNAME>' -P '<PASSWORD>' -p 1433 --stolenpages --warning 500 --critical 700

[Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_mssql_server.py", line 464, in <module> main()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 430, in main execute_query(mssql, options, host)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 443, in execute_query mssql_query.do(mssql)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 282, in do self.run_on_connection(connection)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 269, in run_on_connection self.query_result = cur.fetchone()[0]
TypeError: 'NoneType' object is unsubscriptable]

Re: mssql checks

Posted: Wed Sep 02, 2015 11:53 am
by ssax
This is likely because you do not have the data in the database.

If you you run this SQL query on your DB it likely won't return anything for Stolen pages and the Lock requests/sec is probably missing for your instance:

Code: Select all

SELECT * FROM sysperfinfo WHERE counter_name LIKE '%Stolen pages%' OR counter_name LIKE '%Lock requests/sec%';

Re: mssql checks

Posted: Thu Sep 03, 2015 12:37 pm
by emartine
I guess if there is no data in the database I won't bother with it.

On my second gearman host I am still not able to run the /usr/local/nagios/libexec/check_mssql_database.py properly.

I get

DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist
Net-Lib error during Operation now in progress Error 115 - Operation now in progress


Same version of pymssql, freetds, and nagiosxi-nagiosplugins are installed on both.