Page 1 of 1

define custom service

Posted: Fri Aug 24, 2012 9:59 am
by xzer
Hello,

I am trying to actively monitor webserver behind the load balancer. The one is listening on default: 5666 and other on 15666 port. I am using nagiosXI. The monitoring on defaul port is running. Currently I am having difficulty to set up the one with port 15666.

via command line: /usr/local/nagios/libexec/check_nrpe -H your.domain.com -p 15666 -t 30 -c check_init_service -a http everything is working, but I am not able to add custom command to listen on 15666.

I have tried to edit the commands.cfg

define command {
command_name check_nrpe15666
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 15666 -t 30 -c $ARG1$ $ARG2$
}

after restart or service re-configuration the commands.cfg will be rewritten to last snapshot or loaded from DB and my custom command is not there anymore. I also modified nagios.cfg, but did not help.

Q1: Can I configure monitoring server to listen/comunicate with to both 5666 and 15666.
Q2: If not, how do I add custom service command?
Q3: What is the approach to monitor webservers behind the loadbalancer?

Thanks.

Re: define custom service

Posted: Fri Aug 24, 2012 10:25 am
by scottwilkerson
In XI you need to add the command through Configure -> CCM -> Commands because the commands file is overwritten every time the configuration is applied or a wizard is run.

Easiest would be to make your new command look something like this, and you could use the same command for all of these, specifying the port in $ARG3$

Code: Select all

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p $ARG3$ -t 30 -c $ARG1$ $ARG2$

Re: define custom service

Posted: Thu Sep 13, 2012 7:50 am
by xzer
Thanks. It works.