Bug 1131175

Summary: SNMP trap notification has missing sysUptime field
Product: [Retired] oVirt Reporter: Andreas Bleischwitz <a.bleischwitz>
Component: ovirt-engine-notificiationsAssignee: Mooli Tayer <mtayer>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: high Docs Contact:
Priority: high    
Version: 3.4CC: alonbl, bugs, ecohen, gklein, iheim, kcleveng, oourfali, rbalakri, rmcswain, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard: infra
Fixed In Version: ovirt-3.5.0_rc2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1142418 (view as bug list) Environment:
Last Closed: 2014-10-17 12:44:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1142418    

Description Andreas Bleischwitz 2014-08-18 15:33:30 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Andreas Bleischwitz 2014-08-18 15:58:13 UTC
Missing config for ovirt-notifier:

< .../notifier.conf.d/20-snmp.conf>
#-------------------------#
# SNMP_TRAP Notifications #
#-------------------------#
# Send v2c snmp notifications

# Minimum SNMP configuration
#
# Create /etc/ovirt-engine/notifier/notifier.conf.d/20-snmp.conf with:
# SNMP_MANAGERS="host"
FILTER="include:*(snmp:) ${FILTER}"

# Default whitespace separated IP/DNS list with optional port, default is 162.
# SNMP_MANAGERS="manager1.example.com manager2.example.com:164"
SNMP_MANAGERS="localhost"

# Default SNMP Community String.
SNMP_COMMUNITY=public

# Default TRAP Object Identifier for alerts.
#
# iso.organization.DoD.Internet.private.enterprises.redhat.ovirt-engine.notifications.audit-log
# 1.3.6.1.4.1.2312.13.1.1
SNMP_OID=.1.3.6.1.4.1.2312.13.1.1

#
# SNMP profile support
#
# Multiple SNMP profiles are supported.
# Specify profile settings by using _profile suffix,
# for example, to define a profile to sent specific
# message to host3, specify:
# SNMP_MANAGERS_profile1=host3
# FILTER="include:VDC_START(snmp:profile1) ${FILTER}"
#
</ .../notifier.conf.d/20-snmp.conf>

Local snmptrapd gets the traps, but the trap has missing sysUptime field.

Other tools - like HP-Openview - get confused by this missing field and report wrong variables for this trap.

According to http://www.snmp4j.org/doc/org/snmp4j/package-summary.html / SNMPv2c/SNMPv3 INFORM PDU sysUptime needs to be filled before sending the trap.

Recent version of Snmp.java (http://gerrit.ovirt.org/gitweb?p=ovirt-engine.git;a=blob;f=backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java;h=f7cf51a659393808abf0bf8372900461df0d8690;hb=HEAD) does not include sysUptime in PDU.

Comment 2 Mooli Tayer 2014-08-25 11:00:27 UTC
Alon Should we supply this?

We can add at Snmp.java:
v2pdu.add(new VariableBinding(SnmpConstants.sysUpTime, value));

Since AFAIK notifier always runs on the engine's machine it should return
the machines uptime? 

Should I read /proc/uptime?

Comment 3 Alon Bar-Lev 2014-08-25 11:07:21 UTC
yes, interesting that this is not injected automatically.

I think that it will be sufficient if startTime is the System.nanoTime() of the time in which service was started.

pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks((System.nanoTime() - startTime) / 10000)));

Comment 6 Jiri Belka 2014-09-16 13:38:07 UTC
ok, ovirt-engine-tools-3.5.0-0.0.master.20140911085455.gite1c5ffd.el6.noarch

# tcpdump -i eth0 -nn -ttt -v port 162                                                                                                                     
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
00:00:00.000000 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 304)
    10.34.60.239.49121 > 10.34.63.204.162:  { SNMPv2c { V2Trap(257) R=379723242  .1.3.6.1.6.3.1.1.4.1.0=.1.3.6.1.4.1.2312.13.1.1.0.31 .1.3.6.1.2.1.1.3.0=48844 .1.3.6.1.4.1.2312.13.1.1.0.31.0="User admin logged out." .1.3.6.1.4.1.2312.13.1.1.0.31.1="NORMAL" .1.3.6.1.4.1.2312.13.1.1.0.31.2="alertMessage" .1.3.6.1.4.1.2312.13.1.1.0.31.3="2014-09-16 14:55:37.517" .1.3.6.1.4.1.2312.13.1.1.0.31.4="USER_VDC_LOGOUT" .1.3.6.1.4.1.2312.13.1.1.0.31.5="admin" } }

Comment 7 Sandro Bonazzola 2014-10-17 12:44:34 UTC
oVirt 3.5 has been released and should include the fix for this issue.