http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/e2e/ump_demo_schema.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/e2e/ump_demo_schema.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/e2e/ump_demo_schema.json index 053ac9c..a833819 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/e2e/ump_demo_schema.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/e2e/ump_demo_schema.json @@ -1,170 +1,181 @@ { "clusters": [], "schemas": [ - { - "streamId": "syslog_stream", - "dataSource" : "network_syslog_datasource", - "description":"the data stream for syslog events", - "validate": false, - "timeseries":false, - "columns": [ - { - "name": "dims_facility", - "type" : "STRING", - "defaultValue": "", - "required":true - },{ - "name": "dims_severity", - "type" : "STRING", - "defaultValue": "", - "required": true - }, - { - "name": "dims_hostname", - "type" : "STRING", - "defaultValue": "", - "required": true - }, - { - "name": "dims_msgid", - "type" : "STRING", - "defaultValue": "", - "required": true - },{ - "name": "timestamp", - "type" : "STRING", - "defaultValue": "", - "required":true - },{ - "name": "conn", - "type" : "STRING", - "defaultValue": "", - "required": true - },{ - "name": "op", - "type" : "STRING", - "defaultValue": "", - "required":true - },{ - "name": "msgId", - "type" : "STRING", - "defaultValue": "", - "required":true - },{ - "name": "command", - "type" : "STRING", - "defaultValue": "", - "required": true - },{ - "name": "name", - "type" : "STRING", - "defaultValue": "", - "required": true - },{ - "name": "namespace", - "type" : "STRING", - "defaultValue": "", - "required": true - },{ - "name": "epochMillis", - "type" : "LONG", - "defaultValue": 0, - "required": true - } - ] - } + { + "streamId": "syslog_stream", + "dataSource": "network_syslog_datasource", + "description": "the data stream for syslog events", + "validate": false, + "timeseries": false, + "columns": [ + { + "name": "dims_facility", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "dims_severity", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "dims_hostname", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "dims_msgid", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "timestamp", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "conn", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "op", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "msgId", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "command", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "name", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "namespace", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "epochMillis", + "type": "LONG", + "defaultValue": 0, + "required": true + } + ] + } ], "datasources": [ - { - "name": "network_syslog_datasource", - "type": "KAFKA", - "properties": { - }, - "topic": "logoutput", - "schemeCls": "org.apache.eagle.alert.engine.extension.SherlockEventScheme", - "codec": { - "streamNameSelectorProp": { - "userProvidedStreamName" : "syslog_stream", - "streamNameFormat":"%s" - }, - "streamNameSelectorCls":"org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", - "timestampColumn": "timestamp", - "timestampFormat":"" - } - } + { + "name": "network_syslog_datasource", + "type": "KAFKA", + "properties": { + }, + "topic": "logoutput", + "schemeCls": "org.apache.eagle.alert.engine.extension.SherlockEventScheme", + "codec": { + "streamNameSelectorProp": { + "userProvidedStreamName": "syslog_stream", + "streamNameFormat": "%s" + }, + "streamNameSelectorCls": "org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", + "timestampColumn": "timestamp", + "timestampFormat": "" + } + } ], "policies": [ - { - "name": "syslog_severity_check", - "description" : "syslog.severity > 3 then error", - "inputStreams": [ - "syslog_stream" - ], - "outputStreams": [ - "syslog_severity_check_output" - ], - "definition": { - "type": "siddhi", - "value": "from syslog_stream[dims_severity == \"NOTICE\"] select * insert into syslog_severity_check_output;" - }, - "partitionSpec": [ - { - "streamId" : "syslog_stream", - "type" : "GROUPBY", - "columns" : [ - "dims_hostname" - ] - } - ], - "parallelismHint": 10 - } + { + "name": "syslog_severity_check", + "description": "syslog.severity > 3 then error", + "inputStreams": [ + "syslog_stream" + ], + "outputStreams": [ + "syslog_severity_check_output" + ], + "definition": { + "type": "siddhi", + "value": "from syslog_stream[dims_severity == \"NOTICE\"] select * insert into syslog_severity_check_output;" + }, + "partitionSpec": [ + { + "streamId": "syslog_stream", + "type": "GROUPBY", + "columns": [ + "dims_hostname" + ] + } + ], + "parallelismHint": 10 + } ], "publishments": [ - { - "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", - "name":"network-syslog-publish", - "policyIds": ["syslog_severity_check"], - "dedupIntervalMin": "PT0M", - "properties":{ - "kafka_broker":"localhost:9092", - "topic":"syslog_alerts", - "value.deserializer": "org.apache.kafka.common.serialization.ByteArrayDeserializer", - "value.serializer": "org.apache.kafka.common.serialization.ByteArraySerializer" - }, - "serializer" : "org.apache.eagle.alert.engine.extension.SherlockAlertSerializer" - } + { + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", + "name": "network-syslog-publish", + "policyIds": [ + "syslog_severity_check" + ], + "dedupIntervalMin": "PT0M", + "properties": { + "kafka_broker": "localhost:9092", + "topic": "syslog_alerts", + "value.deserializer": "org.apache.kafka.common.serialization.ByteArrayDeserializer", + "value.serializer": "org.apache.kafka.common.serialization.ByteArraySerializer" + }, + "serializer": "org.apache.eagle.alert.engine.extension.SherlockAlertSerializer" + } ], "scheduleStates": {}, "assignments": [], "topologies": [ - { - "name": "alertUnitTopology_1", - "numOfSpout":1, - "numOfGroupBolt": 4, - "numOfAlertBolt": 10, - "spoutId": "alertEngineSpout", - "groupNodeIds" : [ - "streamRouterBolt0", - "streamRouterBolt1", - "streamRouterBolt2", - "streamRouterBolt3" - ], - "alertBoltIds": [ - "alertBolt0", - "alertBolt1", - "alertBolt2", - "alertBolt3", - "alertBolt4", - "alertBolt5", - "alertBolt6", - "alertBolt7", - "alertBolt8", - "alertBolt9" - ], - "pubBoltId" : "alertPublishBolt", - "spoutParallelism": 1, - "groupParallelism": 1, - "alertParallelism": 1 - } + { + "name": "alertUnitTopology_1", + "numOfSpout": 1, + "numOfGroupBolt": 4, + "numOfAlertBolt": 10, + "spoutId": "alertEngineSpout", + "groupNodeIds": [ + "streamRouterBolt0", + "streamRouterBolt1", + "streamRouterBolt2", + "streamRouterBolt3" + ], + "alertBoltIds": [ + "alertBolt0", + "alertBolt1", + "alertBolt2", + "alertBolt3", + "alertBolt4", + "alertBolt5", + "alertBolt6", + "alertBolt7", + "alertBolt8", + "alertBolt9" + ], + "pubBoltId": "alertPublishBolt", + "spoutParallelism": 1, + "groupParallelism": 1, + "alertParallelism": 1 + } ] } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/log4j.properties b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/log4j.properties index 164fa8e..be79336 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/log4j.properties +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/log4j.properties @@ -12,12 +12,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - log4j.rootLogger=DEBUG, stdout - # standard output log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n - log4j.logger.org.apache.eagle.alert.engine.evaluator.nodata=DEBUG \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/publishments.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/publishments.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/publishments.json index 6d0fbf4..cb6198e 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/publishments.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/publishments.json @@ -1,15 +1,16 @@ [ - -{ - "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", - "name":"network-syslog-publish", - "policyIds": ["syslog_severity_critical_check", "syslog_aggregation_alert"], - "dedupIntervalMin": "PT0M", - "properties":{ - "kafka_broker":"localhost:9092", - "topic":"syslog_alerts" - }, - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.JsonEventSerializer" -} - + { + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", + "name": "network-syslog-publish", + "policyIds": [ + "syslog_severity_critical_check", + "syslog_aggregation_alert" + ], + "dedupIntervalMin": "PT0M", + "properties": { + "kafka_broker": "localhost:9092", + "topic": "syslog_alerts" + }, + "serializer": "org.apache.eagle.alert.engine.publisher.impl.JsonEventSerializer" + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/streamdefinitions.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/streamdefinitions.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/streamdefinitions.json index abe1f13..68eb748 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/streamdefinitions.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/loopback/streamdefinitions.json @@ -93,102 +93,102 @@ ] }, { - "streamId":"syslog_severity_critical_check", - "dataSource":"network_syslog_alert_datasource", - "description":"the data stream for syslog events", - "validate":false, - "timeseries":false, - "columns":[ + "streamId": "syslog_severity_critical_check", + "dataSource": "network_syslog_alert_datasource", + "description": "the data stream for syslog events", + "validate": false, + "timeseries": false, + "columns": [ { - "name":"dims_hostname", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "dims_hostname", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"facility_code", - "type":"INT", - "defaultValue":"", - "required":true, - "description":null + "name": "facility_code", + "type": "INT", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"facility_name", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "facility_name", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"severity_code", - "type":"INT", - "defaultValue":"", - "required":true, - "description":null + "name": "severity_code", + "type": "INT", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"severity_name", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "severity_name", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"msg", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "msg", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"msgid", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "msgid", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"procid", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "procid", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"dims_appname", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "dims_appname", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"name", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "name", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"namespace", - "type":"STRING", - "defaultValue":"", - "required":true, - "description":null + "name": "namespace", + "type": "STRING", + "defaultValue": "", + "required": true, + "description": null }, { - "name":"epochMillis", - "type":"LONG", - "defaultValue":0, - "required":true, - "description":null + "name": "epochMillis", + "type": "LONG", + "defaultValue": 0, + "required": true, + "description": null }, { - "name":"alertKey", - "type":"STRING", + "name": "alertKey", + "type": "STRING", "defaultValue": "", - "required":true, - "description":null + "required": true, + "description": null } ] } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/application-nodata.conf ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/application-nodata.conf b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/application-nodata.conf index 7094820..11df895 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/application-nodata.conf +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/application-nodata.conf @@ -13,16 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. { - "topology" : { - "name" : "alertUnitTopology_1", + "topology": { + "name": "alertUnitTopology_1", "numOfTotalWorkers": 20, - "numOfSpoutTasks" : 1, - "numOfRouterBolts" : 4, - "numOfAlertBolts" : 10, - "numOfPublishTasks" : 1, - "localMode" : "true" + "numOfSpoutTasks": 1, + "numOfRouterBolts": 4, + "numOfAlertBolts": 10, + "numOfPublishTasks": 1, + "localMode": "true" }, - "spout" : { + "spout": { "kafkaBrokerZkQuorum": "sandbox.hortonworks.com:2181", "kafkaBrokerZkBasePath": "/brokers", "stormKafkaUseSameZkQuorumWithKafkaBroker": true, @@ -32,29 +32,29 @@ "stormKafkaStateUpdateIntervalMs": 2000, "stormKafkaFetchSizeBytes": 1048586, }, - "zkConfig" : { - "zkQuorum" : "sandbox.hortonworks.com:2181", - "zkRoot" : "/alert", - "zkSessionTimeoutMs" : 10000, - "connectionTimeoutMs" : 10000, - "zkRetryTimes" : 3, - "zkRetryInterval" : 3000 + "zkConfig": { + "zkQuorum": "sandbox.hortonworks.com:2181", + "zkRoot": "/alert", + "zkSessionTimeoutMs": 10000, + "connectionTimeoutMs": 10000, + "zkRetryTimes": 3, + "zkRetryInterval": 3000 }, - "dynamicConfigSource" : { + "dynamicConfigSource": { "initDelayMillis": 3000, - "delayMillis" : 10000 + "delayMillis": 10000 }, "metadataService": { - "context" : "/rest", - "host" : "localhost", - "port" : 8080 + "context": "/rest", + "host": "localhost", + "port": 8080 }, "coordinatorService": { - "host": "localhost", - "port": "8080", - "context" : "/rest" + "host": "localhost", + "port": "8080", + "context": "/rest" }, "kafkaProducer": { - "bootstrapServers": "sandbox.hortonworks.com:6667" + "bootstrapServers": "sandbox.hortonworks.com:6667" } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/datasources.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/datasources.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/datasources.json index 988318e..814f4c0 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/datasources.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/datasources.json @@ -1,17 +1,17 @@ [ - { - "name": "noDataAlertDataSource", - "type": "KAFKA", - "properties": {}, - "topic": "noDataAlertTopic", - "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", - "codec": { - "streamNameSelectorProp": { - "userProvidedStreamName": "noDataAlertStream" - }, - "streamNameSelectorCls": "org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", - "timestampColumn": "timestamp", - "timestampFormat": "" - } - } + { + "name": "noDataAlertDataSource", + "type": "KAFKA", + "properties": {}, + "topic": "noDataAlertTopic", + "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", + "codec": { + "streamNameSelectorProp": { + "userProvidedStreamName": "noDataAlertStream" + }, + "streamNameSelectorCls": "org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", + "timestampColumn": "timestamp", + "timestampFormat": "" + } + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies-provided-wisb.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies-provided-wisb.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies-provided-wisb.json index 012fd9f..64d6885 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies-provided-wisb.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies-provided-wisb.json @@ -1,23 +1,23 @@ [ - { - "name": "noDataAlertPolicy", - "description": "noDataAlertPolicy", - "inputStreams": [ - "noDataAlertStream" - ], - "outputStreams": [ - "noDataAlertStream_out" - ], - "definition": { - "type": "nodataalert", - "value": "PT1M,plain,1,host,host1,host2,host3" - }, - "partitionSpec": [ - { - "streamId": "noDataAlertStream", - "type": "GROUPBY" - } - ], - "parallelismHint": 2 - } + { + "name": "noDataAlertPolicy", + "description": "noDataAlertPolicy", + "inputStreams": [ + "noDataAlertStream" + ], + "outputStreams": [ + "noDataAlertStream_out" + ], + "definition": { + "type": "nodataalert", + "value": "PT1M,plain,1,host,host1,host2,host3" + }, + "partitionSpec": [ + { + "streamId": "noDataAlertStream", + "type": "GROUPBY" + } + ], + "parallelismHint": 2 + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies.json index 0c4df7e..18d08b9 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/policies.json @@ -1,24 +1,26 @@ [ - { - "name": "noDataAlertPolicy", - "description": "noDataAlertPolicy", - "inputStreams": [ - "noDataAlertStream" - ], - "outputStreams": [ - "noDataAlertStream_out" - ], - "definition": { - "type": "nodataalert", - "value": "PT1M,dynamic,1,host" - }, - "partitionSpec": [ - { - "streamId": "noDataAlertStream", - "type": "GROUPBY", - "columns" : ["host"] - } - ], - "parallelismHint": 2 - } + { + "name": "noDataAlertPolicy", + "description": "noDataAlertPolicy", + "inputStreams": [ + "noDataAlertStream" + ], + "outputStreams": [ + "noDataAlertStream_out" + ], + "definition": { + "type": "nodataalert", + "value": "PT1M,dynamic,1,host" + }, + "partitionSpec": [ + { + "streamId": "noDataAlertStream", + "type": "GROUPBY", + "columns": [ + "host" + ] + } + ], + "parallelismHint": 2 + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/publishments.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/publishments.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/publishments.json index 362a03b..d8d4476 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/publishments.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/publishments.json @@ -1,20 +1,20 @@ [ - { - "name":"test-stream-output", - "type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "policyIds": [ - "noDataAlertPolicy" - ], - "properties": { - "subject":"Eagle Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "servi...@corp.com", - "smtp.server":"smtp.mailhost.com", - "connection": "plaintext", - "smtp.port": "25" - }, - "dedupIntervalMin" : "PT5M", - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" - } + { + "name": "test-stream-output", + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", + "policyIds": [ + "noDataAlertPolicy" + ], + "properties": { + "subject": "Eagle Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "servi...@corp.com", + "smtp.server": "smtp.mailhost.com", + "connection": "plaintext", + "smtp.port": "25" + }, + "dedupIntervalMin": "PT5M", + "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" + } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/streamdefinitions.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/streamdefinitions.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/streamdefinitions.json index 45b6241..4fb40d2 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/streamdefinitions.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/streamdefinitions.json @@ -1,29 +1,29 @@ [ - { - "streamId": "noDataAlertStream", - "dataSource": "noDataAlertDataSource", - "description": "the data stream for testing no data alert", - "validate": false, - "timeseries": false, - "columns": [ - { - "name": "host", - "type": "STRING", - "defaultValue": "", - "required": true - }, - { - "name": "timestamp", - "type": "LONG", - "defaultValue": 0, - "required": true - }, - { - "name": "value", - "type": "DOUBLE", - "defaultValue": "0.0", - "required": true - } - ] - } + { + "streamId": "noDataAlertStream", + "dataSource": "noDataAlertDataSource", + "description": "the data stream for testing no data alert", + "validate": false, + "timeseries": false, + "columns": [ + { + "name": "host", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "timestamp", + "type": "LONG", + "defaultValue": 0, + "required": true + }, + { + "name": "value", + "type": "DOUBLE", + "defaultValue": "0.0", + "required": true + } + ] + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/topologies.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/topologies.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/topologies.json index 411cc48..c13eeb2 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/topologies.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/nodata/topologies.json @@ -1,31 +1,31 @@ [ -{ - "name": "alertUnitTopology_1", - "numOfSpout":1, - "numOfAlertBolt": 10, - "numOfGroupBolt": 4, - "spoutId": "alertEngineSpout", - "groupNodeIds" : [ - "streamRouterBolt0", - "streamRouterBolt1", - "streamRouterBolt2", - "streamRouterBolt3" - ], - "alertBoltIds": [ - "alertBolt0", - "alertBolt1", - "alertBolt2", - "alertBolt3", - "alertBolt4", - "alertBolt5", - "alertBolt6", - "alertBolt7", - "alertBolt8", - "alertBolt9" - ], - "pubBoltId" : "alertPublishBolt", - "spoutParallelism": 1, - "groupParallelism": 1, - "alertParallelism": 1 -} + { + "name": "alertUnitTopology_1", + "numOfSpout": 1, + "numOfAlertBolt": 10, + "numOfGroupBolt": 4, + "spoutId": "alertEngineSpout", + "groupNodeIds": [ + "streamRouterBolt0", + "streamRouterBolt1", + "streamRouterBolt2", + "streamRouterBolt3" + ], + "alertBoltIds": [ + "alertBolt0", + "alertBolt1", + "alertBolt2", + "alertBolt3", + "alertBolt4", + "alertBolt5", + "alertBolt6", + "alertBolt7", + "alertBolt8", + "alertBolt9" + ], + "pubBoltId": "alertPublishBolt", + "spoutParallelism": 1, + "groupParallelism": 1, + "alertParallelism": 1 + } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments-empty-dedup-field.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments-empty-dedup-field.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments-empty-dedup-field.json index cba4960..f573034 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments-empty-dedup-field.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments-empty-dedup-field.json @@ -1,20 +1,21 @@ [ { - "name":"test-stream-output", - "type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", + "name": "test-stream-output", + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", "policyIds": [ - "perfmon_cpu_host_check", "perfmon_cpu_pool_check" + "perfmon_cpu_host_check", + "perfmon_cpu_pool_check" ], "properties": { - "subject":"Eagle Test Alert", - "template":"", + "subject": "Eagle Test Alert", + "template": "", "sender": "sen...@corp.com", "recipients": "recei...@corp.com", - "smtp.server":"mailhost.com", + "smtp.server": "mailhost.com", "connection": "plaintext", "smtp.port": "25" }, - "dedupIntervalMin" : "PT1M", - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" + "dedupIntervalMin": "PT1M", + "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments.json index 4db6590..82a338d 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/router/publishments.json @@ -1,23 +1,24 @@ [ -{ - "name":"test-stream-output", - "type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "policyIds": [ - "perfmon_cpu_host_check", "perfmon_cpu_pool_check" - ], - "properties": { - "subject":"Eagle Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "recei...@corp.com", - "smtp.server":"mailhost.com", - "connection": "plaintext", - "smtp.port": "25" - }, - "dedupIntervalMin" : "PT1M", - "dedupFields": [ - "appname" - ], - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" -} + { + "name": "test-stream-output", + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", + "policyIds": [ + "perfmon_cpu_host_check", + "perfmon_cpu_pool_check" + ], + "properties": { + "subject": "Eagle Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "recei...@corp.com", + "smtp.server": "mailhost.com", + "connection": "plaintext", + "smtp.port": "25" + }, + "dedupIntervalMin": "PT1M", + "dedupFields": [ + "appname" + ], + "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/sample_perfmon_data.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/sample_perfmon_data.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/sample_perfmon_data.json index c63b9ff..8d1e5fa 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/sample_perfmon_data.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/sample_perfmon_data.json @@ -1,3 +1,10 @@ [ -{"host": "", "timestamp" : "", "metric" : "", "pool": "", "value": 1.0, "colo": "phx"}, + { + "host": "", + "timestamp": "", + "metric": "", + "pool": "", + "value": 1.0, + "colo": "phx" + }, ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/application-integration.conf ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/application-integration.conf b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/application-integration.conf index 3f2fbc3..288d9f9 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/application-integration.conf +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/application-integration.conf @@ -13,16 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. { - "topology" : { - "name" : "alertUnitTopology_1", + "topology": { + "name": "alertUnitTopology_1", "numOfTotalWorkers": 20, - "numOfSpoutTasks" : 1, - "numOfRouterBolts" : 4, - "numOfAlertBolts" : 20, - "numOfPublishTasks" : 1, - "localMode" : "true" + "numOfSpoutTasks": 1, + "numOfRouterBolts": 4, + "numOfAlertBolts": 20, + "numOfPublishTasks": 1, + "localMode": "true" }, - "spout" : { + "spout": { "kafkaBrokerZkQuorum": "127.0.0.1:2181", "kafkaBrokerZkBasePath": "/brokers", "stormKafkaUseSameZkQuorumWithKafkaBroker": true, @@ -32,35 +32,35 @@ "stormKafkaStateUpdateIntervalMs": 2000, "stormKafkaFetchSizeBytes": 1048586, }, - "zkConfig" : { - "zkQuorum" : "127.0.0.1:2181", - "zkRoot" : "/alert", - "zkSessionTimeoutMs" : 10000, - "connectionTimeoutMs" : 10000, - "zkRetryTimes" : 3, - "zkRetryInterval" : 3000 + "zkConfig": { + "zkQuorum": "127.0.0.1:2181", + "zkRoot": "/alert", + "zkSessionTimeoutMs": 10000, + "connectionTimeoutMs": 10000, + "zkRetryTimes": 3, + "zkRetryInterval": 3000 }, - "dynamicConfigSource" : { + "dynamicConfigSource": { "initDelayMillis": 3000, - "delayMillis" : 10000 + "delayMillis": 10000 }, "metadataService": { - "context" : "/rest", - "host" : "localhost", - "port" : 8080 + "context": "/rest", + "host": "localhost", + "port": 8080 }, "coordinatorService": { - "host": "localhost", - "port": "8080", - "context" : "/rest" + "host": "localhost", + "port": "8080", + "context": "/rest" }, "kafkaProducer": { - "bootstrapServers": "127.0.0.1:9092" + "bootstrapServers": "127.0.0.1:9092" }, - "email": { - "sender": "ea...@eagle.com", - "recipients": "t...@eagle.com", - "mail.smtp.host": "test.eagle.com", - "mail.smtp.port": "25" - } + "email": { + "sender": "ea...@eagle.com", + "recipients": "t...@eagle.com", + "mail.smtp.host": "test.eagle.com", + "mail.smtp.port": "25" + } } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/datasources.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/datasources.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/datasources.json index 77a280c..19c70b4 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/datasources.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/datasources.json @@ -1,19 +1,19 @@ [ -{ - "name": "perfmon_datasource", - "type": "KAFKA", - "properties": { - }, - "topic": "perfmon_metrics", - "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", - "codec": { - "streamNameSelectorProp": { - "fieldNamesToInferStreamName" : "metric", - "streamNameFormat":"%s" - }, - "streamNameSelectorCls":"org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", - "timestampColumn": "timestamp", - "timestampFormat":"" - } -} + { + "name": "perfmon_datasource", + "type": "KAFKA", + "properties": { + }, + "topic": "perfmon_metrics", + "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", + "codec": { + "streamNameSelectorProp": { + "fieldNamesToInferStreamName": "metric", + "streamNameFormat": "%s" + }, + "streamNameSelectorCls": "org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", + "timestampColumn": "timestamp", + "timestampFormat": "" + } + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/policies.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/policies.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/policies.json index c214f2c..043d6a8 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/policies.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/policies.json @@ -1,81 +1,81 @@ [ -{ - "name": "perfmon_cpu_host_check", - "description" : "policy to check host perfmon_cpu", - "inputStreams": [ - "perfmon_cpu_stream" - ], - "outputStreams": [ - "perfmon_cpu_check_output" - ], - "definition": { - "type": "siddhi", - "value": "from perfmon_cpu_stream[value > 90.0] select * group by host insert into perfmon_cpu_check_output;" - }, - "partitionSpec": [ - { - "streamId" : "perfmon_cpu_stream", - "type" : "GROUPBY", - "columns" : [ - "host" - ], - "sortSpec": { - "windowPeriod" : "PT1M" - } - } - ] -}, -{ - "name": "perfmon_cpu_pool_check", - "description" : "policy to check pool perfmon_cpu", - "inputStreams": [ - "perfmon_cpu_stream" - ], - "outputStreams": [ - "perfmon_cpu_check_output" - ], - "definition": { - "type": "siddhi", - "value": "from perfmon_cpu_stream[value > 75.0] select * group by pool insert into perfmon_cpu_check_output;" - }, - "partitionSpec": [ - { - "streamId" : "perfmon_cpu_stream", - "type" : "GROUPBY", - "columns" : [ - "pool" - ], - "sortSpec": { - "windowPeriod" : "PT1M" - } - } - ] -}, -{ - "name": "perfmon_cpu_pool_check_2", - "description" : "policy to check pool perfmon_cpu", - "inputStreams": [ - "perfmon_cpu_stream" - ], - "outputStreams": [ - "perfmon_cpu_check_output_2" - ], - "definition": { - "type": "siddhi", - "value": "from perfmon_cpu_stream[value > 90.0] select * group by pool insert into perfmon_cpu_check_output_2;" - }, - "partitionSpec": [ - { - "streamId" : "perfmon_cpu_stream", - "type" : "GROUPBY", - "columns" : [ - "pool" - ], - "sortSpec": { - "windowPeriod" : "PT1M" - } - } - ], - "policyStatus": "DISABLED" -} + { + "name": "perfmon_cpu_host_check", + "description": "policy to check host perfmon_cpu", + "inputStreams": [ + "perfmon_cpu_stream" + ], + "outputStreams": [ + "perfmon_cpu_check_output" + ], + "definition": { + "type": "siddhi", + "value": "from perfmon_cpu_stream[value > 90.0] select * group by host insert into perfmon_cpu_check_output;" + }, + "partitionSpec": [ + { + "streamId": "perfmon_cpu_stream", + "type": "GROUPBY", + "columns": [ + "host" + ], + "sortSpec": { + "windowPeriod": "PT1M" + } + } + ] + }, + { + "name": "perfmon_cpu_pool_check", + "description": "policy to check pool perfmon_cpu", + "inputStreams": [ + "perfmon_cpu_stream" + ], + "outputStreams": [ + "perfmon_cpu_check_output" + ], + "definition": { + "type": "siddhi", + "value": "from perfmon_cpu_stream[value > 75.0] select * group by pool insert into perfmon_cpu_check_output;" + }, + "partitionSpec": [ + { + "streamId": "perfmon_cpu_stream", + "type": "GROUPBY", + "columns": [ + "pool" + ], + "sortSpec": { + "windowPeriod": "PT1M" + } + } + ] + }, + { + "name": "perfmon_cpu_pool_check_2", + "description": "policy to check pool perfmon_cpu", + "inputStreams": [ + "perfmon_cpu_stream" + ], + "outputStreams": [ + "perfmon_cpu_check_output_2" + ], + "definition": { + "type": "siddhi", + "value": "from perfmon_cpu_stream[value > 90.0] select * group by pool insert into perfmon_cpu_check_output_2;" + }, + "partitionSpec": [ + { + "streamId": "perfmon_cpu_stream", + "type": "GROUPBY", + "columns": [ + "pool" + ], + "sortSpec": { + "windowPeriod": "PT1M" + } + } + ], + "policyStatus": "DISABLED" + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/publishments.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/publishments.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/publishments.json index cd05622..21edd0a 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/publishments.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/publishments.json @@ -1,31 +1,34 @@ [ -{ - "name":"test-stream-output", - "type":"org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "policyIds": [ - "perfmon_cpu_host_check", "perfmon_cpu_pool_check" - ], - "properties": { - "subject":"Eagle Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "servi...@corp.com", - "smtp.server":"smtp.mailhost.com", - "connection": "plaintext", - "smtp.port": "25" - }, - "dedupIntervalMin" : "PT1M", - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" -}, -{ - "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", - "name":"kafka-testAlertStream", - "policyIds": ["perfmon_cpu_host_check"], - "dedupIntervalMin": "PT1M", - "properties":{ - "kafka_broker":"localhost:9092", - "topic":"test_kafka" + { + "name": "test-stream-output", + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", + "policyIds": [ + "perfmon_cpu_host_check", + "perfmon_cpu_pool_check" + ], + "properties": { + "subject": "Eagle Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "servi...@corp.com", + "smtp.server": "smtp.mailhost.com", + "connection": "plaintext", + "smtp.port": "25" + }, + "dedupIntervalMin": "PT1M", + "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" }, - "serializer" : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" -} + { + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", + "name": "kafka-testAlertStream", + "policyIds": [ + "perfmon_cpu_host_check" + ], + "dedupIntervalMin": "PT1M", + "properties": { + "kafka_broker": "localhost:9092", + "topic": "test_kafka" + }, + "serializer": "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer" + } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/streamdefinitions.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/streamdefinitions.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/streamdefinitions.json index d93822e..abfbcf3 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/streamdefinitions.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/streamdefinitions.json @@ -1,44 +1,47 @@ [ -{ - "streamId": "perfmon_cpu_stream", - "dataSource" : "perfmon_datasource", - "description":"the data stream for perfmon cpu metrics", - "validate": false, - "timeseries":false, - "columns": [ - { - "name": "host", - "type" : "STRING", - "defaultValue": "", - "required":true - }, - { - "name": "timestamp", - "type" : "LONG", - "defaultValue": 0, - "required":true - },{ - "name": "metric", - "type" : "STRING", - "defaultValue": "perfmon_cpu", - "required": true - },{ - "name": "pool", - "type" : "STRING", - "defaultValue": "raptor_general", - "required":true - },{ - "name": "value", - "type" : "DOUBLE", - "defaultValue": 0.0, - "required":true - }, - { - "name": "colo", - "type" : "STRING", - "defaultValue": "", - "required":true - } - ] -} + { + "streamId": "perfmon_cpu_stream", + "dataSource": "perfmon_datasource", + "description": "the data stream for perfmon cpu metrics", + "validate": false, + "timeseries": false, + "columns": [ + { + "name": "host", + "type": "STRING", + "defaultValue": "", + "required": true + }, + { + "name": "timestamp", + "type": "LONG", + "defaultValue": 0, + "required": true + }, + { + "name": "metric", + "type": "STRING", + "defaultValue": "perfmon_cpu", + "required": true + }, + { + "name": "pool", + "type": "STRING", + "defaultValue": "raptor_general", + "required": true + }, + { + "name": "value", + "type": "DOUBLE", + "defaultValue": 0.0, + "required": true + }, + { + "name": "colo", + "type": "STRING", + "defaultValue": "", + "required": true + } + ] + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/topologies.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/topologies.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/topologies.json index 984fcdb..7417934 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/topologies.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/simple/topologies.json @@ -1,41 +1,41 @@ [ -{ - "name": "alertUnitTopology_1", - "numOfSpout":1, - "numOfAlertBolt": 20, - "numOfGroupBolt": 4, - "spoutId": "alertEngineSpout", - "groupNodeIds" : [ - "streamRouterBolt0", - "streamRouterBolt1", - "streamRouterBolt2", - "streamRouterBolt3" - ], - "alertBoltIds": [ - "alertBolt0", - "alertBolt1", - "alertBolt2", - "alertBolt3", - "alertBolt4", - "alertBolt5", - "alertBolt6", - "alertBolt7", - "alertBolt8", - "alertBolt9", - "alertBolt10", - "alertBolt11", - "alertBolt12", - "alertBolt13", - "alertBolt14", - "alertBolt15", - "alertBolt16", - "alertBolt17", - "alertBolt18", - "alertBolt19" - ], - "pubBoltId" : "alertPublishBolt", - "spoutParallelism": 1, - "groupParallelism": 1, - "alertParallelism": 1 -} + { + "name": "alertUnitTopology_1", + "numOfSpout": 1, + "numOfAlertBolt": 20, + "numOfGroupBolt": 4, + "spoutId": "alertEngineSpout", + "groupNodeIds": [ + "streamRouterBolt0", + "streamRouterBolt1", + "streamRouterBolt2", + "streamRouterBolt3" + ], + "alertBoltIds": [ + "alertBolt0", + "alertBolt1", + "alertBolt2", + "alertBolt3", + "alertBolt4", + "alertBolt5", + "alertBolt6", + "alertBolt7", + "alertBolt8", + "alertBolt9", + "alertBolt10", + "alertBolt11", + "alertBolt12", + "alertBolt13", + "alertBolt14", + "alertBolt15", + "alertBolt16", + "alertBolt17", + "alertBolt18", + "alertBolt19" + ], + "pubBoltId": "alertPublishBolt", + "spoutParallelism": 1, + "groupParallelism": 1, + "alertParallelism": 1 + } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/application-statecheck.conf ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/application-statecheck.conf b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/application-statecheck.conf index 73e5b30..db14d3c 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/application-statecheck.conf +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/application-statecheck.conf @@ -13,16 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. { - "topology" : { - "name" : "alertUnitTopology_1", + "topology": { + "name": "alertUnitTopology_1", "numOfTotalWorkers": 20, - "numOfSpoutTasks" : 1, - "numOfRouterBolts" : 4, - "numOfAlertBolts" : 10, - "numOfPublishTasks" : 1, - "localMode" : "true" + "numOfSpoutTasks": 1, + "numOfRouterBolts": 4, + "numOfAlertBolts": 10, + "numOfPublishTasks": 1, + "localMode": "true" }, - "spout" : { + "spout": { "kafkaBrokerZkQuorum": "localhost:2181", "kafkaBrokerZkBasePath": "/brokers", "stormKafkaUseSameZkQuorumWithKafkaBroker": true, @@ -32,29 +32,29 @@ "stormKafkaStateUpdateIntervalMs": 2000, "stormKafkaFetchSizeBytes": 1048586, }, - "zkConfig" : { - "zkQuorum" : "localhost:2181", - "zkRoot" : "/alert", - "zkSessionTimeoutMs" : 10000, - "connectionTimeoutMs" : 10000, - "zkRetryTimes" : 3, - "zkRetryInterval" : 3000 + "zkConfig": { + "zkQuorum": "localhost:2181", + "zkRoot": "/alert", + "zkSessionTimeoutMs": 10000, + "connectionTimeoutMs": 10000, + "zkRetryTimes": 3, + "zkRetryInterval": 3000 }, - "dynamicConfigSource" : { + "dynamicConfigSource": { "initDelayMillis": 3000, - "delayMillis" : 10000 + "delayMillis": 10000 }, "metadataService": { - "context" : "/rest", - "host" : "localhost", - "port" : 8080 + "context": "/rest", + "host": "localhost", + "port": 8080 }, "coordinatorService": { - "host": "localhost", - "port": "8080", - "context" : "/rest" + "host": "localhost", + "port": "8080", + "context": "/rest" }, "kafkaProducer": { - "bootstrapServers": "localhost:9092" + "bootstrapServers": "localhost:9092" } } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/datasources.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/datasources.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/datasources.json index 77a280c..19c70b4 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/datasources.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/datasources.json @@ -1,19 +1,19 @@ [ -{ - "name": "perfmon_datasource", - "type": "KAFKA", - "properties": { - }, - "topic": "perfmon_metrics", - "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", - "codec": { - "streamNameSelectorProp": { - "fieldNamesToInferStreamName" : "metric", - "streamNameFormat":"%s" - }, - "streamNameSelectorCls":"org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", - "timestampColumn": "timestamp", - "timestampFormat":"" - } -} + { + "name": "perfmon_datasource", + "type": "KAFKA", + "properties": { + }, + "topic": "perfmon_metrics", + "schemeCls": "org.apache.eagle.alert.engine.scheme.JsonScheme", + "codec": { + "streamNameSelectorProp": { + "fieldNamesToInferStreamName": "metric", + "streamNameFormat": "%s" + }, + "streamNameSelectorCls": "org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector", + "timestampColumn": "timestamp", + "timestampFormat": "" + } + } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/topologies.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/topologies.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/topologies.json index 411cc48..c13eeb2 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/topologies.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/statecheck/topologies.json @@ -1,31 +1,31 @@ [ -{ - "name": "alertUnitTopology_1", - "numOfSpout":1, - "numOfAlertBolt": 10, - "numOfGroupBolt": 4, - "spoutId": "alertEngineSpout", - "groupNodeIds" : [ - "streamRouterBolt0", - "streamRouterBolt1", - "streamRouterBolt2", - "streamRouterBolt3" - ], - "alertBoltIds": [ - "alertBolt0", - "alertBolt1", - "alertBolt2", - "alertBolt3", - "alertBolt4", - "alertBolt5", - "alertBolt6", - "alertBolt7", - "alertBolt8", - "alertBolt9" - ], - "pubBoltId" : "alertPublishBolt", - "spoutParallelism": 1, - "groupParallelism": 1, - "alertParallelism": 1 -} + { + "name": "alertUnitTopology_1", + "numOfSpout": 1, + "numOfAlertBolt": 10, + "numOfGroupBolt": 4, + "spoutId": "alertEngineSpout", + "groupNodeIds": [ + "streamRouterBolt0", + "streamRouterBolt1", + "streamRouterBolt2", + "streamRouterBolt3" + ], + "alertBoltIds": [ + "alertBolt0", + "alertBolt1", + "alertBolt2", + "alertBolt3", + "alertBolt4", + "alertBolt5", + "alertBolt6", + "alertBolt7", + "alertBolt8", + "alertBolt9" + ], + "pubBoltId": "alertPublishBolt", + "spoutParallelism": 1, + "groupParallelism": 1, + "alertParallelism": 1 + } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd0.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd0.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd0.json index 9ba7adb..3d0d5a2 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd0.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd0.json @@ -5,15 +5,19 @@ "publishments": [ { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "name":"email-testAlertStream", - "policyIds": ["policy1", "policy2", "policy3"], + "name": "email-testAlertStream", + "policyIds": [ + "policy1", + "policy2", + "policy3" + ], "dedupIntervalMin": "PT1M", - "properties":{ - "subject":"UMP Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "recei...@corp.com", - "smtp.server":"mailhost.com", + "properties": { + "subject": "UMP Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "recei...@corp.com", + "smtp.server": "mailhost.com", "connection": "plaintext", "smtp.port": "25" } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd1.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd1.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd1.json index 3974584..0187e8b 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd1.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForAdd1.json @@ -5,27 +5,33 @@ "publishments": [ { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "name":"email-testAlertStream", - "policyIds": ["policy1", "policy2", "policy3"], + "name": "email-testAlertStream", + "policyIds": [ + "policy1", + "policy2", + "policy3" + ], "dedupIntervalMin": "PT1M", - "properties":{ - "subject":"UMP Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "recei...@corp.com", - "smtp.server":"mailhost.com", + "properties": { + "subject": "UMP Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "recei...@corp.com", + "smtp.server": "mailhost.com", "connection": "plaintext", "smtp.port": "25" } }, { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", - "name":"kafka-testAlertStream", - "policyIds": ["testPolicy"], + "name": "kafka-testAlertStream", + "policyIds": [ + "testPolicy" + ], "dedupIntervalMin": "PT1M", - "properties":{ - "kafka_broker":"sandbox.hortonworks.com:6667", - "topic":"test_kafka" + "properties": { + "kafka_broker": "sandbox.hortonworks.com:6667", + "topic": "test_kafka" } } ] http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForMdyValue.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForMdyValue.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForMdyValue.json index 4e1df83..6fa99d6 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForMdyValue.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishForMdyValue.json @@ -5,15 +5,20 @@ "publishments": [ { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "name":"email-testAlertStream", - "policyIds": ["policy1", "policy2", "policy3", "policy_MdyValue"], + "name": "email-testAlertStream", + "policyIds": [ + "policy1", + "policy2", + "policy3", + "policy_MdyValue" + ], "dedupIntervalMin": "PT1M", - "properties":{ - "subject":"UMP Test Alert", - "template":"", - "sender": "sen...@corp.com", - "recipients": "recei...@corp.com", - "smtp.server":"mailhost.com", + "properties": { + "subject": "UMP Test Alert", + "template": "", + "sender": "sen...@corp.com", + "recipients": "recei...@corp.com", + "smtp.server": "mailhost.com", "connection": "plaintext", "smtp.port": "25" } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json index 66b3852..70ea6b3 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec.json @@ -5,8 +5,12 @@ "publishments": [ { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "name":"email-testAlertStream", - "policyIds": ["policy1", "policy2", "policy3"], + "name": "email-testAlertStream", + "policyIds": [ + "policy1", + "policy2", + "policy3" + ], "dedupIntervalMin": "PT1M", "properties": { "subject": "Test Alert", @@ -22,15 +26,15 @@ "mail.smtp.port": "587" } } -/* { - "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", - "name":"kafka-testAlertStream", - "policyIds": ["testPolicy"], - "dedupIntervalMin": "PT1M", - "properties":{ - "kafka_broker":"sandbox.hortonworks.com:6667", - "topic":"test_kafka" - } - }*/ + /* { + "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", + "name":"kafka-testAlertStream", + "policyIds": ["testPolicy"], + "dedupIntervalMin": "PT1M", + "properties":{ + "kafka_broker":"sandbox.hortonworks.com:6667", + "topic":"test_kafka" + } + }*/ ] } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json index 0108a1e..e14db43 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/resources/testPublishSpec2.json @@ -5,8 +5,10 @@ "publishments": [ { "type": "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher", - "name":"email-testAlertStream", - "policyIds": ["policy1"], + "name": "email-testAlertStream", + "policyIds": [ + "policy1" + ], "dedupIntervalMin": "PT2M", "properties": { "subject": "Test Alert", @@ -22,15 +24,15 @@ "mail.smtp.port": "587" } } -// { -// "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", -// "name":"kafka-testAlertStream", -// "policyIds": ["testPolicy"], -// "dedupIntervalMin": "PT1M", -// "properties":{ -// "kafka_broker":"sandbox.hortonworks.com:6667", -// "topic":"test_kafka" -// } -// } + // { + // "type": "org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher", + // "name":"kafka-testAlertStream", + // "policyIds": ["testPolicy"], + // "dedupIntervalMin": "PT1M", + // "properties":{ + // "kafka_broker":"sandbox.hortonworks.com:6667", + // "topic":"test_kafka" + // } + // } ] } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml index 2cbef7c..0518a15 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml @@ -65,16 +65,16 @@ </dependency> <!--<dependency>--> - <!--<groupId>org.codehaus.jackson</groupId>--> - <!--<artifactId>jackson-mapper-asl</artifactId>--> + <!--<groupId>org.codehaus.jackson</groupId>--> + <!--<artifactId>jackson-mapper-asl</artifactId>--> <!--</dependency>--> <!--<dependency>--> - <!--<groupId>org.codehaus.jackson</groupId>--> - <!--<artifactId>jackson-jaxrs</artifactId>--> + <!--<groupId>org.codehaus.jackson</groupId>--> + <!--<artifactId>jackson-jaxrs</artifactId>--> <!--</dependency>--> <!--<dependency>--> - <!--<groupId>org.codehaus.jackson</groupId>--> - <!--<artifactId>jackson-xc</artifactId>--> + <!--<groupId>org.codehaus.jackson</groupId>--> + <!--<artifactId>jackson-xc</artifactId>--> <!--</dependency>--> <dependency> <groupId>com.fasterxml.jackson.core</groupId> http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java index 1799fa8..5922f20 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java @@ -16,50 +16,39 @@ */ package org.apache.eagle.service.metadata.resource; -import java.util.LinkedList; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; - -import com.google.inject.Inject; import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata; import org.apache.eagle.alert.coordination.model.ScheduleState; import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment; import org.apache.eagle.alert.coordination.model.internal.Topology; -import org.apache.eagle.alert.engine.coordinator.PolicyDefinition; -import org.apache.eagle.alert.engine.coordinator.Publishment; -import org.apache.eagle.alert.engine.coordinator.PublishmentType; -import org.apache.eagle.alert.engine.coordinator.StreamDefinition; -import org.apache.eagle.alert.engine.coordinator.StreamingCluster; +import org.apache.eagle.alert.engine.coordinator.*; import org.apache.eagle.alert.metadata.IMetadataDao; import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory; import org.apache.eagle.alert.metadata.resource.Models; import org.apache.eagle.alert.metadata.resource.OpResult; +import com.google.inject.Inject; + +import java.util.LinkedList; +import java.util.List; +import javax.ws.rs.*; /** - * @since Apr 11, 2016 - * + * @since Apr 11, 2016. */ @Path("/metadata") @Produces("application/json") @Consumes("application/json") public class MetadataResource { -// private IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao(); + // private IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao(); private final IMetadataDao dao; - public MetadataResource(){ - this.dao = MetadataDaoFactory.getInstance().getMetadataDao();; + public MetadataResource() { + this.dao = MetadataDaoFactory.getInstance().getMetadataDao(); + ; } @Inject - public MetadataResource(IMetadataDao dao){ + public MetadataResource(IMetadataDao dao) { this.dao = dao; } @@ -68,7 +57,7 @@ public class MetadataResource { public List<StreamingCluster> listClusters() { return dao.listClusters(); } - + @Path("/clear") @POST public OpResult clear() { @@ -97,7 +86,7 @@ public class MetadataResource { @POST public List<OpResult> addClusters(List<StreamingCluster> clusters) { List<OpResult> results = new LinkedList<>(); - for (StreamingCluster cluster: clusters) { + for (StreamingCluster cluster : clusters) { results.add(dao.addCluster(cluster)); } return results; @@ -113,7 +102,7 @@ public class MetadataResource { @DELETE public List<OpResult> removeClusters(List<String> clusterIds) { List<OpResult> results = new LinkedList<>(); - for (String cluster: clusterIds) { + for (String cluster : clusterIds) { results.add(dao.removeCluster(cluster)); } return results; @@ -135,7 +124,7 @@ public class MetadataResource { @POST public List<OpResult> addStreams(List<StreamDefinition> streams) { List<OpResult> results = new LinkedList<>(); - for (StreamDefinition stream: streams) { + for (StreamDefinition stream : streams) { results.add(dao.createStream(stream)); } return results; @@ -151,7 +140,7 @@ public class MetadataResource { @DELETE public List<OpResult> removeStreams(List<String> streamIds) { List<OpResult> results = new LinkedList<>(); - for (String streamId: streamIds) { + for (String streamId : streamIds) { results.add(dao.removeStream(streamId)); } return results; @@ -173,7 +162,7 @@ public class MetadataResource { @POST public List<OpResult> addDataSources(List<Kafka2TupleMetadata> datasources) { List<OpResult> results = new LinkedList<>(); - for (Kafka2TupleMetadata ds: datasources) { + for (Kafka2TupleMetadata ds : datasources) { results.add(dao.addDataSource(ds)); } return results; @@ -189,7 +178,7 @@ public class MetadataResource { @DELETE public List<OpResult> removeDataSources(List<String> datasourceIds) { List<OpResult> results = new LinkedList<>(); - for (String ds: datasourceIds) { + for (String ds : datasourceIds) { results.add(dao.removeDataSource(ds)); } return results; @@ -211,7 +200,7 @@ public class MetadataResource { @POST public List<OpResult> addPolicies(List<PolicyDefinition> policies) { List<OpResult> results = new LinkedList<>(); - for (PolicyDefinition policy: policies) { + for (PolicyDefinition policy : policies) { results.add(dao.addPolicy(policy)); } return results; @@ -227,7 +216,7 @@ public class MetadataResource { @DELETE public List<OpResult> removePolicies(List<String> policies) { List<OpResult> results = new LinkedList<>(); - for (String policy: policies) { + for (String policy : policies) { results.add(dao.removePolicy(policy)); } return results; @@ -249,7 +238,7 @@ public class MetadataResource { @POST public List<OpResult> addPublishments(List<Publishment> publishments) { List<OpResult> results = new LinkedList<>(); - for (Publishment publishment: publishments) { + for (Publishment publishment : publishments) { results.add(dao.addPublishment(publishment)); } return results; @@ -265,7 +254,7 @@ public class MetadataResource { @DELETE public List<OpResult> removePublishments(List<String> pubIds) { List<OpResult> results = new LinkedList<>(); - for (String pub: pubIds) { + for (String pub : pubIds) { results.add(dao.removePublishment(pub)); } return results; @@ -287,7 +276,7 @@ public class MetadataResource { @POST public List<OpResult> addPublishmentTypes(List<PublishmentType> publishmentTypes) { List<OpResult> results = new LinkedList<>(); - for (PublishmentType pubType: publishmentTypes) { + for (PublishmentType pubType : publishmentTypes) { results.add(dao.addPublishmentType(pubType)); } return results; @@ -303,7 +292,7 @@ public class MetadataResource { @DELETE public List<OpResult> removePublishmentTypes(List<String> pubTypes) { List<OpResult> results = new LinkedList<>(); - for (String pubType: pubTypes) { + for (String pubType : pubTypes) { results.add(dao.removePublishmentType(pubType)); } return results; @@ -355,7 +344,7 @@ public class MetadataResource { @POST public List<OpResult> addTopologies(List<Topology> topologies) { List<OpResult> results = new LinkedList<>(); - for (Topology t: topologies) { + for (Topology t : topologies) { results.add(dao.addTopology(t)); } return results; @@ -371,7 +360,7 @@ public class MetadataResource { @DELETE public List<OpResult> removeTopologies(List<String> topologies) { List<OpResult> results = new LinkedList<>(); - for (String t: topologies) { + for (String t : topologies) { results.add(dao.removeTopology(t)); } return results; http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/TopologyMgmtResource.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/TopologyMgmtResource.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/TopologyMgmtResource.java index 437068f..5626321 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/TopologyMgmtResource.java +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/TopologyMgmtResource.java @@ -22,13 +22,11 @@ import org.apache.eagle.alert.metadata.resource.OpResult; import org.apache.eagle.service.topology.resource.impl.TopologyMgmtResourceImpl; import org.apache.eagle.service.topology.resource.impl.TopologyStatus; -import javax.ws.rs.*; - import java.util.List; +import javax.ws.rs.*; /** - * @since May 5, 2016 - * + * @since May 5, 2016. */ @Path("/alert") @Produces("application/json") http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceHelper.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceHelper.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceHelper.java index 3876116..3c6f5a5 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceHelper.java +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceHelper.java @@ -30,8 +30,8 @@ public class TopologyMgmtResourceHelper { private static final Logger LOG = LoggerFactory.getLogger(TopologyMgmtResourceHelper.class); public static <T> Optional<T> findById(List<T> clusters, String id) { - Optional<T> OptionValue = clusters.stream().filter(o -> getName(o).equalsIgnoreCase(id)).findFirst(); - return OptionValue; + Optional<T> pptionValue = clusters.stream().filter(o -> getName(o).equalsIgnoreCase(id)).findFirst(); + return pptionValue; } public static <T> String getName(T t) { @@ -39,10 +39,10 @@ public class TopologyMgmtResourceHelper { Method m = t.getClass().getMethod("getName"); return (String) m.invoke(t); } catch (NoSuchMethodException | SecurityException | InvocationTargetException | IllegalAccessException - | IllegalArgumentException e) { + | IllegalArgumentException e) { LOG.error(" getName not found on given class :" + t.getClass().getName()); } throw new RuntimeException(String.format("no getName() found on target class %s for matching", t.getClass() - .getName())); + .getName())); } } http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0fc8708/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceImpl.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceImpl.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceImpl.java index f9a6450..1bf810f 100644 --- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceImpl.java +++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/topology/resource/impl/TopologyMgmtResourceImpl.java @@ -18,20 +18,12 @@ package org.apache.eagle.service.topology.resource.impl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; - import org.apache.eagle.alert.coordination.model.internal.Topology; import org.apache.eagle.alert.engine.UnitTopologyMain; -import org.apache.eagle.alert.engine.runner.UnitTopologyRunner; import org.apache.eagle.alert.engine.coordinator.StreamingCluster; -import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory; +import org.apache.eagle.alert.engine.runner.UnitTopologyRunner; import org.apache.eagle.alert.metadata.IMetadataDao; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory; import backtype.storm.Config; import backtype.storm.StormSubmitter; import backtype.storm.generated.Nimbus; @@ -39,38 +31,47 @@ import backtype.storm.generated.StormTopology; import backtype.storm.generated.TopologySummary; import backtype.storm.utils.NimbusClient; import backtype.storm.utils.Utils; - import com.typesafe.config.ConfigFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + public class TopologyMgmtResourceImpl { private static final IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao(); @SuppressWarnings("unused") private static final Logger LOG = LoggerFactory.getLogger(TopologyMgmtResourceImpl.class); - private final String DEFAULT_NIMBUS_HOST = "sandbox.hortonworks.com"; - private final Integer DEFAULT_NIMBUS_THRIFT_PORT = 6627; - private final String STORM_JAR_PATH = "topology.stormJarPath"; + private static final String DEFAULT_NIMBUS_HOST = "sandbox.hortonworks.com"; + private static final Integer DEFAULT_NIMBUS_THRIFT_PORT = 6627; + private static final String STORM_JAR_PATH = "topology.stormJarPath"; - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings( {"rawtypes", "unchecked"}) private Map getStormConf(List<StreamingCluster> clusters, String clusterId) throws Exception { - Map<String, Object> storm_conf = Utils.readStormConfig(); - if(clusterId == null) { - storm_conf.put(Config.NIMBUS_HOST, DEFAULT_NIMBUS_HOST); - storm_conf.put(Config.NIMBUS_THRIFT_PORT, DEFAULT_NIMBUS_THRIFT_PORT); + Map<String, Object> stormConf = Utils.readStormConfig(); + if (clusterId == null) { + stormConf.put(Config.NIMBUS_HOST, DEFAULT_NIMBUS_HOST); + stormConf.put(Config.NIMBUS_THRIFT_PORT, DEFAULT_NIMBUS_THRIFT_PORT); } else { - if(clusters == null) clusters = dao.listClusters(); + if (clusters == null) { + clusters = dao.listClusters(); + } Optional<StreamingCluster> scOp = TopologyMgmtResourceHelper.findById(clusters, clusterId); StreamingCluster cluster; - if(scOp.isPresent()) { + if (scOp.isPresent()) { cluster = scOp.get(); } else { throw new Exception("Fail to find cluster: " + clusterId); } - storm_conf.put(Config.NIMBUS_HOST, cluster.getDeployments().getOrDefault(StreamingCluster.NIMBUS_HOST, DEFAULT_NIMBUS_HOST)); - storm_conf.put(Config.NIMBUS_THRIFT_PORT, Integer.valueOf(cluster.getDeployments().get(StreamingCluster.NIMBUS_THRIFT_PORT))); + stormConf.put(Config.NIMBUS_HOST, cluster.getDeployments().getOrDefault(StreamingCluster.NIMBUS_HOST, DEFAULT_NIMBUS_HOST)); + stormConf.put(Config.NIMBUS_THRIFT_PORT, Integer.valueOf(cluster.getDeployments().get(StreamingCluster.NIMBUS_THRIFT_PORT))); } - return storm_conf; + return stormConf; } private void createTopologyHelper(Topology topologyDef, com.typesafe.config.Config config) { @@ -90,7 +91,7 @@ public class TopologyMgmtResourceImpl { private StormTopology createTopology(Topology topologyDef) { com.typesafe.config.Config topologyConf = ConfigFactory.load("topology-sample-definition.conf"); String stormJarPath = ""; - if(topologyConf.hasPath(STORM_JAR_PATH)) { + if (topologyConf.hasPath(STORM_JAR_PATH)) { stormJarPath = topologyConf.getString(STORM_JAR_PATH); } System.setProperty("storm.jar", stormJarPath); @@ -101,7 +102,7 @@ public class TopologyMgmtResourceImpl { public void startTopology(String topologyName) throws Exception { Optional<Topology> tdop = TopologyMgmtResourceHelper.findById(dao.listTopologies(), topologyName); Topology topologyDef; - if(tdop.isPresent()) { + if (tdop.isPresent()) { topologyDef = tdop.get(); } else { topologyDef = new Topology(); @@ -113,7 +114,7 @@ public class TopologyMgmtResourceImpl { public void stopTopology(String topologyName) throws Exception { Optional<Topology> tdop = TopologyMgmtResourceHelper.findById(dao.listTopologies(), topologyName); Topology topologyDef; - if(tdop.isPresent()) { + if (tdop.isPresent()) { topologyDef = tdop.get(); } else { throw new Exception("Fail to find topology " + topologyName); @@ -122,12 +123,12 @@ public class TopologyMgmtResourceImpl { stormClient.killTopology(topologyName); } - @SuppressWarnings({ "rawtypes", "unused" }) + @SuppressWarnings( {"rawtypes", "unused"}) private TopologySummary getTopologySummery(List<StreamingCluster> clusters, Topology topologyDef) throws Exception { - Map storm_conf = getStormConf(clusters, topologyDef.getClusterName()); - Nimbus.Client stormClient = NimbusClient.getConfiguredClient(storm_conf).getClient(); + Map stormConf = getStormConf(clusters, topologyDef.getClusterName()); + Nimbus.Client stormClient = NimbusClient.getConfiguredClient(stormConf).getClient(); Optional<TopologySummary> tOp = stormClient.getClusterInfo().get_topologies().stream().filter(topology -> topology.get_name().equalsIgnoreCase(topologyDef.getName())).findFirst(); - if(tOp.isPresent()) { + if (tOp.isPresent()) { String id = tOp.get().get_id(); //StormTopology stormTopology= stormClient.getTopology(id); return tOp.get(); @@ -141,9 +142,9 @@ public class TopologyMgmtResourceImpl { List<StreamingCluster> clusters = dao.listClusters(); List<TopologyStatus> topologies = new ArrayList<>(); - for(Topology topologyDef : topologyDefinitions) { + for (Topology topologyDef : topologyDefinitions) { TopologySummary topologySummary = getTopologySummery(clusters, topologyDef); - if(topologySummary != null) { + if (topologySummary != null) { TopologyStatus t = new TopologyStatus(); t.setName(topologySummary.get_name()); t.setId(topologySummary.get_id());