mooli tayer has uploaded a new change for review.

Change subject: notifier: add support for snmpv6 in SNMP_MANAGERS.
......................................................................

notifier: add support for snmpv6 in SNMP_MANAGERS.

Change-Id: I9a21038928b7e553feefb9ab7669eac588c1c93c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1073498
Signed-off-by: Mooli Tayer <mta...@redhat.com>
---
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
M packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
2 files changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/33441/1

diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
index ec62f97..ecb029e 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
@@ -202,8 +202,12 @@
     }
 
     private static class Profile {
-        private static final Pattern HOST_PATTERN = 
Pattern.compile("(?<host>[^:\\s]+)(:(?<port>[^\\s]*))?");
 
+        private static final Pattern HOST_PATTERN = Pattern.compile(
+            "" +
+                "((?<host>[^\\[:\\s]+)|(?<ipv6>\\[[^\\]]+\\]))" + // 
DNS/IPv4/[IPv6])
+                "(:(?<port>[^\\s]*))?" // Port (optional)
+        );
         public List<Host> hosts = new LinkedList<>();
         public OctetString community;
         public OID oid;
@@ -211,7 +215,9 @@
         public Profile(String managers, String community, String oid) {
             Matcher m = HOST_PATTERN.matcher(managers);
             while (m.find()) {
-                hosts.add(new Host(m.group("host"), m.group("port")));
+                hosts.add(new Host(
+                    m.group("host") != null ? m.group("host") : 
m.group("ipv6"),
+                    m.group("port")));
             }
             this.community = new OctetString(community);
             this.oid = new OID(oid);
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 1cdbe24..e071b47 100644
--- a/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
+++ b/packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.conf.in
@@ -145,7 +145,7 @@
 # SNMP_MANAGERS="host"
 # FILTER="include:*(snmp:) ${FILTER}"
 
-# Default whitespace separated IP/DNS list with optional port, default is 162.
+# Default whitespace separated IPv4/[IPv6]/DNS list with optional port, 
default is 162.
 # SNMP_MANAGERS="manager1.example.com manager2.example.com:164"
 SNMP_MANAGERS=
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a21038928b7e553feefb9ab7669eac588c1c93c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mta...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to