Check_redis HGET command

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
Hvalls
Posts: 4
Joined: Thu Aug 28, 2014 9:53 am

Check_redis HGET command

Post by Hvalls »

Hello,

I'm wondering if anyone has tried the HGET command with check_redis plugin. It's the first time I use it, as well as redis DB and I'm having problems to get data from it, here is what I'm trying to do:

./check_redis.pl -H MY_IP -D 0 --query HGET:input,16:name,ABSENT:WARNING,WARN:4,CRIT:5,DISPLAY:YES,PERF:NO

And the result:
WARNING: name data is missing - REDIS 2.8.4 on 192.168.50.89:6379 has 1 databases (db0) with 40 keys, up 3 hours 5 minutes

Checking the help I'm seeing this order:
HGET:name,query_type,query_key_name[:data_name][,ABSENT:WARNING|CRITICAL][,WARN:threshold,CRIT:threshold]]

But no matter how I put it it just doesn't find any data. Here is the data I want to obtain and compare: (from Redis server)
127.0.0.1:6379> hget "input:16" name
"3"

So there is indeed data in that key, but I'm doing it wrong somehow and I can't find where.

Many thanks in advance!!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Check_redis HGET command

Post by slansing »

Looks like you need something similar to your manual query:

hget "input:16" name
HGET:name,query_type,query_key_name[:data_name]
Try:

Code: Select all

./check_redis.pl -H MY_IP -D 0 --query HGET:name,input,16:name,ABSENT:WARNING,WARN:4,CRIT:5,DISPLAY:YES,PERF:NO
The plugin may expect that data in a slightly different fashion, you can immediately see the difference when you look at your command as opposed to your help output. I don't know how your hget's are structured, but that looks like the right track.
Hvalls
Posts: 4
Joined: Thu Aug 28, 2014 9:53 am

Re: Check_redis HGET command

Post by Hvalls »

Hi!

First of all thanks for answering. The thing is that I already tried several ways to put it, and this particular one gives me this answer:

Can not parse. Unknown threshold specification: 16:name,ABSENT:WARNING,WARN:4,CRIT:5,DISPLAY:YES,PERF:NO Threshold line should be either both warning and critical thresholds separated by ',' or new format of: WARN:threshold,CRIT:threshold,ABSENT:OK|WARNING|CRITICAL|UNKNOWN which allows to specify all 3 (CRIT,WARN,ABSENT) or any one of them in any order.

The usage is as follows:

Usage: ./check_redis.pl [-v [debugfilename]] -H <host> [-p <port>] [-x password | -C credentials_file] [-D <database>] [-a <statistics variables> -w <variables warning thresholds> -c <variables critical thresholds>] [-A <performance output variables>] [-T [conntime_warn,conntime_crit]] [-R [hitrate_warn,hitrate_crit]] [-m [mem_utilization_warn,mem_utilization_crit] [-M <maxmemory>[B|K|M|G]]] [-r replication_delay_time_warn,replication_delay_time_crit] [-f] [-T <timeout>] [-V] [-P <previous performance data in quoted string>] [-q (GET|LLEN|HLEN|SLEN|ZLEN|HGET:name|HEXISTS:name|SEXISTS:name|LRANGE:(AVG|SUM|MIN|MAX):start:end|ZRANGE:(AVG|SUM|MIN|MAX):start:end),query_type,query_key_name[:data_name][,ABSENT:WARNING|CRITICAL][,WARN:threshold,CRIT:threshold]] [-o <threshold specification with name or pattern>]

So I need to identify:
HGET:name
query_type
query_key_name[:data_name]

I order to get it like you said:
./check_redis.pl -H <host> [-D <database>] [-q HGET:name,query_type,query_key_name[:data_name][,WARN:threshold,CRIT:threshold]]

But still it seems I'm unable to get it righ.

Thanks again!
Hvalls
Posts: 4
Joined: Thu Aug 28, 2014 9:53 am

Re: Check_redis HGET command

Post by Hvalls »

Hello,

First of all many thanks for your answer, but still no good results. I've tried several combinations and there is no way to get it working. I've tried as well to use a GET, because there is an example in the --help with it, and i'm not geting the right respone:

Command
./check_redis.pl -H MY_IP -D 0 -q GET,nodes:1,ABSENT:CRITICAL

In the example you can see: --query GET,MyKey:K1,ABSENT:CRITICAL
Respone:
CRITICAL: 1 data is missing - REDIS 2.8.4 on 192.168.50.89:6379 has 1 databases (db0) with 40 keys, up 21 hours 5 minutes

So I'm not sure if I'm doing something else wrong.

Many thanks!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Check_redis HGET command

Post by sreinhardt »

This last one is definitely communicating with the DB, I think the reason it gave you a warning was the 1 chunk missing, and that there was no warning\critical values it should use. It likely defaults to give a warning\critical if there are any errors in the result and no warning\critical thresholds have been set. I would suggest trying the same command but something like:

Code: Select all

./check_redis.pl -H MY_IP -D 0 -q GET,nodes:1,ABSENT:CRITICAL,WARN:5,CRIT,10
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.
Hvalls
Posts: 4
Joined: Thu Aug 28, 2014 9:53 am

Re: Check_redis HGET command

Post by Hvalls »

Hello!

Thanks for you answer, I've already tried it with tresholds, but the ABSENT is always there, so for some reason it is not sending the correct check:

[root@localhost libexec]# ./check_redis.pl -H MY_IP -D 0 -q GET,nodes:1,ABSENT:CRITICAL,WARN:5,CRIT:10
CRITICAL: 1 data is missing - REDIS 2.8.4 on 192.168.50.89:6379 has 1 databases (db0) with 40 keys, up 5 days 20 hours

Data is always missing although there is data in that nodes:1 KEY, or any other KEY I try no matter if it's a hash, a string, an integer etc.

Many thanks for your help though!
User avatar
Nagios Support
Posts: 36
Joined: Thu Sep 04, 2014 12:16 pm

Re: Check_redis HGET command

Post by Nagios Support »

We're going to have to do some digging on this issue and will get back to you within 24 hours.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Check_redis HGET command

Post by slansing »

Hello Hvalls,

We've looked at the code a bit and can't pin down why your returns are always coming in as critical. At this point, we're going to recommend you try to contact the developer of this plugin as it was not created, nor is it maintained, by us. We know the developer and he should be pretty good at responding to your questions, his information is located on the exchange listing here:

http://exchange.nagios.org/directory/Pl ... pl/details
Locked