Nagios xi MSSQL Database monitoring

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Nagios xi MSSQL Database monitoring

Post by LJMangha »

Hello,

I'm fairly new to Nagios xi and have things working, but when I "run a config wizard" and I set up MSSQL database monitoring in xi we get this error on all the services for SQL:
AdventureWorks2019 MSSQL Active Transactions Critical 3d 23h 58m 59s 5/5 2022-01-10 15:11:17 (No output on stdout) stderr: /bin/sh: 1: Syntax error: Unterminated quoted string

Not sure if I'm missing the plugins for this or if I need a prerequisite for this to work?

Here is the command when you go through the wizard to set it up:
check_xi_mssql_database2! --checktype 'database' -U 'SQLTesting' -P 'MyPassword' --instancename 'AdventureWorks2019' --perftype default -p 1433 --mode activetrans --warning 10 --critical 20

check_xi_mssql_database2! isn't listed in the libexec folder. Not sure if that makes a difference. My Nagios xi version is 5.8.7

Thank you in advance for the help.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi MSSQL Database monitoring

Post by pbroste »

Hello @LJMangha

Thanks for reaching out, want to provide the list of the corresponding commands and we see that 'check_xi_mssql_database2' is executing the check_mssql_server.php command found in '/usr/local/nagios/libexec/....'. The list provides what other mssql service checks are running as well:
define command {
command_name check_xi_mssql_database2
command_line $USER1$/check_mssql_server.php -H $HOSTADDRESS$ $ARG1$
}

define command {
command_name check_xi_mssql_query
command_line $USER1$/check_mssql -H $HOSTADDRESS$ $ARG1$
}

define command {
command_name check_xi_mssql_server2
command_line $USER1$/check_mssql_server.php -H $HOSTADDRESS$ $ARG1$
}
Please execute the command to test the parameters, once the passed you can build in the web console with the args.

Thanks,
Perry
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Re: Nagios xi MSSQL Database monitoring

Post by LJMangha »

Hi Perry, sorry had issues getting back into this support forum due to trail licensing issues. Can you elaborate on what you want me to do here please? Is this something that doesn't work out the box? I'm a bit confused on why I need to test and configure anything. Thanks in advance.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi MSSQL Database monitoring

Post by pbroste »

Hello @LJMangha

Thanks for following up,
check_xi_mssql_database2! isn't listed in the libexec folder. Not sure if that makes a difference. My Nagios xi version is 5.8.7
The check_xi_mssql_database2 is an alias or for check_mssql_server.php

Please run through the Configuration Wizard updates by going to:

Admin > Manage Config Wizards > Check for Updates > Install Updates

Let us know how things look,
Perry
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Re: Nagios xi MSSQL Database monitoring

Post by LJMangha »

Hi Perry,

Thanks for the info!
Yes, it did update the following when I ran the manage config wizard:
MSSQL Database
MSSQL Query
MSSQL Server
Microsoft/Office 365
SNMP Walk

I went in and deleted the MSSQL services that were failing and re-ran the configure wizard for MSSQL Database and maybe I'm not putting in the correct information?
Configuration Wizard: MSSQL Database - Step 1
Specify the details for connecting to the MSSQL Database you want to monitor.
Address: 10.x.x.x
Instance: MSSQLSERVER
Port: 1433
Version: (drop down list only has two options for sql? 2016 (SQL16) & 2014 (SQL16) we are running SQL 2019 so not too sure what to put here?
Username: SQLTesting
Password: MyPassword
Database: AdventureWorks2019

Then check what services to monitor and click Finish. Once finished I still get the following error:
(No output on stdout) stderr: /bin/sh: 1: Syntax error: Unterminated quoted string

You think I'm filling out something wrong in the info above?

I can call into support if that would be easier than this post?

Thank you,
Larry
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Re: Nagios xi MSSQL Database monitoring

Post by LJMangha »

Maybe it has something to do with the Different Configuration wizards:
1) MSSQL Database (anything I set up doesn't work with this wizard)
2) MSSQL Server (works with this wizard)

Here are the commands for both:
1)check_xi_mssql_database2! --checktype 'database' -U 'SQLTesting' -P 'OurPassword' --instancename 'AdventureWorks2019' --perftype default -I 'MSSQLSERVER' -p 1433 --mode activetrans --warning 10 --critical 20

2)check_xi_mssql_server2! --checktype 'server' -U 'SQLTesting' -P 'OurPassword' --perftype default -I 'MSSQLSERVER' -p 1433 --mode time2connect --warning 1 --critical 5

The checktype is where it seems to be an issue. When it's checktype server it works but when it's checktype database it doesn't.

*side note is when i configure the service to monitor it puts a \ in my password and i get this error message:
ERROR: [run_check] CRITICAL: Could not connect to dblib:host=our-sqltest2.corp\MSSQLSERVER:dbname=AdventureWorks2019:charset=UTF8 as SQLTesting (Exception: SQLSTATE[01002] Adaptive Server connection failed (our-sqltest2.corp\MSSQLSERVER) (severity 9))

I have to go in and edit the password to correct it every time and remove the added \ it puts in right before the last character. then after i correct that i get that old error.
(No output on stdout) stderr: /bin/sh: 1: Syntax error: Unterminated quoted string

So does it have something to do with if I chose MSSQL database or MSSQL server to monitor which is the difference with the wizards.

I'm probably confusing you, because I'm very confused. lol thanks again for your time Perry.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi MSSQL Database monitoring

Post by pbroste »

Hello @LJMangha

Thanks for following up, you are correct that comparing the two service checks they pretty much do the same thing. You can take a look that the help menu to compare: '/usr/local/nagios/libexec/check_mssql_server.php -h'

The option to place the credentials into a file and then reference that in an $arg$$ on the command: Thanks and have a most excellent weekend,
Perry
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Re: Nagios xi MSSQL Database monitoring

Post by LJMangha »

I was thinking that ! might be an issue in the password. Perry, Thanks for the info and you enjoy the weekend as well.
LJMangha
Posts: 14
Joined: Mon Jan 10, 2022 1:04 pm

Re: Nagios xi MSSQL Database monitoring

Post by LJMangha »

That was the issue sir, once I changed my service account password, removing the explanation mark ! from the end of the password, it is now monitoring the databases. Thank you for the help!
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi MSSQL Database monitoring

Post by pbroste »

Excellent, @LJMangha I am glad that you were able to figure out the solution.

I will go ahead and lock this,
Perry