check snmp with diferent community not work
Marc Powell
marc at ena.com
Thu Nov 5 22:03:07 CET 2009
On Nov 5, 2009, at 12:32 PM, Ricardo Delgado wrote:
> Hi all, when configure 2 o more UPS with the same community it's
> work's fine, but when i add UPS with other community, it's not work.
> any ideas?
> define service{
> use generic-service
> hostgroup_name ups
This service is applied to every host in the 'ups' hostgroup. All
hosts in this group use the same check_snmp command definition and
must share the same snmp community based on your definitions below
(comun1).
> service_description SYSTEM UP
> is_volatile 0
> check_period 24x7
> max_check_attempts 3
> normal_check_interval 5
> retry_check_interval 1
> contact_groups admins
> notification_interval 0
> notification_period 24x7
> notification_options c,r
> check_command check_snmp!.1.3.6.1.2.1.1.3.0
> }
> check_command check_snmp!.1.3.6.1.2.1.1.3.0
This service uses the check_snmp command definition.
> define command{
> command_name check_snmp
>
> command_line /usr/local/nagios/libexec/check_snmp -C
> comun1 -H $HOSTADDRESS$ -o $ARG1$
> }
Your check_snmp command definition above has a hard-coded community if
'comun1'. With this configuration, this is the only community that
will work with this command definition and hence, the only community
that will work for all hosts in the 'ups' hostgroup.
> define command{
> # command_name check_snmp
>
> command_line /usr/local/nagios/libexec/check_snmp -C
> comun1 -H $HOSTADDRESS$ -o $ARG1$
> }
This is a malformed command definition. It has no command_name. I'm
surprised that nagios starts with this configuration (does it really?)
> this is an example to add other host with a diferent community, and
> not work!!
> ##CONFIGURATION UPS3.CFG
>
>
> define host{
> use generic-host ; Name of host
>
> template to use
> host_name UPS3 EDIF
> address 10.14.12.187
> hostgroups ups
> notes_url http://10.14.12.187
>
> }
Where's the reference to the check_snmp command? The host doesn't
appear to have a check_command at all.
> #aqui especifico el comando por snmp
>
>
> define command{
> # command_name check_snmp
>
> command_line /usr/local/nagios/libexec/check_snmp -C
> publica -H $HOSTADDRESS$ -o $ARG1$
> }
Again, this is a malformed command definition. It has no command_name.
I'm surprised that nagios starts with this configuration (does it
really?)
You appear to be missing a few fundamental concepts. I recommend
reading the documentation but generally --
- host and service definitions reference command definition via the
check_command parameter. Nagios looks at the command_line for the
command definition with that command_name to determine what shell
command it should run.
- all command{} definitions must have unique command_names. I presume
you had problems with nagios complaining about duplicate command names
so you decided to comment out the command_names in those duplicate
definitions. If nagios actually starts like that, it renders them
unusable because you can't reference them.
- instead of creating unique command definitions for each snmp
community, you can pass it from the host definition just as you're
passing the $ARG1$ parameter from the service definition. This can
simplify your reuse of the same command definition for similar checks.
For example --
define command{
command_name check_snmp
command_line /usr/local/nagios/libexec/check_snmp -C
$_HOSTSNMP_COMMUNITY$ -H $HOSTADDRESS$ -o $ARG1$
}
define service{
use generic-service
hostgroup_name ups
service_description SYSTEM UP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 0
notification_period 24x7
notification_options c,r
check_command check_snmp!.1.3.6.1.2.1.1.3.0
}
define host{
use generic-host ; Name of host
template to use
host_name UPS EDIF
address 10.14.12.106
hostgroups ups
notes_url http://10.14.12.106
_SNMP_community comun1
}
define host{
use generic-host ; Name of host
template to use
host_name UPS2 EDIF
address 10.14.12.107
hostgroups ups
notes_url http://10.14.12.107
_SNMP_community publica
}
--
Marc
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list