Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
As my journey continues, I want to check some apache stats on a different IP / port than the host. So I created a command for each webserver and things are working, but I want to keep things clean and want to understand how the variables are assigned. My example commands are;
Now I have 7 webservers, then some tomcat ones (which I bet will have more questions) but rather than 7 of these, I look higher up at some default ones and see a sample like command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
So I would like to do the same. The IP used will be the same (not the one in the define host) and the port changes (not the one in the _tcpport in the host definition), so my question is how/where can I define a variable so I can have one command, then when I define the service, I can say use_hostgroup webservers and have that port auto inserted vs 7 commands for each server.
Remember when we talked about doing this with NRPE... custom macros... *nudge* *nudge*
I'm going to assume that's a big enough hint to send you off in the right direction with your apache port conundrum so I'll move on to $argx$. Arguments are simply any text following the command separated by exclamation marks. So $ARG1$ is the first field after the command, $ARG2$ is the second... so on and so forth. This provides you with a way of dynamically building the arguments in your check commands.