Re: Question regarding haproxy nagios setup

From: Amol <mandm_zoom#yahoo.com>
Date: Tue, 3 May 2011 08:35:53 -0700 (PDT)


hi Timh,
Thanks for the update, yes i tried setting that up and now the initial part of my check_haproxy.pl file looks like this

#!/usr/bin/perl -w
# nagios: -epn
#
# Copyright (c) 2010 Stéphane Urbanovski <stephane.urbanovski#ac-nancy-metz.fr>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# you should have received a copy of the GNU General Public License
# along with this program (or with Nagios);  if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA
#
# $Id: $

use strict;                                     # should never be differently :-)
use warnings;
use lib '/usr/lib/nagios/plugins';

use Locale::gettext;

use File::Basename;                     # get basename()

use POSIX qw(setlocale);

use Time::HiRes qw(time);                       # get microtime
use POSIX qw(mktime);
...............

and status information still comes back as (null)

Service State Information
Current Status:    CRITICAL   (for 0d 18h 44m 22s) Status Information:    (null)

From: Timh B <timh#shiwebs.net>
Subject: Re: Question regarding haproxy nagios setup To: "Amol" <mandm_zoom#yahoo.com>
Cc: haproxy#formilux.org
Date: Tuesday, May 3, 2011, 4:23 AM

On Tue, May 3, 2011 00:23, Amol wrote:
> I was using the nagios plugin for haproxy
> http://cvs.orion.education.fr/viewvc/viewvc.cgi/nagios-plugins-perl/trunk/plugins/check_haproxy.pl?revision=135&view=markup
>
> my nagios installation version is Nagios Core 3.2.0
>
> in my host config i have declared the service as
>
> define service {
>          use                default-service
>          host_name                 server1
>          service_description       HAProxy
>          check_command           
>  check_haproxy!http://url/admin?stats;csv'!user!pass
>       servicegroups                 linux
>        }
>
>
> and my checkcommand.cfg is
>
> # command 'check_haproxy health'
> define command {
> command_name             check_haproxy
> command_line             perl /etc/nagios3/libexec/check_haproxy.pl -u
> $ARG1$ -U $ARG2$ -P $ARG3$
> }
>
>
> i have copied the check_haproxy.pl from my download folder to the path
> mentioned in the checkcommand
>
> on my nagios admin console i see
>
> Current Status:      CRITICAL  (for 0d 1h 4m 44s)
> Status Information:    (null)
> Performance Data:    
>
> and an alert is sent to my email even though the load balancing is working
> fine,
>
> i am able to run the command from the command line
>
> perl /etc/nagios3/libexec/check_haproxy.pl -u 'http://url/ain?stats;csv'
> -U user -P pass
>
> HAPROXY OK -  din_https (Active: 2/2) wbclus (Active: 2/2) |
> t=0.135153s;2;10;0; sess_din_https=0sessions;;;0;2000
> sess_wbclus=0sessions;;;0;2000
>
>
> please let me know if i am missing something
>
>
>

Check your haproxy.pl script, add

# nagios: -epn

right after the /usr/bin/perl-line, it tells nagios not to run it's own perl-parser/interpreter.

-- 
//Timh
Received on 2011/05/03 17:35

This archive was generated by hypermail 2.2.0 : 2011/05/03 17:45 CEST