ESXi vCenterのsnmpやsyslogなどの管理設定まとめ
vCenterでsnmpdを起動し、snmpgetなどに応答する状態にすることはできません。公式ドキュメント「vCenter Server での SNMP トラップの使用 」で、「vCenter Server の SNMP エージェントはトラップ エミッタとしてのみ機能し、GET、GETBULK、および GETNEXT 要求の受信などその他の SNMP 操作はサポートされていません。」と明記されています。
snmptrapd vicfg-snmp --targets=192.168.1.50@162/public,192.168.1.51@162/public vicfg-snmp --enable root@vcenter01 [ ~ ]# vicfg-snmp --help Usage: vicfg-snmp [options] Options: -h, --help show this help message and exit -c COMMUNITIES, --communities=COMMUNITIES Specifies communities, separated by commas. The settings specified using this option overwrite any previous settings. The settings specified using this flag overwrite any previous settings. -D, --disable Stops the SNMP service on the host. -e, --enable Starts the SNMP service on the host. -p PORT, --port=PORT Sets the port used by the SNMP agent. The default is UDP 161. This is the port that the SNMP service uses to listen on for polling requests, such as GET requests. You can also configure the port that the SNMP agent sends data to on the target system using the --targets option. That port is UDP 162 by default root@vcenter01 [ ~ ]# vicfg-snmp --show Current SNMP agent setting Enabled : true UDP port : 161 V1/V2c Communities : V2c Notification targets : 192.168.1.50@162 public 192.168.1.51@162 public Notification filter oids: V3 Notification targets : V3 Users : Contact : Location : Engine ID : 80001f888063451440672a886000000000 Auth Protocol : usmNoAuthProtocol Priv Protocol : usmNoPrivProtocol Log level : warning Process ID : 5825 Large Storage Support : False Simple Application Names: True INFO: listing complete. root@vcenter01 [ ~ ]# vicfg-snmp --test message : A warmStart notification was sent to 2 targets. success : True root@vcenter01 [ ~ ]# [root@centos50 ~]# tail /var/log/messages Apr 27 23:57:23 vcenter01 applmgmt-audit 2021-04-27T14:57:23.908: INFO Authorization request by user: root for service_id: com.vmware.appliance.logging.forwarding, operation_id: set Apr 27 23:57:23 vcenter01 applmgmt 2021-04-27T14:57:23.908 [2145]DEBUG:vmware.vherd.base.authorization_local:Verify privileges user (root) privilege ['ModifyConfiguration'] Apr 27 23:57:23 vcenter01 applmgmt-audit 2021-04-27T14:57:23.908: INFO AuthorizationResponse = < authorized=True, method=LOCAL >Apr 27 23:57:23 vcenter01 applmgmt 2021-04-27T14:57:23.908 [2145]DEBUG:root:Validated user privileges in localstore or SSO Apr 27 23:57:23 vcenter01 applmgmt-audit 2021-04-27T14:57:23.908: INFO Authorization Result: User=root, priv=ModifyConfiguration, authorized=True Apr 27 23:57:23 vcenter01 applmgmt 2021-04-27T14:57:23.908 [2145]DEBUG:vmware.appliance.update.update_state:In State._get using state file /etc/applmgmt/appliance/software_update_state.conf Apr 28 00:11:29 centos50 kernel: device ens192 entered promiscuous mode Apr 28 00:19:50 centos50 snmptrapd[12411]: 2021-04-28 00:19:50 vcenter01.gokatei.go.168.192.in-addr.arpa [UDP: [192.168.1.191]:49388->[192.168.1.50]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (34) 0:00:00.34#011SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart#011SNMPv2-MIB::snmpTrapEnterprise.0 = OID: SNMPv2-SMI::enterprises.6876.4.6876 Apr 28 00:20:02 centos50 snmptrapd[12411]: 2021-04-28 00:20:02 vcenter01.gokatei.go.168.192.in-addr.arpa [UDP: [192.168.1.191]:49388->[192.168.1.50]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1212) 0:00:12.12#011SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::warmStart#011SNMPv2-MIB::snmpTrapEnterprise.0 = OID: SNMPv2-SMI::enterprises.6876.4.6876 Apr 28 00:20:13 centos50 kernel: device ens192 left promiscuous mode