Bug 1653591

Summary: The libvirtMib_subagent sends SNMP traps without sysUptime.0 [rhel-7.6.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: libvirt-snmpAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: jiyan <jiyan>
Severity: medium Docs Contact:
Priority: high    
Version: 7.5CC: dyuan, gveitmic, jdenemar, jherrman, jiyan, jsafrane, lmen, mmartinv, mprivozn, mtessun, xuzhang, yalzhang
Target Milestone: rcKeywords: Upstream, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-snmp-0.0.3-5.el7_6.2 Doc Type: Bug Fix
Doc Text:
Prior to this update, the variables sent in the SNMP trap by libvirt-snmp did not conform to the RFC 1905 protocol operations standard. This update fixes the problem.
Story Points: ---
Clone Of: 1624879 Environment:
Last Closed: 2019-01-29 17:22:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1624879    
Bug Blocks:    

Description Oneata Mircea Teodor 2018-11-27 08:09:59 UTC
This bug has been copied from bug #1624879 and has been proposed to be backported to 7.6 z-stream (EUS).

Comment 3 jiyan 2018-12-21 16:24:03 UTC
Verified this bug on "libvirt-snmp-0.0.3-5.el7_6.2.x86_64"

Version:
kernel-3.10.0-957.5.1.el7.x86_64
libvirt-snmp-0.0.3-5.el7_6.2.x86_64
libvirt-4.5.0-10.el7_6.3.x86_64
qemu-kvm-rhev-2.12.0-19.el7_6.2.x86_64

Configuration:
1. Install libvirt-snmp, libvirt-snmp-debuginfo, net-snmp net-snmp-libs, net-snmp-utils components
2. Modify "/etc/snmp/snmpd.conf" as following: 
   # cat /etc/snmp/snmpd.conf
   rwcommunity public
   master agentx
   trapcommunity public
   trap2sink localhost
3. Modify "/etc/snmp/snmptrapd.conf" as following: 
   # cat /etc/snmp/snmptrapd.conf 
   authCommunity log,execute,net public 
   logOption f /var/log/snmptraps.log
4. Modify "/etc/sysconfig/snmptrapd" as following: 
   # cat /etc/sysconfig/snmptrapd 
   OPTIONS="-m ALL -p /var/run/snmptrapd.pid"
5. Restart related service
   # systemctl restart snmpd
   # systemctl restart snmptrapd
   # systemctl restart libvirtd

Steps:
1. Run libvirt snmp agent daemon through the following cmd on "Terminal 1"
# LIBVIRT_DEFAULT_URI="qemu:///system" libvirtMib_subagent -f -L -D ALL

2. Start domain and run snmpwalk to query domain status on "Terminal 2"
# virsh start test1
Domain test1 started

# virsh domstate test1
running

# snmpwalk -m ALL -v 2c -c public -OX localhost libvirtMIB
LIBVIRT-MIB::libvirtGuestName[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = STRING: "test1"
LIBVIRT-MIB::libvirtGuestState[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = INTEGER: running(1)
LIBVIRT-MIB::libvirtGuestCpuCount[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = Gauge32: 2
LIBVIRT-MIB::libvirtGuestMemoryCurrent[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = Gauge32: 1024
LIBVIRT-MIB::libvirtGuestMemoryLimit[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = Gauge32: 1024
LIBVIRT-MIB::libvirtGuestCpuTime[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = Counter64: 1650000000
LIBVIRT-MIB::libvirtGuestRowStatus[STRING: 7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4] = INTEGER: active(1)

3. Open ths third terminal to check the log
# tail -f  /var/log/messages | grep --line-buffered "localhost [UDP: [127.0.0.1]"

4. Set the status of the domain through 'snmpset' cmd
# snmpset -m ALL -v 2c -c public localhost libvirtGuestState.\'7b06c299-88a6-4fde-ba8c-e3bc7d9fdae4\' = paused
LIBVIRT-MIB::libvirtGuestState.'{.....O.....}...' = INTEGER: paused(3)

Verify the status of domain through 'virsh' cmd:
# virsh domstate test1
paused

5. Check the log
# tail -f  /var/log/messages | grep --line-buffered "localhost [UDP: [127.0.0.1]"
Dec 21 11:20:17 ibm-x3250m6-05 snmptrapd[15673]: 2018-12-21 11:20:17 localhost [UDP: [127.0.0.1]:39369->[127.0.0.1]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (6658) 0:01:06.58#011SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.36957.0.1#011SNMPv2-SMI::enterprises.36957.1.1.1.2.0 = STRING: "test1"#011SNMPv2-SMI::enterprises.36957.1.1.1.1.0 = Hex-STRING: 7B 06 C2 99 88 A6 4F DE BA 8C E3 BC 7D 9F DA E4 #011SNMPv2-SMI::enterprises.36957.1.1.1.3.0 = INTEGER: 3#011SNMPv2-SMI::enterprises.36957.1.1.1.9.0 = INTEGER: 1
Dec 21 11:20:17 ibm-x3250m6-05 snmptrapd[15673]: 2018-12-21 11:20:17 localhost [UDP: [127.0.0.1]:39369->[127.0.0.1]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (6658) 0:01:06.58#011SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.36957.0.1#011SNMPv2-SMI::enterprises.36957.1.1.1.2.0 = STRING: "test1"#011SNMPv2-SMI::enterprises.36957.1.1.1.1.0 = Hex-STRING: 7B 06 C2 99 88 A6 4F DE BA 8C E3 BC 7D 9F DA E4 #011SNMPv2-SMI::enterprises.36957.1.1.1.3.0 = INTEGER: 3#011SNMPv2-SMI::enterprises.36957.1.1.1.9.0 = INTEGER: 1

The "sysUpTimeInstance" parameter exists in the log, which is expected.
Move this bug to be verified.

Comment 5 errata-xmlrpc 2019-01-29 17:22:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0174