Bug 1131175 - SNMP trap notification has missing sysUptime field
Summary: SNMP trap notification has missing sysUptime field
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-notificiations
Version: 3.4
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: ---
: 3.5.0
Assignee: Mooli Tayer
QA Contact: Jiri Belka
URL:
Whiteboard: infra
Depends On:
Blocks: 1142418
TreeView+ depends on / blocked
 
Reported: 2014-08-18 15:33 UTC by Andreas Bleischwitz
Modified: 2016-02-10 19:30 UTC (History)
10 users (show)

Fixed In Version: ovirt-3.5.0_rc2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1142418 (view as bug list)
Environment:
Last Closed: 2014-10-17 12:44:34 UTC
oVirt Team: Infra
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 31916 0 master MERGED notifier: send sysUpTime in snmp notifications. Never
oVirt gerrit 32214 0 ovirt-engine-3.5 MERGED notifier: send sysUpTime in snmp notifications. Never
oVirt gerrit 33047 0 ovirt-engine-3.4 MERGED notifier: send sysUpTime in snmp notifications. Never

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.


Note You need to log in before you can comment on or make changes to this bug.