Page 1 of 2

Plugin check_mssql_health issue on Microsowft Azure

Posted: Tue May 17, 2016 6:37 am
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

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Tue May 17, 2016 10:43 am
by rkennedy
What happens if you take out '--name' or append a database name after that parameter?

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Wed May 18, 2016 6:16 am
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.

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Wed May 18, 2016 4:25 pm
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)

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Mon May 23, 2016 5:53 am
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.

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Mon May 23, 2016 12:18 pm
by tgriep
So, you are not using the check_mssql_health plugin anymore?

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Tue May 24, 2016 4:05 am
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.

Re: Plugin check_mssql_health issue on Microsowft Azure

Posted: Tue May 24, 2016 10:05 am
by rkennedy
Are we good to mark this thread as resolved then?

Re: Plugin check_mssql_health issue on Microsoft Azure

Posted: Tue May 24, 2016 2:03 pm
by peterko
We can close this ticket but is without solution

Re: Plugin check_mssql_health issue on Microsoft Azure

Posted: Tue May 24, 2016 2:58 pm
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?