ambari git commit: AMBARI-19257 BE changes needed for SNMP Ambari MIB support (dsen)
Repository: ambari Updated Branches: refs/heads/branch-2.5 df52e537c -> 7cd6755db AMBARI-19257 BE changes needed for SNMP Ambari MIB support (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7cd6755d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7cd6755d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7cd6755d Branch: refs/heads/branch-2.5 Commit: 7cd6755dbbe9ec2c7e39e119b55371fbe3cc802a Parents: df52e53 Author: Dmytro Sen Authored: Fri Dec 23 18:55:17 2016 +0200 Committer: Dmytro Sen Committed: Fri Dec 23 18:56:33 2016 +0200 -- .../dispatchers/AmbariSNMPDispatcher.java | 5 +++-- .../apache/ambari/server/state/AlertState.java | 20 +++- .../dispatchers/AmbariSNMPDispatcherTest.java | 8 3 files changed, 22 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7cd6755d/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java b/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java index 77e55a4..dcc8aac 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java @@ -56,6 +56,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { public static final String BASE_AMBARI_OID = "1.3.6.1.4.1.18060.16"; public static final String APACHE_AMBARI_TRAPS_OID = BASE_AMBARI_OID + ".0"; +public static final String AMBARI_ALERT_TRAP_OID = APACHE_AMBARI_TRAPS_OID + ".1"; public static final String AMBARI_ALERTS_OID = BASE_AMBARI_OID + ".1"; public static final String AMBARI_ALERT_TABLE_OID = AMBARI_ALERTS_OID + ".1"; public static final String AMBARI_ALERT_ENTRY_OID = AMBARI_ALERT_TABLE_OID + ".1"; @@ -108,7 +109,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { pdu.setType(snmpVersion.getTrapType()); // Set trap oid for PDU -pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(APACHE_AMBARI_TRAPS_OID))); +pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(AMBARI_ALERT_TRAP_OID))); // Set notification body and subject for PDU objects with identifiers specified in dispatch properties. AlertNoticeDispatchService.AlertInfo alertInfo = alertNotification.getAlertInfo(); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_DEFINITION_ID_OID, alertInfo.getAlertDefinitionId()); @@ -116,7 +117,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { addVariableBindingCheckForNull(pdu, AMBARI_ALERT_DEFINITION_HASH_OID, alertInfo.getAlertDefinitionHash()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_NAME_OID, alertInfo.getAlertName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_TEXT_OID, alertInfo.getAlertText()); -addVariableBindingCheckForNull(pdu, AMBARI_ALERT_STATE_OID, alertInfo.getAlertState()); +addVariableBindingCheckForNull(pdu, AMBARI_ALERT_STATE_OID, alertInfo.getAlertState().getIntValue()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_HOST_NAME_OID, alertInfo.getHostName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_SERVICE_NAME_OID, alertInfo.getServiceName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_COMPONENT_NAME_OID, alertInfo.getComponentName()); http://git-wip-us.apache.org/repos/asf/ambari/blob/7cd6755d/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java b/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java index 3bb70e2..8e04eb1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java @@ -24,27 +24,37 @@ public enum AlertState { /** * Alert does not need to be distributed. Normal Operation. */ - OK, + OK(0), /** * Alert indicates there may be an issue. The component may be operating * normally but may be in danger of becoming CRITICAL. */ - WARNING, + WARNING(2), /** * Indicates there is a critical situation that needs to be addressed. */ - CRITICAL, + CRITICAL(3), /** * The state of the alert is not known. */ - UNKNOWN, +
ambari git commit: AMBARI-19257 BE changes needed for SNMP Ambari MIB support (dsen)
Repository: ambari Updated Branches: refs/heads/trunk 50c770ab9 -> c4d8f2dc8 AMBARI-19257 BE changes needed for SNMP Ambari MIB support (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c4d8f2dc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c4d8f2dc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c4d8f2dc Branch: refs/heads/trunk Commit: c4d8f2dc8d28fe6eb42b3bfa102383e089a502f3 Parents: 50c770a Author: Dmytro Sen Authored: Fri Dec 23 18:55:17 2016 +0200 Committer: Dmytro Sen Committed: Fri Dec 23 18:55:17 2016 +0200 -- .../dispatchers/AmbariSNMPDispatcher.java | 5 +++-- .../apache/ambari/server/state/AlertState.java | 20 +++- .../dispatchers/AmbariSNMPDispatcherTest.java | 8 3 files changed, 22 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c4d8f2dc/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java b/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java index 62ef31a..86ef07c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcher.java @@ -59,6 +59,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { public static final String BASE_AMBARI_OID = "1.3.6.1.4.1.18060.16"; public static final String APACHE_AMBARI_TRAPS_OID = BASE_AMBARI_OID + ".0"; +public static final String AMBARI_ALERT_TRAP_OID = APACHE_AMBARI_TRAPS_OID + ".1"; public static final String AMBARI_ALERTS_OID = BASE_AMBARI_OID + ".1"; public static final String AMBARI_ALERT_TABLE_OID = AMBARI_ALERTS_OID + ".1"; public static final String AMBARI_ALERT_ENTRY_OID = AMBARI_ALERT_TABLE_OID + ".1"; @@ -111,7 +112,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { pdu.setType(snmpVersion.getTrapType()); // Set trap oid for PDU -pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(APACHE_AMBARI_TRAPS_OID))); +pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(AMBARI_ALERT_TRAP_OID))); // Set notification body and subject for PDU objects with identifiers specified in dispatch properties. AlertNoticeDispatchService.AlertInfo alertInfo = alertNotification.getAlertInfo(); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_DEFINITION_ID_OID, alertInfo.getAlertDefinitionId()); @@ -119,7 +120,7 @@ public class AmbariSNMPDispatcher extends SNMPDispatcher { addVariableBindingCheckForNull(pdu, AMBARI_ALERT_DEFINITION_HASH_OID, alertInfo.getAlertDefinitionHash()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_NAME_OID, alertInfo.getAlertName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_TEXT_OID, alertInfo.getAlertText()); -addVariableBindingCheckForNull(pdu, AMBARI_ALERT_STATE_OID, alertInfo.getAlertState()); +addVariableBindingCheckForNull(pdu, AMBARI_ALERT_STATE_OID, alertInfo.getAlertState().getIntValue()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_HOST_NAME_OID, alertInfo.getHostName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_SERVICE_NAME_OID, alertInfo.getServiceName()); addVariableBindingCheckForNull(pdu, AMBARI_ALERT_COMPONENT_NAME_OID, alertInfo.getComponentName()); http://git-wip-us.apache.org/repos/asf/ambari/blob/c4d8f2dc/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java b/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java index 3bb70e2..8e04eb1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/AlertState.java @@ -24,27 +24,37 @@ public enum AlertState { /** * Alert does not need to be distributed. Normal Operation. */ - OK, + OK(0), /** * Alert indicates there may be an issue. The component may be operating * normally but may be in danger of becoming CRITICAL. */ - WARNING, + WARNING(2), /** * Indicates there is a critical situation that needs to be addressed. */ - CRITICAL, + CRITICAL(3), /** * The state of the alert is not known. */ - UNKNOWN, + UNKNOWN(1