check_mysql_query thresholds

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
eprice-mhp
Posts: 3
Joined: Mon Aug 26, 2013 3:46 pm

check_mysql_query thresholds

Post by eprice-mhp »

I'm trying to set a correct critical threshold level for the check_mysql_query plugin. The table will show a 0 when good and 1 or higher when critical.

I can't find a working critical threshold value that will alarm. On my test system when I run the query I correctly get a "1". When I run the query using the plugin I get "1.000000".

This is what I have on the host without the critical threshold:

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -H localhost -u username -p password -d demo -q "query"
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mysql_query thresholds

Post by slansing »

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -H localhost -u username -p password -d demo -q "query"
Where and how are you defining your warning and critical thresholds in this command? Or for use with it "i.e arguments."
eprice-mhp
Posts: 3
Joined: Mon Aug 26, 2013 3:46 pm

Re: check_mysql_query thresholds

Post by eprice-mhp »

I tried these:

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -H localhost -u username -p password -d demo -q "query" -w 1:1 -c 1:1

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -H localhost -u username -p password -d demo -q "query" -c 1:9999

But these won't kick off the critical alarm. If I do "-c 2:9999", it will go critical; however the query most of the time will be 0 (good) or 1 (bad).
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_mysql_query thresholds

Post by sreinhardt »

Have you just tried using ~:0? Considering that 1 is bad and 0 is good, doing greater than 0 should match, if 1 go critical.

Code: Select all

/usr/lib64/nagios/plugins/check_mysql_query -H localhost -u username -p password -d demo -q "query" -c ~:0
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
eprice-mhp
Posts: 3
Joined: Mon Aug 26, 2013 3:46 pm

Re: check_mysql_query thresholds

Post by eprice-mhp »

That worked! Thanks so much!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mysql_query thresholds

Post by slansing »

Excellent!
Locked