Passing argument values from Nagios server to client plugin


#1

Hi there,

I have developed a custom nagios plugin that monitors log sequence lag between primary and standby databases. Deployed the plugin at

/usr/local/nagios/libexec on remote server and verified execution correctly with below command:

/usr/local/nagios/libexec/xx_check_stby_lag -s <PRIMARY_DB_CONN_STRING_VALUE> -d <STANDBY_DB_CONN_STRING_VALUE> -w 10

The plugin correctly connects to primary database, gets the latest log sequence number and connects to its standby database, gets the latest log sequence

number applied and compares for difference. If difference greater warning threshold 10, gives warning alert.

Configured this plugin in nrpe.cfg on remote host as:
command[xx_check_stby_lag]=xx_check_stby_lag -s <PRIMARY_DB_CONN_STRING> -d <STANDBY_DB_CONN_STRING> -w 10

Configured in commands.cfg and localhost.cfg as below on the Nagios Server:

define command{
command_name xx_check_stby_lag
command_line $USER1$/xx_check_stby_lag -s $ARG1$ -d $ARG2$ -w $ARG3$
}

define service{
use local-service ; Name of service template to use
host_name <host_name>
service_description Verifies the lag between primary and standby database
check_command check_nrpe!xx_check_stby_lag!<PRIM_DB_CONN_STRING_VALUE>!<STANDBY_DB_CONN_STRING_VALUE>!2 -t 30
flap_detection_enabled 0
notifications_enabled 1
}

Bounced nagios server.

I am getting correct status in Nagios admin site for this plugin with above configuration. However I want to pass argument values to plugin from Nagios

server, I dont want to have hard coded values in nrpe.cfg for the command…instead I want to have generic like below.

command[xx_check_stby_lag]=/usr/local/nagios/libexec/xx_check_stby_lag -s $ARG1$ -d $ARG2$ -w $ARG3$

In Nagios site, am getting unknown status if I try with arguments. Can any one help on this.

Already nrpe is configured with below command for arguments enabling:

cd nrpe-2.12
./configure --enable-command-args

Update /usr/local/nagios/etc/nrpe.cfg with
dont_blame_nrpe=1

Thanks
Vineela