Page 1 of 1
Cannot Add service in CCM for mysql_query
Posted: Tue Jun 13, 2017 7:16 am
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
Re: Cannot Add service in CCM for mysql_query
Posted: Tue Jun 13, 2017 12:33 pm
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.
Re: Cannot Add service in CCM for mysql_query
Posted: Tue Jun 13, 2017 9:14 pm
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
Re: Cannot Add service in CCM for mysql_query
Posted: Wed Jun 14, 2017 10:53 am
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.
Re: Cannot Add service in CCM for mysql_query
Posted: Wed Jun 14, 2017 11:05 am
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.
Re: Cannot Add service in CCM for mysql_query
Posted: Thu Jun 15, 2017 2:30 am
by admingirl
Hi lmiltchev,
Thank you soo much for your help I appreciate it and it worked!
You guys are the best.
Ann
Re: Cannot Add service in CCM for mysql_query
Posted: Thu Jun 15, 2017 1:47 pm
by lmiltchev
I am glad I could help!
