Cannot Add service in CCM for mysql_query

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
admingirl
Posts: 17
Joined: Tue Jun 13, 2017 6:33 am

Cannot Add service in CCM for mysql_query

Post by admingirl »

Hi All,
Good day!
I've been cracking my head on how to add MySQL_query service. When I test in putty it's okay but when I add in CCM, I get error "You don't have permission to access /nagiosxi/includes/components/ccm/index.php on this server"

I can add other services in CCM with no problem only this MySQL_query. I'm really not good in Nagios.

I already have added the id that is showing when I check error in Modsecurity, restarted apache but still the same thing.
I appreciate your help.
Thanks and have a great day!
Ann
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot Add service in CCM for mysql_query

Post by lmiltchev »

Can you show us the actual command run from the command line along with the output of it? Also, show us how "MySQL_query" is configured in XI.
Be sure to check out our Knowledgebase for helpful articles and solutions!
admingirl
Posts: 17
Joined: Tue Jun 13, 2017 6:33 am

Re: Cannot Add service in CCM for mysql_query

Post by admingirl »

Hello,

Thanks for your response.

This is the command I used;
./check_mysql_query -u root -p nagiosxi -d information_schema -q "select variable_value from global_status where Variable_name='Threads_connected'" -w :140 -c :151

Output:
QUERY OK: 'select variable_value from global_status where Variable_name='Threads_connected'' returned 32.000000 | result=32.000000;140.000000;151.000000;

All of a sudden today, it was added in the UI with Unknown Error "Must specify a SQL query to run".

Please help. I cannot make it to work. Been trying for a month now. :(
Thanks and have a great day!
Ann
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Cannot Add service in CCM for mysql_query

Post by tmcdonald »

Can you show us a screenshot of how you have it entered into the CCM? I'm thinking there might be some escaping or possibly templating issues at play.
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot Add service in CCM for mysql_query

Post by lmiltchev »

Most probably it is a misconfiguration issue. Here's what I tested (which worked fine from the command like and in the GUI):

my command:

Code: Select all

define command {
       command_name                  		check_mysql_query
       command_line                  		$USER1$/check_mysql_query -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d $ARG3$ -q $ARG4$ $ARG5$
}
my service:

Code: Select all

define service {
	host_name			localhost
	service_description		MySQL Query
	use				local-service
	check_command			check_mysql_query!root!nagiosxi!information_schema!"select variable_value from global_status where Variable_name='Threads_connected'"!-w :140 -c :151!!!
	notifications_enabled		1
	contacts			nagiosadmin
	register			1
	}
Testing from the CLI:

Code: Select all

# ./check_mysql_query -u root -p nagiosxi -d information_schema -q "select variable_value from global_status where Variable_name='Threads_connected'" -w :140 -c :151
QUERY OK: 'select variable_value from global_status where Variable_name='Threads_connected'' returned 51.000000 | result=51.000000;140.000000;151.000000;
In the GUI:
example01.PNG
Hope this helps.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
admingirl
Posts: 17
Joined: Tue Jun 13, 2017 6:33 am

Re: Cannot Add service in CCM for mysql_query

Post by admingirl »

Hi lmiltchev,

Thank you soo much for your help I appreciate it and it worked!

You guys are the best.
Ann
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot Add service in CCM for mysql_query

Post by lmiltchev »

I am glad I could help! :)
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked