Trying to create my own check_mysql_query
Posted: Fri Oct 24, 2014 4:21 am
Hi everyone!
Im trying to create my own check_mysql_query (check_mysql_query2) as I want to add some features to the output but first need it to work.
This is the bash script I've created:
#!/bin/bash
SESIONES=$(/usr/lib/nagios/plugins/check_mysql_query -q $1 -u $2 -p $3 -H $4 -d $5 -P $6 -c -w 1)
ESTADO=$?
METRICA=$(echo ${SESIONES} | awk '{print $3}')
echo "$SESIONES | Result=${METRICA}"
exit ${ESTADO}
And this is how I call the check which is failing:
[user@icinga ~]#/usr/lib/nagios/plugins/check_mysql_query2 "select func_monitoring('optins',0,0,0,0,0) from dual;" 'user' 'password' 'host' 'database' 'port'
QUERY CRITICAL: Error with query - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 | Result=Error
If I call default check_mysql_query it works:
[user@icinga ~]#/usr/lib/nagios/plugins/check_mysql_query -q "select func_monitoring('optins',0,0,0,0,0) from dual;" -u 'user' -p 'password' -H 'host' -d 'database' -P 'port' -c -w 1
QUERY OK: 'select func_monitoring('optins',0,0,0,0,0) from dual;' returned 0,000000
Could someone help with with this issue?? Thanks
Regards
Mario
Im trying to create my own check_mysql_query (check_mysql_query2) as I want to add some features to the output but first need it to work.
This is the bash script I've created:
#!/bin/bash
SESIONES=$(/usr/lib/nagios/plugins/check_mysql_query -q $1 -u $2 -p $3 -H $4 -d $5 -P $6 -c -w 1)
ESTADO=$?
METRICA=$(echo ${SESIONES} | awk '{print $3}')
echo "$SESIONES | Result=${METRICA}"
exit ${ESTADO}
And this is how I call the check which is failing:
[user@icinga ~]#/usr/lib/nagios/plugins/check_mysql_query2 "select func_monitoring('optins',0,0,0,0,0) from dual;" 'user' 'password' 'host' 'database' 'port'
QUERY CRITICAL: Error with query - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 | Result=Error
If I call default check_mysql_query it works:
[user@icinga ~]#/usr/lib/nagios/plugins/check_mysql_query -q "select func_monitoring('optins',0,0,0,0,0) from dual;" -u 'user' -p 'password' -H 'host' -d 'database' -P 'port' -c -w 1
QUERY OK: 'select func_monitoring('optins',0,0,0,0,0) from dual;' returned 0,000000
Could someone help with with this issue?? Thanks
Regards
Mario