mooli tayer has uploaded a new change for review.

Change subject: tools: new notification method: snmp_trap
......................................................................

tools: new notification method: snmp_trap

Change-Id: I1c8fe4ed65ca16551f3fca8ea63bab40cbca9b3c
Signed-off-by: Mooli Tayer <[email protected]>
---
M backend/manager/dependencies/pom.xml
A backend/manager/dependencies/src/main/modules/org/snmp4j/main/module.xml
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/SetFilter.java
M backend/manager/tools/pom.xml
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationMethodsMapper.java
A 
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
M 
backend/manager/tools/src/main/modules/org/ovirt/engine/core/tools/main/module.xml
R 
backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/sender/NotificationPropertiesTest.java
M ovirt-engine.spec.in
M packaging/dbscripts/upgrade/03_04_0390_event_notification_methods.sql
M packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
M pom.xml
14 files changed, 321 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/44/23244/1

diff --git a/backend/manager/dependencies/pom.xml 
b/backend/manager/dependencies/pom.xml
index 8e75809..7d04543 100644
--- a/backend/manager/dependencies/pom.xml
+++ b/backend/manager/dependencies/pom.xml
@@ -225,6 +225,12 @@
       <version>${aopalliance.version}</version>
     </dependency>
 
+    <dependency>
+        <groupId>org.snmp4j</groupId>
+        <artifactId>snmp4j</artifactId>
+        <version>${snmp4j.version}</version>
+    </dependency>
+
   </dependencies>
 
   <build>
@@ -441,6 +447,12 @@
                 <moduleName>org.aopalliance</moduleName>
               </module>
 
+              <module>
+                <groupId>org.snmp4j</groupId>
+                <artifactId>snmp4j</artifactId>
+                <moduleName>org.snmp4j</moduleName>
+              </module>
+
             </modules>
           </configuration>
         </plugin>
diff --git 
a/backend/manager/dependencies/src/main/modules/org/snmp4j/main/module.xml 
b/backend/manager/dependencies/src/main/modules/org/snmp4j/main/module.xml
new file mode 100644
index 0000000..e70d2d7
--- /dev/null
+++ b/backend/manager/dependencies/src/main/modules/org/snmp4j/main/module.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<module xmlns="urn:jboss:module:1.1" name="org.snmp4j">
+
+  <resources>
+    <resource-root path="snmp4j.jar"/>
+  </resources>
+
+  <dependencies>
+    <module name="org.slf4j"/>
+  </dependencies>
+
+</module>
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
index 49a9321..70254cd 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.common;
 
 public enum EventNotificationMethod {
-    EMAIL
+    EMAIL,
+    SNMP_TRAP
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/SetFilter.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/SetFilter.java
new file mode 100644
index 0000000..0e7587d
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/SetFilter.java
@@ -0,0 +1,31 @@
+package org.ovirt.engine.core.common.businessentities;
+
+import java.util.Set;
+
+public class SetFilter implements EventFilter {
+
+    private Set<String> values;
+
+    private boolean isWhiteList;
+
+    public void setValues(Set<String> values) {
+        this.values = values;
+    }
+
+    public void setWhiteList(boolean isWhiteList) {
+        this.isWhiteList = isWhiteList;
+    }
+
+    @Override
+    public boolean isSubscribed(AuditLogEvent event) {
+        if (isWhiteList){
+            return values.contains(event.getLogTypeName());
+        } else {
+            return !values.contains(event.getLogTypeName());
+        }
+    }
+
+    public boolean isConfigured(){
+        return values != null;
+    }
+}
diff --git a/backend/manager/tools/pom.xml b/backend/manager/tools/pom.xml
index 0f8fe63..44aba93 100644
--- a/backend/manager/tools/pom.xml
+++ b/backend/manager/tools/pom.xml
@@ -18,9 +18,26 @@
   <name>oVirt Engine Tools</name>
   <description>oVirt Engine Tools</description>
 
+  <repositories>
+      <repository>
+          <id>snmp4j</id>
+          <name>snmp4j</name>
+          <url>https://oosnmp.net/dist/release/</url>
+          <snapshots>
+              <enabled>false</enabled>
+          </snapshots>
+      </repository>
+  </repositories>
+
   <dependencies>
 
     <dependency>
+      <groupId>org.snmp4j</groupId>
+      <artifactId>snmp4j</artifactId>
+      <version>${snmp4j.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>${engine.groupId}</groupId>
       <artifactId>common</artifactId>
       <version>${engine.version}</version>
diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationMethodsMapper.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationMethodsMapper.java
index ca5bf8d..7bae15e 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationMethodsMapper.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/NotificationMethodsMapper.java
@@ -3,6 +3,7 @@
 import org.ovirt.engine.core.common.EventNotificationMethod;
 import org.ovirt.engine.core.notifier.sender.EventSender;
 import org.ovirt.engine.core.notifier.sender.mail.EventMailSender;
+import org.ovirt.engine.core.notifier.sender.snmp.SNMPEventSender;
 import org.ovirt.engine.core.notifier.utils.NotificationProperties;
 
 import java.util.HashMap;
@@ -14,6 +15,7 @@
 
     public NotificationMethodsMapper(NotificationProperties prop) {
         eventSenders.put(EventNotificationMethod.EMAIL, new 
EventMailSender(prop));
+        eventSenders.put(EventNotificationMethod.SNMP_TRAP, new 
SNMPEventSender(prop));
     }
 
     public EventSender getEventSender(EventNotificationMethod method) {
diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java
new file mode 100644
index 0000000..be4584c
--- /dev/null
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/sender/snmp/SNMPEventSender.java
@@ -0,0 +1,91 @@
+package org.ovirt.engine.core.notifier.sender.snmp;
+
+
+import org.apache.log4j.Logger;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.businessentities.AuditLogEvent;
+import org.ovirt.engine.core.common.businessentities.AuditLogEventSubscriber;
+import org.ovirt.engine.core.notifier.NotificationServiceException;
+import org.ovirt.engine.core.notifier.sender.EventSender;
+import org.ovirt.engine.core.notifier.sender.EventSenderResult;
+import org.ovirt.engine.core.notifier.utils.NotificationProperties;
+import org.snmp4j.CommunityTarget;
+import org.snmp4j.PDU;
+import org.snmp4j.Snmp;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.smi.Integer32;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.UdpAddress;
+import org.snmp4j.smi.VariableBinding;
+import org.snmp4j.transport.DefaultUdpTransportMapping;
+
+import java.io.IOException;
+
+public class SNMPEventSender implements EventSender {
+
+    private static final Logger log = Logger.getLogger(SNMPEventSender.class);
+
+    // This is ovirt engine's snmpTrapEnterprise. it is a snmpv2c variable 
that states
+    // The origin of the trap. stands for:
+    //  
1[iso].3[organization].6[DoD].1[Internet].4[private].1[enterprises].2312[redhat].13[ovirt-engine].1[]
+    private static final OID OVIRT_ENGINE_ENTERPRISE_TRAP_OID = new OID(new 
int[]{1, 3, 6, 1, 4, 1, 2312, 13, 1});
+
+    private NotificationProperties prop;
+
+    public SNMPEventSender(NotificationProperties prop) {
+        this.prop = prop;
+    }
+
+    @Override
+    public EventSenderResult send(AuditLogEvent auditLogEvent, 
AuditLogEventSubscriber AuditLogEventSubscriber) {
+
+        try {
+            // Create a new session and define it's transport.
+            Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
+            snmp.listen();
+
+            //PDU class is for SNMPv2c units
+            PDU v2pdu = new PDU();
+            v2pdu.setType(PDU.TRAP);
+            v2pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, 
SnmpConstants.getTrapOID(
+                    OVIRT_ENGINE_ENTERPRISE_TRAP_OID,
+                    6,
+                    0
+            )));
+            try {
+                v2pdu.add(new VariableBinding(
+                        new 
OID(prop.getProperty(NotificationProperties.SNMP_OID) + "1.0"),
+                        new 
Integer32(AuditLogType.valueOf(auditLogEvent.getLogTypeName()).getValue())));
+            } catch (IllegalArgumentException e) {
+                log.warn("Could not find event: " + 
auditLogEvent.getLogTypeName() + " in auditLogTypes");
+            }
+            v2pdu.add(new VariableBinding(
+                    new OID(prop.getProperty(NotificationProperties.SNMP_OID) 
+ "2.0"),
+                    new OctetString(auditLogEvent.getMessage())));
+            v2pdu.add(new VariableBinding(
+                    new OID(prop.getProperty(NotificationProperties.SNMP_OID) 
+ "3.0"),
+                    new OctetString(auditLogEvent.getSeverity().name())));
+            v2pdu.add(new VariableBinding(
+                    new OID(prop.getProperty(NotificationProperties.SNMP_OID) 
+ "4.0"),
+                    new OctetString(auditLogEvent.getType().name())));
+            v2pdu.add(new VariableBinding(
+                    new OID(prop.getProperty(NotificationProperties.SNMP_OID) 
+ "5.0"),
+                    new OctetString(auditLogEvent.getLogTime().toString())));
+            CommunityTarget target = new CommunityTarget();
+            final String[] split = 
AuditLogEventSubscriber.getMethodAddress().split(":");
+            target.setAddress(new UdpAddress(split[0] + "/" + (split.length > 
1 ? split[1] : 162)));
+            target.setCommunity(new 
OctetString(prop.getProperty(NotificationProperties.SNMP_COMMUNITY)));
+            target.setVersion(SnmpConstants.version2c);
+            target.setRetries(2);
+            target.setTimeout(5000);
+            snmp.send(v2pdu, target);
+            final EventSenderResult eventSenderResult = new 
EventSenderResult();
+            eventSenderResult.setSent(true);
+            return eventSenderResult;
+        } catch (IOException e) {
+            throw new NotificationServiceException("Could not distribute snmp 
notification.", e);
+        }
+
+    }
+}
diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
index 54fcb50..c504793 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/utils/NotificationProperties.java
@@ -1,10 +1,13 @@
 package org.ovirt.engine.core.notifier.utils;
 
 import java.net.InetAddress;
+import java.util.regex.Pattern;
 import javax.mail.internet.InternetAddress;
 
-import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.utils.LocalConfig;
+import org.snmp4j.smi.OID;
+
+import org.apache.commons.lang.StringUtils;
 
 /**
  * Defines properties uses by the event notification service
@@ -72,6 +75,23 @@
      */
     public static final String MAIL_SMTP_ENCRYPTION_TLS = "tls";
 
+    /**
+     * SMNP Trap parameters
+     */
+    public static final String SNMP_MANAGER = "SNMP_MANAGER";
+
+    public static final String SNMP_PORT = "SNMP_PORT";
+
+    public static final String SNMP_COMMUNITY = "SNMP_COMMUNITY";
+
+    public static final String SNMP_OID = "SNMP_OID";
+
+    public static final String WHITELIST = "WHITELIST";
+
+    public static final String BLACKLIST = "BLACKLIST";
+
+    private static final Pattern listPattern = 
Pattern.compile("^\\s*\\w*\\s*(,\\s*\\w*\\s*)*$");
+
     // Default files for defaults and overridden values:
     private static String DEFAULTS_PATH = 
"/usr/share/ovirt-engine/conf/notifier.conf.defaults";
     private static String VARS_PATH = 
"/etc/ovirt-engine/notifier/notifier.conf";
@@ -117,6 +137,7 @@
      * @throws IllegalArgumentException if some properties has invalid values
      */
     public void validate() {
+
         // validate mandatory and non empty properties
         for (String property : new String[]{
                 NotificationProperties.DAYS_TO_KEEP_HISTORY,
@@ -126,15 +147,20 @@
                 NotificationProperties.ENGINE_TIMEOUT_IN_SECONDS,
                 NotificationProperties.INTERVAL_IN_SECONDS,
                 NotificationProperties.IS_HTTPS_PROTOCOL,
-                NotificationProperties.MAIL_PORT,
-                NotificationProperties.MAIL_SERVER,
-                NotificationProperties.REPEAT_NON_RESPONSIVE_NOTIFICATION }) {
-            if (StringUtils.isEmpty(getProperty(property))) {
+                NotificationProperties.REPEAT_NON_RESPONSIVE_NOTIFICATION}) {
+            if (StringUtils.isEmpty(getProperty(property, true))) {
                 throw new IllegalArgumentException(
                         String.format(
                                 "Check configuration file, '%s' is missing",
                                 property));
             }
+        }
+        if 
(StringUtils.isEmpty(getProperty(NotificationProperties.MAIL_SERVER, true)) &&
+                
StringUtils.isEmpty(getProperty(NotificationProperties.SNMP_MANAGER, true))) {
+            throw new IllegalArgumentException(
+                    String.format(
+                            "Check configuration file, '%s' or %s must be 
defined.",
+                            NotificationProperties.MAIL_SERVER, 
NotificationProperties.SNMP_MANAGER));
         }
 
         // validate non negative args
@@ -164,37 +190,19 @@
                             NotificationProperties.MAIL_SMTP_ENCRYPTION_NONE,
                             NotificationProperties.MAIL_SMTP_ENCRYPTION_SSL,
                             NotificationProperties.MAIL_SMTP_ENCRYPTION_TLS
-                            ));
+                    ));
         }
 
         // try to resolve MAIL_SERVER host
-        try {
-            
InetAddress.getAllByName(getProperty(NotificationProperties.MAIL_SERVER));
-        } catch (Exception ex) {
-            throw new IllegalArgumentException(
-                    String.format(
-                            "Check configuration file, cannot verify '%s' 
value",
-                            NotificationProperties.MAIL_SERVER),
-                    ex);
-        }
+        validateHost(NotificationProperties.MAIL_SERVER, 
getProperty(NotificationProperties.MAIL_SERVER));
 
         // validate email addresses
-        for (String property : new String[] {
+        for (String property : new String[]{
                 NotificationProperties.MAIL_USER,
                 NotificationProperties.MAIL_FROM,
-                NotificationProperties.MAIL_REPLY_TO }) {
+                NotificationProperties.MAIL_REPLY_TO}) {
             String candidate = getProperty(property);
-            if (!StringUtils.isEmpty(candidate)) {
-                try {
-                    new InternetAddress(candidate);
-                } catch (Exception ex) {
-                    throw new IllegalArgumentException(
-                            String.format(
-                                    "Check configuration file, invalid format 
in '%s'",
-                                    property),
-                            ex);
-                }
-            }
+            validateEmail(property, candidate);
         }
 
         // validate mail user value
@@ -208,6 +216,73 @@
                             "'%s' must be set when SSL or TLS is enabled or 
when password is set",
                             NotificationProperties.MAIL_USER));
         }
+
+        // validate required SNMP parameters
+        if (!StringUtils.isEmpty(getProperty(SNMP_MANAGER, true))) {
+            for (String requiredProp : new String[]{SNMP_PORT, SNMP_OID, 
SNMP_COMMUNITY}) {
+                if (StringUtils.isEmpty(getProperty(requiredProp, true))) {
+                    throw new IllegalArgumentException(
+                            String.format(
+                                    "Check configuration file, '%s' is 
missing",
+                                    requiredProp));
+
+                }
+            }
+            boolean hasList = false;
+            for (String listProp : new String[]{WHITELIST, BLACKLIST}) {
+                if (getProperty(listProp, true) != null) {
+                    hasList = true;
+                    if (!listPattern.matcher(getProperty(listProp)).matches()) 
{
+                        throw new IllegalArgumentException(
+                                "Check configuration file, Illegal value for " 
+ listProp);
+
+                    }
+
+                }
+            }
+            if (!hasList) {
+                throw new IllegalArgumentException(
+                        "Check configuration file, " + WHITELIST + " or " + 
BLACKLIST + " must be defined.");
+            }
+        }
+
+        // validate required mail parameters ( port )
+        if (!StringUtils.isEmpty(getProperty(MAIL_SERVER, true)) &&
+                StringUtils.isEmpty(getProperty(MAIL_PORT, true))) {
+            throw new IllegalArgumentException("Check configuration file, '" + 
MAIL_PORT + "' is missing");
+        }
+
+        try {
+            new OID(getProperty(SNMP_OID));
+        } catch (Exception ex) {
+            throw new IllegalArgumentException("Check configuration file, 
illegal value for '" + SNMP_OID + "'");
+        }
+    }
+
+    private void validateHost(String propName, String propVal) {
+        try {
+            InetAddress.getAllByName(propVal);
+        } catch (Exception ex) {
+            throw new IllegalArgumentException(
+                    String.format(
+                            "Check configuration file, cannot verify '%s' 
value",
+                            propName),
+                    ex);
+        }
+    }
+
+    private void validateEmail(String propName, String propVal) {
+        if (!StringUtils.isEmpty(propVal)) {
+            try {
+                new InternetAddress(propVal);
+            } catch (Exception ex) {
+                throw new IllegalArgumentException(
+                        String.format(
+                                "Check configuration file, invalid format in 
'%s'",
+                                propName),
+                        ex);
+            }
+        }
     }
 
     /**
diff --git 
a/backend/manager/tools/src/main/modules/org/ovirt/engine/core/tools/main/module.xml
 
b/backend/manager/tools/src/main/modules/org/ovirt/engine/core/tools/main/module.xml
index cf051a4..fb500e4 100644
--- 
a/backend/manager/tools/src/main/modules/org/ovirt/engine/core/tools/main/module.xml
+++ 
b/backend/manager/tools/src/main/modules/org/ovirt/engine/core/tools/main/module.xml
@@ -19,6 +19,7 @@
     <module name="org.ovirt.engine.core.utils"/>
     <module name="org.postgresql"/>
     <module name="sun.jdk"/>
+    <module name="org.snmp4j"/>
   </dependencies>
 
 </module>
diff --git 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/utils/NotificationPropertiesTest.java
 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/sender/NotificationPropertiesTest.java
similarity index 85%
rename from 
backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/utils/NotificationPropertiesTest.java
rename to 
backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/sender/NotificationPropertiesTest.java
index b04ce7d..c4735cf 100644
--- 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/utils/NotificationPropertiesTest.java
+++ 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/notifier/sender/NotificationPropertiesTest.java
@@ -1,10 +1,11 @@
-package org.ovirt.engine.core.notifier.utils;
+package org.ovirt.engine.core.notifier.sender;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.ovirt.engine.core.notifier.utils.NotificationProperties;
 
 public class NotificationPropertiesTest {
 
diff --git a/ovirt-engine.spec.in b/ovirt-engine.spec.in
index 0156fb1..6ff45f2 100644
--- a/ovirt-engine.spec.in
+++ b/ovirt-engine.spec.in
@@ -208,6 +208,7 @@
 Requires:      springframework-jdbc
 Requires:      springframework-tx
 Requires:      xmlrpc-client
+Requires:   snmp4j
 %endif
 %endif
 
@@ -634,6 +635,7 @@
 org/apache/xmlrpc/main/xmlrpc-common.jar
 org/postgresql/main/postgresql.jar postgresql-jdbc.jar
 org/quartz/main/quartz.jar
+org/snmp4j/main/snmp4j.jar
 org/springframework/main/spring-aop.jar springframework/spring-aop.jar
 org/springframework/main/spring-asm.jar objectweb-asm/asm.jar
 org/springframework/main/spring-beans.jar springframework/spring-beans.jar
diff --git 
a/packaging/dbscripts/upgrade/03_04_0390_event_notification_methods.sql 
b/packaging/dbscripts/upgrade/03_04_0390_event_notification_methods.sql
index 21d3731..a3be597 100644
--- a/packaging/dbscripts/upgrade/03_04_0390_event_notification_methods.sql
+++ b/packaging/dbscripts/upgrade/03_04_0390_event_notification_methods.sql
@@ -3,7 +3,7 @@
 DROP TABLE event_notification_methods ;
 
 -- save EventNotificationMethod as enum.
-CREATE TYPE event_notification_method AS ENUM ('EMAIL');
+CREATE TYPE event_notification_method AS ENUM ('EMAIL', 'SNMP_TRAP');
 ALTER TABLE event_subscriber ADD COLUMN notification_method 
event_notification_method;
 ALTER TABLE event_subscriber DROP CONSTRAINT pk_event_subscriber;
 ALTER TABLE event_subscriber
@@ -13,3 +13,5 @@
 UPDATE event_subscriber SET notification_method = 'EMAIL';
 
 ALTER TABLE event_subscriber ALTER notification_method SET NOT NULL;
+
+ALTER TABLE event_notification_hist ALTER subscriber_id DROP NOT NULL;
diff --git 
a/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in 
b/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
index c835fcf..1f2d403 100644
--- a/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
+++ b/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
@@ -43,6 +43,24 @@
 # Interval (in seconds) between iterations of dispatching messages to 
subscribers. Default is 120 seconds.
 INTERVAL_IN_SECONDS=120
 
+# Amount of days to keep dispatched events on history table. If 0, events 
remain on history table for ever.
+DAYS_TO_KEEP_HISTORY=0
+
+# Send a notification email after first failure to fetch notifications,
+# and then once every failedQueriesNotificationThreshold times.
+# 0 or 1 means notify on each failure.
+FAILED_QUERIES_NOTIFICATION_THRESHOLD=30
+
+# Comma separated list of email recipients to be informed in case
+# the notification service cannot connect to the DB. can be empty.
+# Note: to get these to an snmp manager simply define one and make sure
+# DATABASE_UNREACHABLE is contained within it's WHITELIST
+FAILED_QUERIES_NOTIFICATION_RECIPIENTS=
+
+#---------------------#
+# EMAIL Notifications #
+#---------------------#
+
 # The SMTP mail server address. Required.
 MAIL_SERVER=
 
@@ -69,9 +87,6 @@
 # Specifies 'reply-to' address on sent mail in RFC822 format.
 MAIL_REPLY_TO=
 
-# Amount of days to keep dispatched events on history table. If 0, events 
remain on history table.
-DAYS_TO_KEEP_HISTORY=0
-
 # This parameter specifies how many days of old events are processed and sent
 # when the notifier starts. If set to 2, for example, the notifier will
 # process and send the events of the last two days, older events will just
@@ -79,14 +94,30 @@
 # messages will be sent at all during startup.
 DAYS_TO_SEND_ON_STARTUP=0
 
-# Send a notification email after first failure to fetch notifications,
-# and then once every failedQueriesNotificationThreshold times.
-# 0 or 1 means notify on each failure.
-FAILED_QUERIES_NOTIFICATION_THRESHOLD=30
+#-------------------------#
+# SNMP_TRAP Notifications #
+#-------------------------#
+# Send v2c snmp notifications
 
-# Comma separated list of email recipients to be informed in case
-# the notification service cannot connect to the DB. can be empty.
-FAILED_QUERIES_NOTIFICATION_RECIPIENTS=
+# IP address or DNS name of an SNMP manager to receive SNMP traps.
+SNMP_MANAGER=
+
+# The snmp manager's port
+SNMP_PORT=162
+
+# community string
+SNMP_COMMUNITY=public
+
+#
+OID=1.3.6.1.4.1.2312.13.1
+
+# comma separated list of event names to notify on.
+#WHITELIST=""
+
+# notify on all but these comma separated list of events:
+BLACKLIST=""
+
+# note: if both WHITELIST and BLACKLIST are defined only WHITELIST is 
considered.
 
 #----------------------------------#
 # Engine Monitoring Configuration: #
diff --git a/pom.xml b/pom.xml
index fef027b..e351366 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,7 +92,7 @@
     <tukaani-xz.version>1.0</tukaani-xz.version>
     <c3p0.version>0.9.1.1</c3p0.version>
     <aopalliance.version>1.0</aopalliance.version>
-
+    <snmp4j.version>2.2.2</snmp4j.version>
     <!-- OpenStack -->
     <openstack-client.version>3.0.2</openstack-client.version>
 


-- 
To view, visit http://gerrit.ovirt.org/23244
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c8fe4ed65ca16551f3fca8ea63bab40cbca9b3c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to