我有两个主机的 nagios。一个是 localhost(10.10.62.5),另一个是 ubuntu(10.10.62.10)。我在本地主机上设置了 nagios 监视器。
主机配置文件如下
本地主机.cfg:
define host{
use linux-server
host_name localhost
alias localhost
address 10.10.62.5
}
define service{
host_name localhost
service_description WSN_COUNT
is_volatile 1
check_command check-host-alive
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
active_checks_enabled 0
passive_checks_enabled 1
check_period 24x7
notification_interval 31536000
notification_period 24x7
notification_options w,u,c
notifications_enabled 1
}
ubuntu.cfg:
define host{
use linux-server
host_name ubuntu
alias ubuntu
address 10.10.62.10
}
define service{
host_name localhost
service_description WSN_COUNT
is_volatile 1
check_command check-host-alive
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
active_checks_enabled 0
passive_checks_enabled 1
check_period 24x7
notification_interval 31536000
notification_period 24x7
notification_options w,u,c
notifications_enabled 1
}
MIB文件:
NAGIOS-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS enterprises FROM SNMPv2-SMI;
nagiostests OBJECT IDENTIFIER ::= { enterprises 0 }
nagiostraps OBJECT IDENTIFIER ::= { nagiostests 1 }
nagiosnotifs OBJECT IDENTIFIER ::= { nagiostests 2 }
WSNcount NOTIFICATION-TYPE
OBJECTS { sysLocation }
STATUS current
DESCRIPTION "SNMPv2c notification"
::= { nagiosnotifs 9 }
END
我使用 snmptt(net-snmp) 将陷阱与 nagios 集成。配置文件是
snmptt.conf.local:
EVENT WSNcount .1.3.6.1.4.1.0.2.1 "Status Events" Normal
FORMAT SNMPv2c notification $*
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result localhost WSN_COUNT 1 "SNMPv2c notification $*"
SDESC
SNMPv2c notification
Variables:
1: sysLocation
EDESC
snmptt.conf.local:
EVENT WSNcount .1.3.6.1.4.1.0.2.1 "Status Events" Normal
FORMAT SNMPv2c notification $*
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result ubuntu WSN_COUNT 1 "SNMPv2c notification $*"
SDESC
SNMPv2c notification
Variables:
1: sysLocation
EDESC
当我使用以下命令从 ubuntu(10.10.62.10) 机器发送陷阱时,陷阱发送到 nagios 中的两个主机。
snmptrap -v 2c -c private 10.10.62.5 "" NAGIOS-TRAP-TEST-MIB::RFIDcount SNMPv2-MIB::sysLocation.0 s "snmptest trap"
请帮助我将陷阱发送到特定主机..怎么可能...