Snmpでkeepalivedを監視しようとしています。構成の関連部分は次のとおりです。/etc/snmp/snmp.conf
# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
#mibs :
mibs +KEEPALIVED-MIB
/etc/snmp/snmpd.conf
master agentx
#agentXSocket udp:127.0.0.1:705
#agentAddress udp:127.0.0.1:161
rocommunity public 127.0.0.1
trapcommunity public
trap2sink 127.0.0.1
/etc/keepalived/keepalived.conf
global_defs {
notification_email {
enable_snmp_checker [email protected]
}
notification_email_from [email protected]
smtp_server localhost
smtp_connect_timeout 60
#snmp_socket udp:127.0.0.1:705
#enable_snmp_checker
#enable_snmp_rfcv3
#enable_snmp_rfcv2
#enable_snmp_vrrp
#enable_snmp_rfc
#enable_traps
}
...
...
ll/usr/share/snmp/mibs /
total 216
drwxr-xr-x 2 user user 4096 Sep 12 10:56 ./
drwxr-xr-x 5 root root 4096 Sep 12 10:55 ../
-rw-r--r-- 1 root root 143802 Sep 12 10:56 KEEPALIVED-MIB.txt
-rw-r--r-- 1 root root 26693 Sep 12 10:56 VRRP-MIB.txt
-rw-r--r-- 1 root root 34959 Sep 12 10:56 VRRPv3-MIB.txt
keepalivedは、-x
に/etc/default/keepalived
があり、しばらくの間動作して実行されています。しかし、snmpは機能しません。 acassen/keepalived のmibsファイルを使用しています。私が以下を実行すると:
# snmpwalk -v 2c -c public 127.0.0.1 KEEPALIVED-MIB
私は得る:
MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (Host-RESOURCES-MIB): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
Cannot find module (Host-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (MTA-MIB): At line 0 in (none)
Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
Cannot find module (UCD-DISKIO-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
Cannot find module (IPV6-MIB): At line 0 in (none)
Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 13 in /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
Cannot find module (INET-ADDRESS-MIB): At line 18 in /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
Cannot find module (IF-MIB): At line 20 in /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
Cannot find module (SNMPv2-TC): At line 22 in /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InetAddressType' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InetAddress' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InetPortNumber' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InetAddressPrefixLength' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InetScopeType' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'InterfaceIndex' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'ifIndex' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Did not find 'TruthValue' in module #-1 (/usr/share/snmp/mibs/KEEPALIVED-MIB.txt)
Unlinked OID in KEEPALIVED-MIB: debian ::= { enterprises 9586 }
Undefined identifier: enterprises near line 149 of /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
Cannot adopt OID in KEEPALIVED-MIB: vrrpRouteEntry ::= { vrrpRouteTable 1 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTrapControl ::= { vrrpTrap 1 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTraps ::= { vrrpTrap 0 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpSyncTrackedScriptEntry ::= { vrrpSyncTrackedScriptTable 1 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTrackedBfdWgtRev ::= { vrrpTrackedBfdEntry 4 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTrackedBfdWeight ::= { vrrpTrackedBfdEntry 3 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTrackedBfdName ::= { vrrpTrackedBfdEntry 2 }
Cannot adopt OID in KEEPALIVED-MIB: vrrpTrackedBfdIndex ::= { vrrpTrackedBfdEntry 1 }
...
...
KEEPALIVED-MIB: Unknown Object Identifier (Sub-id not found: (top) -> KEEPALIVED-MIB)
Keepalivedとsnmpdの異なる構成を試しましたが、残念ながらどれも機能しませんでした。これはUbuntuXenialを実行しているLinuxホストです:uname -a
Linux vgw01 4.20.0-custom #45 SMP Tue Dec 25 13:33:11 CET 2018 x86_64 x86_64 x86_64 GNU/Linux
snmpd -v
NET-SNMP version: 5.7.3
Web: http://www.net-snmp.org/
Email: [email protected]
Keepalived -v
Keepalived v2.0.12 (unknown)
Copyright(C) 2001-2019 Alexandre Cassen, <[email protected]>
Built with kernel headers for Linux 4.4.162
Running on Linux 4.20.0-custom #45 SMP Tue Dec 25 13:33:11 CET 2018
configure options: --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --enable-snmp --enable-sha1 --enable-snmp-rfcv2 --enable-snmp-rfcv3 --enable-dbus --enable-dbus-create-instance --enable-json --enable-bfd --enable-nftables build_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
Config options: LIBIPTC LIBIPSET_DYNAMIC NFTABLES LVS VRRP VRRP_AUTH JSON BFD OLD_CHKSUM_COMPAT FIB_ROUTING SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 DBUS DBUS_CREATE_INSTANCE
System options: PIPE2 SIGNALFD INOTIFY_INIT1 VSYSLOG EPOLL_CREATE1 IPV4_DEVCONF IPV6_ADVANCED_API LIBNL3 RTA_ENCAP RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS RTA_VIA FRA_OIFNAME IFA_FLAGS IP_MULTICAST_ALL LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA LIBIPTC LIBIPSET_PRE_V7 NET_LINUX_IF_H_COLLISION LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS VRRP_VMAC CN_PROC SOCK_NONBLOCK SOCK_CLOEXEC O_PATH GLOB_BRACE INET6_ADDR_GEN_MODE VRF SO_MARK SCHED_RT SCHED_RESET_ON_FORK
後でcheck_mkで監視します。どうすればそれを機能させることができるか分かりますか?
どうもありがとう。
Ubuntu Xenialのsnmpdにバグがあるようです。snmpd.conf
で指定してもagentxが起動しません。 /etc/default/snmpd
で指定する必要がありましたが、/etc/snmp/snmpd.conf
で完全に省略できるため、ファイルに1行しかありません。これが私にとっての作業構成です:
/etc/default/snmpd
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -p /run/snmpd.pid --master=agentx --agentXSocket=tcp:localhost:705'
/etc/snmp/snmpd.conf
rocommunity public monitoring.server
/etc/keepalived/keepalived.conf
global_defs {
notification_email {
enable_snmp_checker [email protected]
}
notification_email_from [email protected]
smtp_server localhost
smtp_connect_timeout 60
snmp_socket tcp:localhost:705
enable_snmp_checker
enable_snmp_rfcv3
enable_snmp_rfcv2
enable_snmp_vrrp
enable_snmp_rfc
#enable_traps
}
/etc/default/keepalived
DAEMON_ARGS="-D --snmp"`
あなたの提案をありがとうレニー