mssql checks

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

mssql checks

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: mssql checks

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: mssql checks

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: mssql checks

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: mssql checks

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: mssql checks

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: mssql checks

Post 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*
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: mssql checks

Post 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]
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: mssql checks

Post 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%';
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: mssql checks

Post 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.
Locked