<div class="gmail_quote"><div>It looks like you are using variables in the wrong location. Those should go in the command definition. See below for a sample, and hopefully you can adapt it to your specific needs.</div><div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm running into confusion, because I need to specify a<br>
port number in the host definition, and I can't really see how to do it.<br></blockquote><div><br></div><div>I'm going to assume that "check-snmp-switch-alive" is a script that you have written and that the command from the command-line is:</div>
<div><br></div><div>/usr/local/nagios/libexec/check-snmp-switch-alive <hostname> -p <portnumber></div><div><br></div><div>in the host/service definitions, the check_command separates arguments with the exclamation symbol "!" like this:</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">define host {<br>
name snmp-switch ; The name of this host template<br>
use generic-switch<br>
#check_command check-host-alive ; Default command to check if routers<br>
are "alive"<br>
check_command check-snmp-switch-alive!<port>!<arg2><br>
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE<br>
}<br></blockquote><div><br></div><div>where <port> would be the port number and <arg2> could be any string of other options, including "-[a-z]" switches and their arguments. You then define the command like this:</div>
<div><br></div><div>define command {</div><div> command_name check-snmp-switch-alive</div><div> command_line /usr/local/nagios/libexec/check-snmp-switch-alive $HOSTNAME$ -p $ARG1$ $ARG2$</div><div>}</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is this a possible / sane thing to do? Is this the right way to approach<br>
it, or am I missing a way that actually makes sense?<br></blockquote><div><br></div><div>Yes, I would say that this is appropriate for a switch/router. Personally, I usually don't overwrite the default host check_command since check_ping is fine, and instead add additional services as needed, such as SNMP checks to get more info.</div>
<div> </div><div>Good luck!</div><div>--</div><div>Jonathan</div></div>