Alon Bar-Lev has posted comments on this change. Change subject: tools: support snmp trap as a notification method. ......................................................................
Patch Set 11: (14 comments) http://gerrit.ovirt.org/#/c/22909/11/backend/manager/tools/pom.xml File backend/manager/tools/pom.xml: Line 26: <snapshots> Line 27: <enabled>false</enabled> Line 28: </snapshots> Line 29: </repository> Line 30: </repositories> this should go to root pom.xml Line 31: Line 32: <dependencies> Line 33: Line 34: <dependency> http://gerrit.ovirt.org/#/c/22909/11/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java File backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java: Line 27: private static final Logger log = Logger.getLogger(SNMPEventSender.class); Line 28: Line 29: // This is ovirt engine's snmpTrapEnterprise. it is a snmpv2c variable that states Line 30: // The origin of the trap. stands for: Line 31: // 1[iso].3[organization].6[DoD].1[Internet].4[private].1[enterprises].2312[redhat].13[ovirt-engine].1[] repeating: please add notifier level, so we can add other components Line 32: private static final OID OVIRT_ENGINE_ENTERPRISE_TRAP_OID = new OID(new int[]{1, 3, 6, 1, 4, 1, 2312, 13, 1}); Line 33: Line 34: private NotificationProperties prop; Line 35: Line 57: try { Line 58: auditLogTypeVal = AuditLogType.valueOf(auditLogEvent.getLogTypeName()).getValue(); Line 59: } catch (IllegalArgumentException e) { Line 60: log.warn("Could not find event: " + auditLogEvent.getLogTypeName() + " in auditLogTypes"); Line 61: } validate before creating instance? Line 62: Line 63: OID trapOID = SnmpConstants.getTrapOID( Line 64: OVIRT_ENGINE_ENTERPRISE_TRAP_OID, Line 65: 6, Line 61: } Line 62: Line 63: OID trapOID = SnmpConstants.getTrapOID( Line 64: OVIRT_ENGINE_ENTERPRISE_TRAP_OID, Line 65: 6, repeat: please add constant for 6 - enterpriseSpecific Line 66: auditLogTypeVal Line 67: ); Line 68: v2pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, trapOID)); Line 69: v2pdu.add(new VariableBinding( Line 62: Line 63: OID trapOID = SnmpConstants.getTrapOID( Line 64: OVIRT_ENGINE_ENTERPRISE_TRAP_OID, Line 65: 6, Line 66: auditLogTypeVal can you please explain what this value will be? Line 67: ); Line 68: v2pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, trapOID)); Line 69: v2pdu.add(new VariableBinding( Line 70: new OID(trapOID).append(0), Line 79: new OID(trapOID).append(3), Line 80: new OctetString(auditLogEvent.getLogTime().toString()))); Line 81: CommunityTarget target = new CommunityTarget(); Line 82: final String[] split = AuditLogEventSubscriber.getMethodAddress().split(":"); Line 83: target.setAddress(new UdpAddress(split[0] + "/" + (split.length > 1 ? split[1] : 162))); AuditLogEventSubscriber.getMethodAddress().replace(":", "/") ? Line 84: target.setCommunity(new OctetString(prop.getProperty(NotificationProperties.SNMP_COMMUNITY))); Line 85: target.setVersion(SnmpConstants.version2c); Line 86: target.setRetries(2); Line 87: target.setTimeout(5000); Line 82: final String[] split = AuditLogEventSubscriber.getMethodAddress().split(":"); Line 83: target.setAddress(new UdpAddress(split[0] + "/" + (split.length > 1 ? split[1] : 162))); Line 84: target.setCommunity(new OctetString(prop.getProperty(NotificationProperties.SNMP_COMMUNITY))); Line 85: target.setVersion(SnmpConstants.version2c); Line 86: target.setRetries(2); what is the meaning of retry in udp? Line 87: target.setTimeout(5000); Line 88: snmp.send(v2pdu, target); Line 89: final EventSenderResult eventSenderResult = new EventSenderResult(); Line 90: eventSenderResult.setSent(true); Line 83: target.setAddress(new UdpAddress(split[0] + "/" + (split.length > 1 ? split[1] : 162))); Line 84: target.setCommunity(new OctetString(prop.getProperty(NotificationProperties.SNMP_COMMUNITY))); Line 85: target.setVersion(SnmpConstants.version2c); Line 86: target.setRetries(2); Line 87: target.setTimeout(5000); what is the meaning of timeout in this regard? Line 88: snmp.send(v2pdu, target); Line 89: final EventSenderResult eventSenderResult = new EventSenderResult(); Line 90: eventSenderResult.setSent(true); Line 91: return eventSenderResult; Line 86: target.setRetries(2); Line 87: target.setTimeout(5000); Line 88: snmp.send(v2pdu, target); Line 89: final EventSenderResult eventSenderResult = new EventSenderResult(); Line 90: eventSenderResult.setSent(true); and if sent by email and not by snmp or vise versa? Line 91: return eventSenderResult; Line 92: } catch (IOException e) { Line 93: throw new NotificationServiceException("Could not distribute snmp notification.", e); Line 94: } http://gerrit.ovirt.org/#/c/22909/11/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java File backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java: Line 77: Line 78: /** Line 79: * SMNP Trap parameters Line 80: */ Line 81: public static final String SNMP_MANAGER = "SNMP_MANAGER"; usually there should be more than one for backup. Line 82: Line 83: public static final String SNMP_PORT = "SNMP_PORT"; Line 84: Line 85: public static final String SNMP_COMMUNITY = "SNMP_COMMUNITY"; http://gerrit.ovirt.org/#/c/22909/11/ovirt-engine.spec.in File ovirt-engine.spec.in: Line 207: Requires: springframework-instrument Line 208: Requires: springframework-jdbc Line 209: Requires: springframework-tx Line 210: Requires: xmlrpc-client Line 211: Requires: snmp4j for the 10 time: please use tab Line 212: %endif Line 213: %endif Line 214: Line 215: # We can't require exactly the same version and release of the http://gerrit.ovirt.org/#/c/22909/11/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in File packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in: Line 108: # community string Line 109: SNMP_COMMUNITY=public Line 110: Line 111: # Line 112: OID=1.3.6.1.4.1.2312.13.1 please also provide textual representation Line 113: Line 114: # comma separated list of event names to notify on. Line 115: #WHITELIST="" Line 116: Line 111: # Line 112: OID=1.3.6.1.4.1.2312.13.1 Line 113: Line 114: # comma separated list of event names to notify on. Line 115: #WHITELIST="" please leave WHITELIST="" Line 116: Line 117: # notify on all but these comma separated list of events: Line 118: BLACKLIST="" Line 119: Line 116: Line 117: # notify on all but these comma separated list of events: Line 118: BLACKLIST="" Line 119: Line 120: # note: if both WHITELIST and BLACKLIST are defined only WHITELIST is considered. both should be defined, and you should check for empty Line 121: Line 122: #----------------------------------# Line 123: # Engine Monitoring Configuration: # Line 124: #----------------------------------# -- To view, visit http://gerrit.ovirt.org/22909 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0cd22d022ae535f45e046b09a2cbfadd837b465c Gerrit-PatchSet: 11 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: mooli tayer <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Liran Zelkha <[email protected]> Gerrit-Reviewer: Martin Peřina <[email protected]> Gerrit-Reviewer: mooli tayer <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
