[CentOS] specify port on check_memcached.pl

Sun May 24 14:36:24 UTC 2015
Tim Dunphy <bluethundr at gmail.com>

Hey guys,


I'm trying use check_memcached.pl to monitor a couple of memcached services
running on two ports.


I have my command definition setup like this:

# 'check_memcached' command definition

define command {

command_name check_memcached

command_line $USER1$/check_memcached.pl -H $HOSTADDRESS$ -p $ARG1$

}


And I have my service definitions setup like this:


# Define a service to check memcached on web1 (just the basics for right
now).


define service{

        use                             local-service         ; Name of
service template to use

        host_name                       web1

        service_description             Check Memcached 11211

        contact_groups                  linux-admins

        check_command                   check_memcached!web1.example.com
!11211

        notifications_enabled           1

        }


# Define a service to check memcached on web1 (just the basics for right
now).


define service{

        use                             local-service         ; Name of
service template to use

        host_name                       web1

        service_description             Check Memcached 11212

        contact_groups                  linux-admins

        check_command                   check_memcached!web1.example.com
!11212

        notifications_enabled           1

        }

And if I run both checks manually they succeed:

[root at monitor1:/usr/local/nagios/etc/objects/servers] #../../../libexec/
check_memcached.pl  -H web1.example.com -p 11211

MEMCACHE OK: memcached 1.4.22 on web1.example.com:11211, up 22 minutes 52
seconds

[root at monitor1:/usr/local/nagios/etc/objects/servers] #../../../libexec/
check_memcached.pl  -H web1.example.com -p 11212

MEMCACHE OK: memcached 1.4.22 on web1.example.com:11212, up 12 minutes 2
seconds

Yet, in my nagios web interface, I'm getting this error:


      Check Memcached 11211
<https://nagios.jokefire.com/nagios/cgi-bin/extinfo.cgi?type=2&host=web1&service=Check+Memcached+11211>


   CRITICAL

05-24-2015 14:28:31

0d 0h 10m 19s

4/4

CRITICAL ERROR - Can not connect to '162.243.60.6' on port 0


      Check Memcached 11212
<https://nagios.jokefire.com/nagios/cgi-bin/extinfo.cgi?type=2&host=web1&service=Check+Memcached+11212>


   CRITICAL

05-24-2015 14:29:12

0d 0h 11m 8s

4/4

CRITICAL ERROR - Can not connect to '162.243.60.6' on port 0


I thought I could specify the command in the service definition like this:

check_memcached!web1.example.com!11211

To reproduced the command as it's executed on the command line. How can I
specify the port correctly here?


Thanks,

Tim


-- 

GPG me!!


gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B