Plugin check_mssql_health issue on Microsowft Azure

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
peterko
Posts: 6
Joined: Tue May 17, 2016 5:53 am

Plugin check_mssql_health issue on Microsowft Azure

Post by peterko »

Hello everyone,
I have a problem with using plugin check_mssql_health for Azure SQL Database.
Every time I was trying to connect to the database monitor and execute SQL Statement (get the result of user defined function), I got an error, because I connect to master database instead of monitor database.
Do you have any idea why Nagios ignore my server configuration and why connects to the master database instead of monitor database?

My configuration in /etc/freetds/freetds.conf is:

Code: Select all

[abcd]
  host = abcd.database.windows.net
  port = 1433
  database = monitor
  tds version = 8.0
  #instance = monitor
My statement is:

Code: Select all

/usr/lib/nagios/plugins/check_mssql_health -v --server abcd --username "xyz123abc" --password 'XYZ123456' --mode sql --name "SELECT * FROM [dbo].[GetMonitoringStatus] ('Density')'" --commit
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by rkennedy »

What happens if you take out '--name' or append a database name after that parameter?
Former Nagios Employee
peterko
Posts: 6
Joined: Tue May 17, 2016 5:53 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by peterko »

Hi, if I try remove name parameter:

Code: Select all

/usr/lib/nagios/plugins/check_mssql_health -v --server abcd --username "xyz123abc" --password 'XYZ123456' --mode sql  "SELECT * FROM [dbo].[GetMonitoringStatus] ('Density')'" --commit
I got an error:

Code: Select all

UNKNOWN - Use of uninitialized value $sql in sprintf at /usr/lib/nagios/plugins/check_mssql_health line 3322.
Use of uninitialized value in subroutine entry at /usr/lib/perl5/DBD/Sybase.pm line 138.
Use of uninitialized value $sql in pattern match (m//) at /usr/lib/nagios/plugins/check_mssql_health line 3330.
Use of uninitialized value $sql in pattern match (m//) at /usr/lib/nagios/plugins/check_mssql_health line 3330.
Use of uninitialized value $sql in pattern match (m//) at /usr/lib/nagios/plugins/check_mssql_health line 3333.
Use of uninitialized value $sql in pattern match (m//) at /usr/lib/nagios/plugins/check_mssql_health line 3333.
If I try add database name into name parameter:

Code: Select all

/usr/lib/nagios/plugins/check_mssql_health -v --server abcd --username "xyz123abc" --password 'XYZ123456' --mode sql  --name abcd "SELECT * FROM [dbo].[GetMonitoringStatus] ('Density')'" --commit
I got an error:

Code: Select all

UNKNOWN - DBD::Sybase::st execute failed: Server message number=2812 severity=16 state=62 line=1 server=abcd text=Could not find stored procedure 'abcd'.  at /usr/lib/nagios/plugins/check_mssql_health line 3328.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by tgriep »

It looks like you added the database name in the middle of the query option. Try running the command like below.

Code: Select all

/usr/lib/nagios/plugins/check_mssql_health -v --server abcd --username "xyz123abc" --password 'XYZ123456' --name abcd --mode sql  "SELECT * FROM [dbo].[GetMonitoringStatus] ('Density')'" --commit
Also, when running the sql command, the query can only return a number for that check to work.
--mode sql (any sql command returning a single number)
Be sure to check out our Knowledgebase for helpful articles and solutions!
peterko
Posts: 6
Joined: Tue May 17, 2016 5:53 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by peterko »

Hi,
I try following code:

Code: Select all

/usr/lib/nagios/plugins/check_mssql_health -v --server abcd --username "xyz123abc" --password 'XYZ123456' --name abcd --mode sql "SELECT 1 FROM [dbo].[GetMonitoringStatus] ('Density')" --commit
It does not work, still the same issue
Could not find stored procedure 'abcd'
The check_mssql_health plugin use the name parameter as the name of stored procedure instead of name of the database.

Thank you for your help, but I already created the python script to connect into Azure SQL and it runs perfectly fine.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by tgriep »

So, you are not using the check_mssql_health plugin anymore?
Be sure to check out our Knowledgebase for helpful articles and solutions!
peterko
Posts: 6
Joined: Tue May 17, 2016 5:53 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by peterko »

Hi,
we already do not use the plugin because of issue with Microsoft Azure, for us is much simpler use python module for Azure connected to Nagios.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Plugin check_mssql_health issue on Microsowft Azure

Post by rkennedy »

Are we good to mark this thread as resolved then?
Former Nagios Employee
peterko
Posts: 6
Joined: Tue May 17, 2016 5:53 am

Re: Plugin check_mssql_health issue on Microsoft Azure

Post by peterko »

We can close this ticket but is without solution
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Plugin check_mssql_health issue on Microsoft Azure

Post by rkennedy »

peterko wrote:We can close this ticket but is without solution
Just to clarify - I thought you wrote out a python script that let you accomplish what you're looking to do?
Former Nagios Employee
Locked