Development in IDE
In IDE, configure the following main class and program arguments
org.apache.eagle.server.ServerMain server src/main/resources/configuration.yml
http://localhost:9090/rest/sites POST
{
"siteId" : "testsite",
"siteName" :"testsite",
"description" : "test description",
"context" : {}
}
###n2.2 Create logic alert engine topology
http://localhost:9090/rest/metadata/topologies POST
{
"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
}
Please reference eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml for complete configuration.
http://localhost:9090/rest/apps/install POST
{
"siteId" : "testsite",
"appType" : "AlertUnitTopologyApp",
"mode" : "LOCAL",
"configuration" : {
}
}
http://localhost:9090/rest/apps/install POST
{
"siteId" : "sandbox",
"appType" : "TopologyHealthCheckApplication",
"mode" : "LOCAL",
"configuration" : {
"dataSourceConfig.topic" :"topology_health_check"}
}
## 4 Check
### 4.1 Check if alert data source is created
http://localhost:9090/rest/metadata/datasources GET
### 4.2 Check if alert stream is creatd
http://localhost:9090/rest/metadata/streams GET
## 5 Create alert policy and verify alert
### 5.1 create one policy
http://localhost:9090/rest/metadata/policies POST
{ “name”: “hdfsPolicy”, “description”: “hdfsPolicy”, “inputStreams”: [ “topology_health_check_stream” ], “outputStreams”: [ “topology_health_check_stream_out” ], “definition”: { “type”: “siddhi”, “value”: “from TOPOLOGY_HEALTH_CHECK_STREAM_SANDBOX[status==‘live’] select * insert into topology_health_check_stream_out” }, “partitionSpec”: [ { “streamId”: “topology_health_check_stream”, “type”: “GROUPBY”, “columns” : [ “host” ] } ], “parallelismHint”: 2 }
### 5.2 Create alert publishment
{ “name”:“topology_health_check_stream_out”, “type”:“org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher”, “policyIds”: [ “hdfsPolicy” ], “properties”: { “subject”:“alert when user is hadoop”, “template”:"", “sender”: “abc@bcd.com”, “recipients”: “abc@bcd.com”, “mail.smtp.host”:“abc@bcd.com”, “connection”: “plaintext”, “mail.smtp.port”: “25” }, “dedupIntervalMin” : “PT1M”, “serializer” : “org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer” }
### 5.3 Send message and verify alert ./kafka-console-producer.sh --topic topology_health_check --broker-list sandbox.hortonworks.com:6667