No output on stdout) stderr: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
really lost on this one.. Any help would be great.
Error when setting up a MSSQL Query monitor
-
brettmlawrence
- Posts: 31
- Joined: Tue Oct 27, 2015 11:48 am
Re: Error when setting up a MSSQL Query monitor
Can you show us the full check command definition you are using for this service as well as the output of that command run from the CLI?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
brettmlawrence
- Posts: 31
- Joined: Tue Oct 27, 2015 11:48 am
Re: Error when setting up a MSSQL Query monitor
check_xi_mssql_query!--username SVC_Nagios --password "Password" --database DATABASE --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
Re: Error when setting up a MSSQL Query monitor
Could you test it over the CLI and post the full input/output? It would be ran like this -
Does the password contain any special characters?
One strange thing, is I'm unable to run it over the CLI using your query because of your username (the _). This might be a limitation for you. See below -
Code: Select all
/usr/local/nagios/libexec/check_mssql --username SVC_Nagios --password "Password" --database DATABASE --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
One strange thing, is I'm unable to run it over the CLI using your query because of your username (the _). This might be a limitation for you. See below -
Code: Select all
[root@localhost libexec]# ./check_mssql -H 127.0.0.1 --username "SVC_Nagios" --password "Password" --database DATABASE --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
UNKNOWN: Invalid characters in the username.
[root@localhost libexec]# ./check_mssql -H 127.0.0.1 --username "SVCNagios" --password "Password" --database DATABASE --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
CRITICAL: Could not connect to 127.0.0.1:1433 as SVCNagios.
Former Nagios Employee
-
brettmlawrence
- Posts: 31
- Joined: Tue Oct 27, 2015 11:48 am
Re: Error when setting up a MSSQL Query monitor
...$ /usr/local/nagios/libexec/check_xi_mssql_query! --username UPHS\SVC_Nagios --password "PW" --database HDMPMC_SHADOW --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
-bash: !": event not found
...$ ./check_mssql -H 170.166.22.135 --username SVC_Nagios --password "PW" --database HDMPMC_SHADOW --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
-bash: !": event not found
I received the same error when trying to run it using the command found on the configuration page as well as running it using the one you posted.
-bash: !": event not found
...$ ./check_mssql -H 170.166.22.135 --username SVC_Nagios --password "PW" --database HDMPMC_SHADOW --port 1433 --query "Select+Case+When+%28%09SELECT+COUNT%28%2A%29+%0D%0A%09%09%09%09%09FROM+HDMPMC_SHADOW.DBO.HDMA%29%0D%0A%09%09%09%09%09%3E+0+Then+%27Good%27+else+%27Bad%27%0D%0A%09%09%09%09%09end" --result "Good" --decode --result Good
-bash: !": event not found
I received the same error when trying to run it using the command found on the configuration page as well as running it using the one you posted.
Re: Error when setting up a MSSQL Query monitor
Judging by the error you received, I'm going to guess that there are symbols / special characters in your check. The way around this is to save your credentials to a variable, and then pass the variable as your password.
What you'll want to do, is use the resource.cfg file to save the password. See this link - https://assets.nagios.com/downloads/nag ... Macros.pdf
Then, when you run through the wizard (or even after), adjust the password field to be $USER#$ (where # is the macro # you use). This will tell XI to replace $USER9$ (for example) with 7&8!(|dasfs for example.
What you'll want to do, is use the resource.cfg file to save the password. See this link - https://assets.nagios.com/downloads/nag ... Macros.pdf
Then, when you run through the wizard (or even after), adjust the password field to be $USER#$ (where # is the macro # you use). This will tell XI to replace $USER9$ (for example) with 7&8!(|dasfs for example.
Former Nagios Employee
-
brettmlawrence
- Posts: 31
- Joined: Tue Oct 27, 2015 11:48 am
Re: Error when setting up a MSSQL Query monitor
Thank you! I am getting closer.. Am I able to pass Windows network accounts through this? I keep adding my domain \ User and the error is returning that it cannot connect.
-
brettmlawrence
- Posts: 31
- Joined: Tue Oct 27, 2015 11:48 am
Re: Error when setting up a MSSQL Query monitor
Thanks for all the help. I have this resolved! We can close this.
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Error when setting up a MSSQL Query monitor
Glad to hear it is resolved. I am going to lock the tread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!