はじめに
本ドキュメントで紹介する内容は CVIM 4.2.0 および 4.2.1 に基づいています。その他のバージョンでは内容が異なる場合があります。
CVIM Monitor (CVIM-MON)を構成している Pod では Alert 通知を SNMP Trap を使って発行することが可能です。このドキュメントでは CVIM-MON の SNMP Trap 機能を有効にした Pod におけるSNMPテストトラップの発行方法をご紹介します。SNMP Trap を設定した後、その動作を確認する際に有効です。尚、CVIM-MON でSNMPトラップを有効にするための設定についてはドキュメント Cisco Virtualized Infrastructure Manager Documentation をご参照ください。
SNMP Trapの発行方法
1. Managementノードにログインして、/root/installer-xxxx/tools に移動します。
※ xxxx はご利用中のCVIMのバージョンによって異なります。
2. 移動後、python test_snmp_alerts.py を実行して SNMP Trap を発行します。スクリプトが正常に実行されると"All good!" から始めるメッセージが出力され、SNMP Manager にテストトラップが発行されます。
[root@jcvim-mgmt tools]# python test_snmp_alerts.py
All good! {'version': '4', 'groupKey': 'group1', 'status': 'firing', 'receiver': 'myreceiver', 'groupLabels': 'objGrpLabel1', 'commonLabels': 'objLabel1', 'commonAnnotations': 'objAnnotation1', 'externalURL': 'http://prometheus:111', 'alerts': [{'labels': {'snmp_podid': '1000', 'snmp_node': 'compute1', 'snmp_fault_source': 'nova-compute', 'snmp_fault_severity': 'alert', 'snmp_fault_code': 'serviceFailure'}, 'annotations': {'description': 'This is one alarm!', 'system_impact': 'Test, not functional impact', 'root_cause': 'Relax, this is just a test alarm', 'resolution': 'No resolution needed', 'alert_procedure': 'Nothing to do for this alert'}, 'startsAt': 'now', 'endsAt': 'no'}]}
[root@jcvim-mgmt tools]#
3. SNMP Manager側でテストアラームのSNMPトラップを受信しているかを確認します。以下の例では snmptrapd が稼働しているシステムの/var/log/messagesに記録されたメッセージの例です。発行されたテストトラップのdescriptionと同じ"This is one alarm!"が受信側でも確認することができます。
Apr 22 11:14:59 snmp-mgr-host snmptrapd[2017]: 2022-04-22 11:14:49 <UNKNOWN> [UDP: [10.70.72.130]:51834->[10.70.90.30]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (0) 0:00:00.00#011SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.9.9.855.0.1#011SNMPv2-SMI::enterprises.9.9.855.1.1 = STRING: "1000"#011SNMPv2-SMI::enterprises.9.9.855.1.2 = Hex-STRING: 07 E6 04 16 02 0E 31 04 2B 00 00 #011SNMPv2-SMI::enterprises.9.9.855.1.3 = STRING: "compute1"#011SNMPv2-SMI::enterprises.9.9.855.1.4 = STRING: "nova-compute"#011SNMPv2-SMI::enterprises.9.9.855.1.5 = INTEGER: 4#011SNMPv2-SMI::enterprises.9.9.855.1.6 = INTEGER: 4#011SNMPv2-SMI::enterprises.9.9.855.1.7 = STRING: "This is one alarm!"
SNMP Manager 側で受信が確認できない場合、Managementノードの setup_data.yaml の SNMP の設定やManagerノードとの間のネットワークの疎通を確認してください。