mooli tayer has posted comments on this change.

Change subject: tools: support snmp trap as a notification method.
......................................................................


Patch Set 11:

(11 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
Done
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 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?
I assume the following to work due to:
http://gerrit.ovirt.org/#/c/22909/11/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
see line 256
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
Done
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?
each AuditLogType has an id.

See the feature page I added on this patch.
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 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?
Not sure about these two, I will check.
Line 87:             target.setTimeout(5000);
Line 88:             snmp.send(v2pdu, target);
Line 89:             final EventSenderResult eventSenderResult = new 
EventSenderResult();
Line 90:             eventSenderResult.setSent(true);


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?
I spent some time thinking about this.

In order to be 100% durable I would have to change 'processed' from a boolean 
on audit_log to a table containing for which EventNotificationMethod it is 
'processed'.
Even that is not enough because it could be that email a got it and b did not - 
so I have to keep address there too.

What I decided to keep the previous behavior: to mark it as processed if It was 
processed. If it was not sent it is lost but for logging and a 
event_notification_hist record. I could use those to resend but that table is 
cleaned according to a config value.

Best solution I think Is to create a new faild_notification_table.

What do you say?
Any way I will do It in a different branch.
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.
So what you suggest? 
comma separated list?
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
Done
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
Done
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=""
I was required to:
1.) Have whitelist on higher precedence then blacklist.
2.) By default send all events.

commenting out WHITELIST was the best solution I came up with.

What do you want done here?
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
But empty is a meaningful value: a '' blacklist means all events.
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

Reply via email to