Recompiling plugins

Hi
Am new to nagios. i have gone thru it for sometime. now i want to modify a default plugin (check_http) just the listening port and make it work. what steps should i follow

Hi

The check_http plugin already allows you to alter your port, you just need to edit your commands.cfg and copy in a new version of check_http… define it as check_http2 or something, and either
a) alter the command_line by adding a "-p " to the end i.e if you were using port 1234 it’d be

define command{
command_name check_http2
command_line $USER1$/check_http -I $HOSTADDRESS$ -p 1234
}

then just replace check_http with check_http2 in your service definition.

b) or if you have multiple services on different ports and want a generic command you can pass the port number to, alter the command_line by adding a “-p $ARG1” to the end (or whatever your next unused $ARG is if it isn’t #1) i.e.

define command{
command_name check_http2
command_line $USER1$/check_http -I $HOSTADDRESS$ -p $ARG1$
}

then just replace check_http with check_http2!1234 in your service definition.

Of course, before making any changes whatsoever it’s always wise to take a copy of the file you will be editing incase it all goes wrong… . :slight_smile: Once you’ve made the changes, verify the configuration with the -v switch to ensure there are no errors, then restart your nagios process.

HTH

/S