modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpInfo.java | 10 ++++-- modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml | 16 +++++----- 2 files changed, 15 insertions(+), 11 deletions(-)
New commits: commit 9356e5fe02c664fc758376166a95ed4b85a603cb Author: Heiko W. Rupp hwr@redhat.com Date: Thu Jul 11 11:19:45 2013 +0200
BZ 966294 Further improvements. Also work around BZ 983275
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpInfo.java b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpInfo.java index 7b174cc..296696c 100644 --- a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpInfo.java +++ b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpInfo.java @@ -37,6 +37,7 @@ public class SnmpInfo {
// Default remote port for SNMP trap static final String DEFAULT_PORT = "162"; + private static final String DEFAULT_RHQ_BINDING = "1.3.6.1.4.1.18016.2.1";
final public String host; final public String port; @@ -84,8 +85,11 @@ public class SnmpInfo { if (host==null || host.isEmpty()) { host = preferences.getSimpleValue("defaultTargetHost",null); } - String port = configuration.getSimpleValue(PARAM_PORT, DEFAULT_PORT); - String oid = configuration.getSimpleValue(PARAM_VARIABLE_BINDING_PREFIX, null); // required + String port = configuration.getSimpleValue(PARAM_PORT, null); + if (port==null||port.isEmpty()) { + port = preferences.getSimpleValue("defaultPort",DEFAULT_PORT); + } + String oid = configuration.getSimpleValue(PARAM_VARIABLE_BINDING_PREFIX, DEFAULT_RHQ_BINDING); // required String trapOid = configuration.getSimpleValue(PARAM_TRAP_OID, null); return new SnmpInfo(host, port, oid, trapOid);
@@ -94,7 +98,7 @@ public class SnmpInfo { @Override public String toString() { String hostString = (host == null ? "UnknownHost" : host); - String oidString = (oid == null ? "UnknownOID" : oid); + String oidString = (oid == null ? "Unknown Binding Prefix" : oid); String trapOidString = (trapOid == null ? "DefaultTrapOID" : trapOid); return hostString + ":" + port + " (" + oidString + ") (" + trapOidString + ")"; } diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml index 3f7a35c..8e2a4cc 100644 --- a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml +++ b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml @@ -25,7 +25,7 @@ </c:property-options> </c:simple-property>
- <c:simple-property name="defaultTargetHost" displayName="Default trap target host" required="false"/> + <c:simple-property name="defaultTargetHost" displayName="Default trap target host" required="false" default="localhost"/> <c:simple-property name="defaultPort" displayName="Default trap target port" required="false" type="integer" default="162" defaultValue="162"/> <c:simple-property name="transport" defaultValue="UDP"> @@ -35,7 +35,7 @@ </c:property-options> </c:simple-property>
- <c:simple-property name="trapOid" displayName="Trap OID" description="OID for the trap sent" type="string" + <c:simple-property name="trapOid" displayName="Trap OID" description="OID of the trap sent" type="string" default="1.3.6.1.4.1.18016.2.1.2.0.1"/> <c:simple-property name="community" type="string" default="public" description="Community - v1 and v2c only" required="false"/>
@@ -43,10 +43,10 @@
<c:simple-property name="genericId" required="false" default="6" type="integer" description="Set the generic trap type. Default is 6 (=Enterprise specific)."/> - <c:simple-property name="enterpriseOid" required="false" default="1.3.6.1.4.1.18016.2.3" + <c:simple-property name="specificId" required="false" default="0" type="integer" + description="Enterprise-specific ID of the trap. If this is set, the generic ID must be set to 6."/> + <c:simple-property name="enterpriseOid" required="false" default="1.3.6.1.4.1.18016.2.3" description="OID of the sender, identifies the type of managed object generating the trap. Default is enterprise.jboss.rhq.rhqServer"/> - <c:simple-property name="specificId" required="false" default="0" type="integer" - description="Enterprise-specific ID of the trap. If this is set, the generic ID must be set to 6."/> <c:simple-property name="agentAddress" description="Address of our SNMP agent (=the RHQ server)" required="false"/> </c:group> <!-- @@ -91,7 +91,7 @@ sender-wide preferences"/> <c:simple-property name="port" type="integer" required="false" default="162" description="Trap target port"/> <c:simple-property name="oid" displayName="Variable bindings prefix" type="string" required="true" - defaultValue="1.3.6.1.4.1.18016.2.1"> + defaultValue="1.3.6.1.4.1.18016.2.1" default="1.3.6.1.4.1.18016.2.1"> <c:description> <![CDATA[ <p>RHQ will send alert notification details as a list of variable bindings in the @@ -103,11 +103,11 @@ <c:simple-property name="trapOid" required="false"> <c:description> <![CDATA[ - <p>If set, the value of this paramater will override the value of the Trap Oid parameter defined globally + <p>If set, the value of this parameter will override the value of the Trap Oid parameter defined globally in the server plugin configuration. The Trap OID is sent as the second variable binding in the SNMP trap PDU.</p> <p><strong>Only applicable to v2c and v3 traps.</strong></p> - <p><strong>Do not confuse this paramater with 'Variable bindings prefix'.</strong></p> + <p><strong>Do not confuse this parameter with 'Variable bindings prefix'.</strong></p> ]]> </c:description> </c:simple-property>
rhq-commits@lists.fedorahosted.org