Page 3 of 3

Re: Nagios SQL Plugin

Posted: Fri Nov 03, 2017 1:49 am
by mindspring
Hi there,

Are you referring to this command?

check_xi_mssql_server!-U 'xxxxx' -P 'xxxxxx' -I 'xxxDB' --deadlocks --warning 20 --critical 30

Re: Nagios SQL Plugin

Posted: Fri Nov 03, 2017 6:01 am
by tacolover101
mindspring wrote: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?
fyi, the sysperfinfo table varies between SQL versions, as you're using all 3 this could explain the error above.

Code: Select all

check_xi_mssql_server!-U 'xxxxx' -P 'xxxxxx' -I 'xxxDB' --deadlocks --warning 20 --critical 30
this is part of it, can you also post how check_xi_mssql_server is defined?

Re: Nagios SQL Plugin

Posted: Fri Nov 03, 2017 9:32 am
by npolovenko
In addition to @tacolover101 post I'd ask you to run the same command, from the command line, but without specifying the instance.

Code: Select all

check_mssql_server.py -U 'xxxxx' -P 'xxxxxx'  -p 1433 --deadlocks --warning 20 --critical 30
Do you get the same error?

Re: Nagios SQL Plugin

Posted: Mon Nov 06, 2017 4:12 am
by mindspring
Thanks I am not sure I understand what @tacolover101 is asking but here is the output of the command @npolovenko

@tacolover101 can you please clarify a bit of of what you require me to do?

Code: Select all


[root]@nagiosxi /usr/local/nagios/libexec] $ ./check_mssql_server.py -H myhostname  -U 'xxxxxx' -P 'xxxxxxx'   --test
pagelooks failed with: 'NoneType' object is unsubscriptable
batchreq failed with: 'NoneType' object is unsubscriptable
connections passed!
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
memory passed!
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
cpu passed!
24/27 tests failed.


Re: Nagios SQL Plugin

Posted: Mon Nov 06, 2017 2:02 pm
by npolovenko
@mindspring, It seems like some performance counters may be missing on your MSSQL server, or they might not work with the plugin's version.
I'd take a look at SQL server logs. In SQL server studio you can find them under Management/SQL Server Logs.
Also, on your MSSQL you could run this query to see if performance counters exist:

Code: Select all

select * from sys.dm_os_performance_counters order by object_name
I'd try to match up those against the failing ones.
I'd check the user and database permissions one more time as well.

Re: Nagios SQL Plugin

Posted: Mon Dec 04, 2017 8:55 am
by mindspring
Thanks, I am still battling with this issue.

I think I should tackle one check at a time. I want to try to get one specific database size check to work. This server is running SQL Express 2014.
This is the error I am getting

Code: Select all


<class 'pymssql.InterfaceError'>
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.

And from the command line

Code: Select all

[root]@nagiosxi ~] $ /usr/local/nagios/libexec/check_mssql_server.py -H xxxx -U 'xxxx' -P 'xxxxx' -I xxxxx  --test 

Connection to the database failed for an unknown reason.

Any further ideas?

Re: Nagios SQL Plugin

Posted: Mon Dec 04, 2017 11:48 am
by npolovenko
@mindspring, I think the fact that half of the mssql checks do work on your system indicates that the plugin works fine and can connect to the server. However, the performance counters may be missing. You said you're using SQL Express Server 2014 verses we've tested the plugin on the SQL Server 2014. Perhaps your version of MSSQL doesn't have all the monitoring capabilities that this particular plugin is using. My recommendation would be to look for an alternative plugin on the exchange.
https://exchange.nagios.org/directory/P ... /SQLServer
You could also try MSSQL database monitoring wizard in XI.