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 ?
community strings and passwords
Re: community strings and passwords
Use the $USERn$ macros, specify a different macro for each hostgroup. You will still have to create separate checks for each hostgroup though.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: community strings and passwords
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>
}
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>
}
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: community strings and passwords
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: community strings and passwords
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 ...
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: community strings and passwords
Thanks for letting us know its working!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.