Repository: ambari Updated Branches: refs/heads/trunk f453b27fb -> 7343f6d6b
AMBARI-15718. Alert definitions: Percentage params should be the percentage number instead of fraction number (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7343f6d6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7343f6d6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7343f6d6 Branch: refs/heads/trunk Commit: 7343f6d6bc7550dfc969fdb3d7179031618169fc Parents: f453b27 Author: Andrew Onishuk <[email protected]> Authored: Wed Apr 6 00:47:22 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Wed Apr 6 00:47:22 2016 +0300 ---------------------------------------------------------------------- .../alerts/AlertAggregateListener.java | 7 +- .../ambari/server/state/alert/Reporting.java | 34 ++- .../server/upgrade/SchemaUpgradeHelper.java | 16 -- .../server/upgrade/UpgradeCatalog240.java | 219 ++++++++++++++++++- ambari-server/src/main/resources/alerts.json | 4 +- .../AMBARI_METRICS/0.1.0/alerts.json | 11 +- .../common-services/HAWQ/2.0.0/alerts.json | 8 +- .../HBASE/0.96.0.2.0/alerts.json | 13 +- .../common-services/HDFS/2.1.0.2.0/alerts.json | 40 ++-- .../package/alerts/alert_checkpoint_time.py | 4 +- .../common-services/STORM/0.9.1.2.1/alerts.json | 10 +- .../common-services/YARN/2.1.0.2.0/alerts.json | 16 +- .../ZOOKEEPER/3.4.5.2.0/alerts.json | 8 +- .../resources/host_scripts/alert_disk_space.py | 6 +- 14 files changed, 326 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertAggregateListener.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertAggregateListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertAggregateListener.java index 950797c..d982c2f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertAggregateListener.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertAggregateListener.java @@ -204,7 +204,10 @@ public class AlertAggregateListener { int numerator = summary.getCriticalCount() + summary.getWarningCount(); int denominator = totalCount; - double value = (double) (numerator) / denominator; + double value = ((double) (numerator) / denominator); + if(Reporting.ReportingType.PERCENT.equals(reporting.getType())) { + value *= 100; + } if (value >= reporting.getCritical().getValue()) { aggregateAlert.setState(AlertState.CRITICAL); @@ -251,4 +254,4 @@ public class AlertAggregateListener { m_publisher.publish(aggEvent); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java index cd6abad..7b36254 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java @@ -53,6 +53,9 @@ public class Reporting { @SerializedName("units") private String m_units; + @SerializedName("type") + private ReportingType m_type; + /** * @return the WARNING structure or {@code null} if none. */ @@ -119,6 +122,14 @@ public class Reporting { m_units = units; } + public ReportingType getType() { + return m_type; + } + + public void setType(ReportingType m_type) { + this.m_type = m_type; + } + /** * */ @@ -131,7 +142,7 @@ public class Reporting { + ((m_critical == null) ? 0 : m_critical.hashCode()); result = prime * result + ((m_ok == null) ? 0 : m_ok.hashCode()); result = prime * result + ((m_warning == null) ? 0 : m_warning.hashCode()); - + result = prime * result + ((m_type == null) ? 0 : m_type.hashCode()); return result; } @@ -176,6 +187,15 @@ public class Reporting { } else if (!m_warning.equals(other.m_warning)) { return false; } + + if (m_type == null) { + if (other.m_type != null) { + return false; + } + } else if (!m_type.equals(other.m_type)) { + return false; + } + return true; } @@ -272,4 +292,16 @@ public class Reporting { return true; } } + + public enum ReportingType { + /** + * Integers, longs, floats, etc. + */ + NUMERIC, + + /** + * A percent value, expessed as a float. + */ + PERCENT + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java index b1f66af..d4272ba 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java @@ -24,9 +24,6 @@ import com.google.inject.multibindings.Multibinder; import com.google.inject.persist.PersistService; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.audit.AuditLoggerModule; -import org.apache.ambari.server.AmbariException; -import org.apache.ambari.server.audit.AuditLogger; -import org.apache.ambari.server.audit.event.AuditEvent; import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.controller.ControllerModule; import org.apache.ambari.server.orm.DBAccessor; @@ -160,18 +157,6 @@ public class SchemaUpgradeHelper { * Extension of main controller module */ public static class UpgradeHelperModule extends ControllerModule { - public static class AuditLoggerMock implements AuditLogger { - - @Override - public void log(AuditEvent event) { - - } - - @Override - public boolean isEnabled() { - return false; - } - } public UpgradeHelperModule() throws Exception { } @@ -184,7 +169,6 @@ public class SchemaUpgradeHelper { protected void configure() { super.configure(); // Add binding to each newly created catalog - bind(AuditLogger.class).to(AuditLoggerMock.class); Multibinder<UpgradeCatalog> catalogBinder = Multibinder.newSetBinder(binder(), UpgradeCatalog.class); catalogBinder.addBinding().to(UpgradeCatalog150.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java index f603896..e183d8d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java @@ -25,9 +25,11 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; @@ -48,9 +50,6 @@ import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.ConfigHelper; import org.apache.ambari.server.state.RepositoryType; import org.apache.ambari.server.state.State; -import org.apache.ambari.server.state.alert.AlertDefinition; -import org.apache.ambari.server.state.alert.ScriptSource; -import org.apache.ambari.server.state.alert.Source; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.support.JdbcUtils; @@ -278,6 +277,12 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { put("default.smoke.principal", "HIDDEN"); put("default.smoke.keytab", "HIDDEN"); }}; + + final Map<String, String> percentParameterMap = new HashMap<String, String>(){{ + put("units", "%"); + put("type", "PERCENT"); + }}; + Map<String, Map<String, String>> visibilityMap = new HashMap<String, Map<String, String>>(){{ put("hive_webhcat_server_status", new HashMap<String, String>(){{ put("default.smoke.user", "HIDDEN"); @@ -298,8 +303,79 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { put("namenode_increase_in_storage_capacity_usage_weekly", hdfsVisibilityMap); }}; + Map<String, Map<String, String>> reportingPercentMap = new HashMap<String, Map<String, String>>(){{ + put("hawq_segment_process_percent", percentParameterMap); + put("mapreduce_history_server_cpu", percentParameterMap); + put("yarn_nodemanager_webui_percent", percentParameterMap); + put("yarn_resourcemanager_cpu", percentParameterMap); + put("datanode_process_percent", percentParameterMap); + put("datanode_storage_percent", percentParameterMap); + put("journalnode_process_percent", percentParameterMap); + put("namenode_cpu", percentParameterMap); + put("namenode_hdfs_capacity_utilization", percentParameterMap); + put("datanode_storage", percentParameterMap); + put("datanode_heap_usage", percentParameterMap); + put("storm_supervisor_process_percent", percentParameterMap); + put("hbase_regionserver_process_percent", percentParameterMap); + put("hbase_master_cpu", percentParameterMap); + put("zookeeper_server_process_percent", percentParameterMap); + put("metrics_monitor_process_percent", percentParameterMap); + put("ams_metrics_collector_hbase_master_cpu", percentParameterMap); + }}; + + Map<String, Map<String, Integer>> reportingMultiplierMap = new HashMap<String, Map<String, Integer>>(){{ + put("hawq_segment_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("yarn_nodemanager_webui_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("datanode_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("datanode_storage_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("journalnode_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("storm_supervisor_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("hbase_regionserver_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("zookeeper_server_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + put("metrics_monitor_process_percent", new HashMap<String, Integer>() {{ + put("warning", 100); + put("critical", 100); + }}); + }}; + + Map<String, Map<String, Integer>> scriptAlertMultiplierMap = new HashMap<String, Map<String, Integer>>(){{ + put("ambari_agent_disk_usage", new HashMap<String, Integer>() {{ + put("percent.used.space.warning.threshold", 100); + put("percent.free.space.critical.threshold", 100); + }}); + put("namenode_last_checkpoint", new HashMap<String, Integer>() {{ + put("checkpoint.time.warning.threshold", 100); + put("checkpoint.time.critical.threshold", 100); + }}); + }}; + + // list of alerts that need to get property updates - List<String> alertNamesForPropertyUpdates = new ArrayList<String>() {{ + Set<String> alertNamesForPropertyUpdates = new HashSet<String>() {{ add("namenode_service_rpc_queue_latency_hourly"); add("namenode_client_rpc_queue_latency_hourly"); add("namenode_service_rpc_processing_latency_hourly"); @@ -312,6 +388,25 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { add("namenode_increase_in_storage_capacity_usage_daily"); add("increase_nn_heap_usage_weekly"); add("namenode_increase_in_storage_capacity_usage_weekly"); + add("hawq_segment_process_percent"); + add("mapreduce_history_server_cpu"); + add("yarn_nodemanager_webui_percent"); + add("yarn_resourcemanager_cpu"); + add("datanode_process_percent"); + add("datanode_storage_percent"); + add("journalnode_process_percent"); + add("namenode_cpu"); + add("namenode_hdfs_capacity_utilization"); + add("datanode_storage"); + add("datanode_heap_usage"); + add("storm_supervisor_process_percent"); + add("hbase_regionserver_process_percent"); + add("hbase_master_cpu"); + add("zookeeper_server_process_percent"); + add("metrics_monitor_process_percent"); + add("ams_metrics_collector_hbase_master_cpu"); + add("ambari_agent_disk_usage"); + add("namenode_last_checkpoint"); }}; LOG.info("Updating alert definitions."); @@ -388,6 +483,38 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { alertDefinition.setSource(addParamOption(source, paramName, "visibility", visibilityValue)); } } + // update percent script alerts param values from 0.x to 0.x * 100 values + if(scriptAlertMultiplierMap.containsKey(alertDefinition.getDefinitionName())) { + for(Map.Entry<String, Integer> entry : scriptAlertMultiplierMap.get(alertDefinition.getDefinitionName()).entrySet()){ + String paramName = entry.getKey(); + Integer multiplier = entry.getValue(); + String source = alertDefinition.getSource(); + Float oldValue = getParamFloatValue(source, paramName); + Integer newValue = Math.round(oldValue * multiplier); + alertDefinition.setSource(setParamIntegerValue(source, paramName, newValue)); + } + } + + // update reporting alerts(aggregate and metrics) values from 0.x to 0.x * 100 values + if(reportingMultiplierMap.containsKey(alertDefinition.getDefinitionName())) { + for(Map.Entry<String, Integer> entry : reportingMultiplierMap.get(alertDefinition.getDefinitionName()).entrySet()){ + String reportingName = entry.getKey(); + Integer multiplier = entry.getValue(); + String source = alertDefinition.getSource(); + Float oldValue = getReportingFloatValue(source, reportingName); + Integer newValue = Math.round(oldValue * multiplier); + alertDefinition.setSource(setReportingIntegerValue(source, reportingName, newValue)); + } + } + + if(reportingPercentMap.containsKey(alertDefinition.getDefinitionName())) { + for(Map.Entry<String, String> entry : reportingPercentMap.get(alertDefinition.getDefinitionName()).entrySet()){ + String paramName = entry.getKey(); + String paramValue = entry.getValue(); + String source = alertDefinition.getSource(); + alertDefinition.setSource(addReportingOption(source, paramName, paramValue)); + } + } // regeneration of hash and writing modified alerts to database, must go after all modifications finished alertDefinition.setHash(UUID.randomUUID().toString()); @@ -430,6 +557,90 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { return sourceJson.toString(); } + /** + * Returns param value as float. + * @param source source of script alert + * @param paramName param name + * @return param value as float + */ + protected Float getParamFloatValue(String source, String paramName){ + JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); + JsonArray parametersJson = sourceJson.getAsJsonArray("parameters"); + if(parametersJson != null && !parametersJson.isJsonNull()) { + for(JsonElement param : parametersJson) { + if(param.isJsonObject()) { + JsonObject paramObject = param.getAsJsonObject(); + if(paramObject.has("name") && paramObject.get("name").getAsString().equals(paramName)){ + if(paramObject.has("value")) { + return paramObject.get("value").getAsFloat(); + } + } + } + } + } + return null; + } + + /** + * Set integer param value. + * @param source source of script alert + * @param paramName param name + * @param value new param value + * @return modified source + */ + protected String setParamIntegerValue(String source, String paramName, Integer value){ + JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); + JsonArray parametersJson = sourceJson.getAsJsonArray("parameters"); + if(parametersJson != null && !parametersJson.isJsonNull()) { + for(JsonElement param : parametersJson) { + if(param.isJsonObject()) { + JsonObject paramObject = param.getAsJsonObject(); + if(paramObject.has("name") && paramObject.get("name").getAsString().equals(paramName)){ + paramObject.add("value", new JsonPrimitive(value)); + } + } + } + } + return sourceJson.toString(); + } + + /** + * Returns reporting value as float. + * @param source source of aggregate or metric alert + * @param reportingName reporting name, must be "warning" or "critical" + * @return reporting value as float + */ + protected Float getReportingFloatValue(String source, String reportingName){ + JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); + return sourceJson.getAsJsonObject("reporting").getAsJsonObject(reportingName).get("value").getAsFloat(); + } + + /** + * Set integer value of reporting. + * @param source source of aggregate or metric alert + * @param reportingName reporting name, must be "warning" or "critical" + * @param value new value + * @return modified source + */ + protected String setReportingIntegerValue(String source, String reportingName, Integer value){ + JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); + sourceJson.getAsJsonObject("reporting").getAsJsonObject(reportingName).add("value", new JsonPrimitive(value)); + return sourceJson.toString(); + } + + /** + * Add option to reporting + * @param source source of aggregate or metric alert + * @param optionName option name + * @param value option value + * @return modified source + */ + protected String addReportingOption(String source, String optionName, String value){ + JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); + sourceJson.getAsJsonObject("reporting").add(optionName, new JsonPrimitive(value)); + return sourceJson.toString(); + } + protected String addParam(String source, List<String> params) { JsonObject sourceJson = new JsonParser().parse(source).getAsJsonObject(); JsonArray parametersJson = sourceJson.getAsJsonArray("parameters"); http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/alerts.json b/ambari-server/src/main/resources/alerts.json index e584b2c..81f1f99 100644 --- a/ambari-server/src/main/resources/alerts.json +++ b/ambari-server/src/main/resources/alerts.json @@ -52,7 +52,7 @@ { "name": "percent.used.space.warning.threshold", "display_name": "Warning", - "value": 0.5, + "value": 50, "type": "PERCENT", "description": "The percent of disk space consumed before a warning is triggered.", "units": "%", @@ -61,7 +61,7 @@ { "name": "percent.free.space.critical.threshold", "display_name": "Critical", - "value": 0.8, + "value": 80, "type": "PERCENT", "description": "The percent of disk space consumed before a critical alert is triggered.", "units": "%", http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json index 1da4e24..e41adb5 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/alerts.json @@ -17,12 +17,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } } @@ -129,7 +131,8 @@ "text": "{1} CPU, load {0:.1%}", "value": 250 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json index 852cb03..8880a8c 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json @@ -17,12 +17,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.25 - } + "value": 25 + }, + "units" : "%", + "type": "PERCENT" } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/alerts.json b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/alerts.json index e2dffe3..50a7ceb 100644 --- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/alerts.json @@ -17,12 +17,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } } @@ -79,7 +81,8 @@ "text": "{1} CPU, load {0:.1%}", "value": 250 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -119,4 +122,4 @@ } ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json index d6f53cc..3612de2 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json @@ -17,12 +17,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } }, @@ -42,12 +44,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } }, @@ -67,12 +71,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.33 + "value": 33 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.50 - } + "value": 50 + }, + "units" : "%", + "type": "PERCENT" } } } @@ -164,7 +170,8 @@ "text": "{1} CPU, load {0:.1%}", "value": 250 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -304,7 +311,8 @@ "text": "Capacity Used:[{2:.0f}%, {0}], Capacity Remaining:[{1}]", "value": 80 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -479,7 +487,7 @@ { "name": "checkpoint.time.warning.threshold", "display_name": "Checkpoint Warning", - "value": 2.0, + "value": 200, "type": "PERCENT", "description": "The percentage of the last checkpoint time greater than the interval in order to trigger a warning alert.", "units": "%", @@ -488,7 +496,7 @@ { "name": "checkpoint.time.critical.threshold", "display_name": "Checkpoint Critical", - "value": 2.0, + "value": 200, "type": "PERCENT", "description": "The percentage of the last checkpoint time greater than the interval in order to trigger a critical alert.", "units": "%", @@ -1491,7 +1499,8 @@ "text": "Remaining Capacity:[{0}], Total Capacity:[{2:.0f}% Used, {1}]", "value": 80 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -1544,7 +1553,8 @@ "text": "Used Heap:[{2:.0f}%, {0} MB], Max Heap: {1} MB", "value": 90 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py index 71e34e6..e165c7b 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py @@ -129,11 +129,11 @@ def execute(configurations={}, parameters={}, host_name=None): percent_warning = PERCENT_WARNING_DEFAULT if PERCENT_WARNING_KEY in parameters: - percent_warning = float(parameters[PERCENT_WARNING_KEY]) * 100 + percent_warning = float(parameters[PERCENT_WARNING_KEY]) percent_critical = PERCENT_CRITICAL_DEFAULT if PERCENT_CRITICAL_KEY in parameters: - percent_critical = float(parameters[PERCENT_CRITICAL_KEY]) * 100 + percent_critical = float(parameters[PERCENT_CRITICAL_KEY]) kinit_timer_ms = parameters.get(KERBEROS_KINIT_TIMER_PARAMETER, DEFAULT_KERBEROS_KINIT_TIMER_MS) http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/alerts.json b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/alerts.json index f25d29b..ae03617 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/alerts.json +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/alerts.json @@ -16,12 +16,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } } @@ -189,4 +191,4 @@ } ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/alerts.json b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/alerts.json index 6198a74..8561922 100644 --- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/alerts.json @@ -62,7 +62,8 @@ "text": "{1} CPU, load {0:.1%}", "value": 250 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -160,12 +161,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.1 + "value": 10 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.3 - } + "value": 30 + }, + "units" : "%", + "type": "PERCENT" } } } @@ -297,7 +300,8 @@ "text": "{1} CPU, load {0:.1%}", "value": 250 }, - "units" : "%" + "units" : "%", + "type": "PERCENT" }, "jmx": { "property_list": [ @@ -411,4 +415,4 @@ } ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/alerts.json b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/alerts.json index d27fe02..469036a 100644 --- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/alerts.json @@ -17,12 +17,14 @@ }, "warning": { "text": "affected: [{1}], total: [{0}]", - "value": 0.35 + "value": 35 }, "critical": { "text": "affected: [{1}], total: [{0}]", - "value": 0.70 - } + "value": 70 + }, + "units" : "%", + "type": "PERCENT" } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7343f6d6/ambari-server/src/main/resources/host_scripts/alert_disk_space.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py index b7a7038..d2b4f36 100644 --- a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py +++ b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py @@ -97,10 +97,10 @@ def _get_warnings_for_partition(parameters, disk_usage): min_free_space = long(float(parameters[MIN_FREE_SPACE_KEY])) if PERCENT_USED_WARNING_KEY in parameters: - warning_percent = float(parameters[PERCENT_USED_WARNING_KEY]) * 100 + warning_percent = float(parameters[PERCENT_USED_WARNING_KEY]) if PERCENT_USED_CRITICAL_KEY in parameters: - critical_percent = float(parameters[PERCENT_USED_CRITICAL_KEY]) * 100 + critical_percent = float(parameters[PERCENT_USED_CRITICAL_KEY]) if disk_usage is None or disk_usage.total == 0: @@ -216,4 +216,4 @@ def _get_formatted_size(bytes): return '%.1f' % (bytes / 1000000000000.0) + ' TB' if __name__ == '__main__': - print _get_disk_usage(os.getcwd()) \ No newline at end of file + print _get_disk_usage(os.getcwd())
