Page 1 of 1

community strings and passwords

Posted: Mon Feb 11, 2013 10:25 am
by MPIvan
Hi
i would like to find some solution about having a different passwords or community strings for a given service that i would like to used in host group. Example: I have multiple host that i like to monitor uptime (for example) but they all have different passwords or community strings and i like to make a group of them, that all that group (host group) have the same UpTime service, and there's the problem, they all have different passwords or community string so how to solve this?

any solution ?

Re: community strings and passwords

Posted: Mon Feb 11, 2013 12:50 pm
by abrist
Use the $USERn$ macros, specify a different macro for each hostgroup. You will still have to create separate checks for each hostgroup though.

Re: community strings and passwords

Posted: Tue Feb 26, 2013 1:48 pm
by wezelboy
You can also use custom data fields- for example:

define host{
host_name foo
alias A host called foo
address foo.bar.baz
_community woopwoop
}

And your snmp command might have this:

define command{
command_name check_snmp_example
command_line /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C $_HOSTCOMMUNITY$ <rest of command>
}

Re: community strings and passwords

Posted: Tue Feb 26, 2013 2:28 pm
by sreinhardt
I would also suggest wezelboy's usage. This way you can apply the same command to multiple hosts\ a host group and have different community strings defined by the individual hosts. The $USERX$ args as abrist suggests would work but would require multiple commands, and taking up many of the $USER$ args.

Re: community strings and passwords

Posted: Wed Feb 27, 2013 6:52 am
by MPIvan
Yup, wezelboy is right i already do that and it work ok ... in host you specify _SNMPCOMMUNITY <community_name> and in the command.cgf file in the specify command you add the -C $_HOSTSNMPCOMMUNITY$ and it works ... tnx again to all of you ...

Re: community strings and passwords

Posted: Wed Feb 27, 2013 11:42 am
by sreinhardt
Thanks for letting us know its working!