GUI not giving output
-
RebeccaIlene
- Posts: 164
- Joined: Tue Apr 02, 2019 8:38 pm
GUI not giving output
Hi Team,
When I run the following SQL query from the Nagios server command line we get the correct output.
However, when running this on GUI it throws a WARNING - Use of uninitialized value $sql in sprintf at $USER$2/check_mssql_health line 6509.
What can be done to fix this?
Working:
[root@Hostname ~]#$USER$2/check_mssql_health -t 20 --server hostname --username=domain\\nagios_account --password=$password$ --mode=sql --name "`cat $USER$%/edt.sql`" --name2 'EDT job status' --warning 60 --critical 120
OK - edt job status: 11 | 'edt'=11;60;120;;
When I run the following SQL query from the Nagios server command line we get the correct output.
However, when running this on GUI it throws a WARNING - Use of uninitialized value $sql in sprintf at $USER$2/check_mssql_health line 6509.
What can be done to fix this?
Working:
[root@Hostname ~]#$USER$2/check_mssql_health -t 20 --server hostname --username=domain\\nagios_account --password=$password$ --mode=sql --name "`cat $USER$%/edt.sql`" --name2 'EDT job status' --warning 60 --critical 120
OK - edt job status: 11 | 'edt'=11;60;120;;
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: GUI not giving output
Hi Rebecca,
I believe the data is not getting parsed correctly when being passed over the PHP scripts, trying using single quotes instead of double quotes on the name argument. For example:
Let me know if that resolves the error.
Benjamin
I believe the data is not getting parsed correctly when being passed over the PHP scripts, trying using single quotes instead of double quotes on the name argument. For example:
Code: Select all
check_mssql_health -t 20 --server hostname --username=domain\\nagios_account --password=$password$ --mode=sql --name '`cat $USER$%/edt.sql`' --name2 'EDT job status' --warning 60 --critical 120
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
RebeccaIlene
- Posts: 164
- Joined: Tue Apr 02, 2019 8:38 pm
Re: GUI not giving output
Hi Benjamin,
Thanks for your reply.
I have updated the double quotes to single quotes but it didn't help.
The output still shows as "WARNING - Use of uninitialized value $sql in sprintf".
Thanks for your reply.
I have updated the double quotes to single quotes but it didn't help.
The output still shows as "WARNING - Use of uninitialized value $sql in sprintf".
Re: GUI not giving output
Hi Rebecca!
Can you take a screenshot of the config screen for this and post it?
Somewhere between what the config screenshot has, and what you're ending up with from quoting will be where we need to look.
--Jeffrey
Can you take a screenshot of the config screen for this and post it?
Somewhere between what the config screenshot has, and what you're ending up with from quoting will be where we need to look.
--Jeffrey
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
RebeccaIlene
- Posts: 164
- Joined: Tue Apr 02, 2019 8:38 pm
Re: GUI not giving output
Thanks! Please find attached screenshot.
You do not have the required permissions to view the files attached to this post.
Last edited by RebeccaIlene on Thu Aug 27, 2020 8:42 pm, edited 1 time in total.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: GUI not giving output
Hi Rebecca,
The command in the screenshot is a little different than the one posted earlier. It looks like you hardcoded the path for /usr/local/nagios/local/DB/SQL/EDT.sql, and I was going to suggest doing that, but that's still not working.
So, let's make sure the nagios user account can access this file. It's like the root user can but nagios cannot. What is the output of the following command:
The command in the screenshot is a little different than the one posted earlier. It looks like you hardcoded the path for /usr/local/nagios/local/DB/SQL/EDT.sql, and I was going to suggest doing that, but that's still not working.
So, let's make sure the nagios user account can access this file. It's like the root user can but nagios cannot. What is the output of the following command:
Code: Select all
ls -l /usr/local/nagios/local/DB/SQL/EDT.sql
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
RebeccaIlene
- Posts: 164
- Joined: Tue Apr 02, 2019 8:38 pm
Re: GUI not giving output
Thanks for checking this Benjamin.
Here is the output:
[root@hostname ~]# ls -l /usr/local/nagios/local/DB/SQL/EDT.sql
-rwxrwxrwx 1 root root 105 Jun 17 11:54 /usr/local/nagios/local/DB/SQL/EDT.sql
Here is the output:
[root@hostname ~]# ls -l /usr/local/nagios/local/DB/SQL/EDT.sql
-rwxrwxrwx 1 root root 105 Jun 17 11:54 /usr/local/nagios/local/DB/SQL/EDT.sql
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: GUI not giving output
Hi Rebecca
Thanks for posting the file permissions, that looks ok. After digging into this issue a little further, the CCM is more restrictive now as far as passing commands for improving security. It's likely stripping the backticks and not allowing you to run the command.
Can verify this by sending a simple test query into the check command instead. And if there are special characters in the SQL string, you may need to use the --encode option.
https://www.claudiokuenzler.com/blog/72 ... thresholds
Thanks for posting the file permissions, that looks ok. After digging into this issue a little further, the CCM is more restrictive now as far as passing commands for improving security. It's likely stripping the backticks and not allowing you to run the command.
Can verify this by sending a simple test query into the check command instead. And if there are special characters in the SQL string, you may need to use the --encode option.
Reference:sql
Result of a user-defined SQL statement, which returns a numerical value. The statement is passed to the plugin as an argument to the –sql parameter. A label for the performancedata can be defined with the –name2 parameter. A unit can be appended by using –units. If the SQL statement contains special characters, it is recommended to encode it first by calling check_mssql_health with the –encode parameter and sending the statement to STDIN
https://www.claudiokuenzler.com/blog/72 ... thresholds
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
RebeccaIlene
- Posts: 164
- Joined: Tue Apr 02, 2019 8:38 pm
Re: GUI not giving output
Hi Benjamin,
The other DB services work fine on this server. We also are running another custom query which gives the correct output.
By encode did you mean to change the mode to encode?
The other DB services work fine on this server. We also are running another custom query which gives the correct output.
By encode did you mean to change the mode to encode?
Re: GUI not giving output
Try changing these:
To this (surrounding them with single quotes):
Then test again.
Please PM me the SQL file you are running so I can take a look at it.
Code: Select all
--username=domain\\nagios_account --password=$password$ Code: Select all
--username='domain\nagios_account' --password='$password$' Please PM me the SQL file you are running so I can take a look at it.