Application Event Ingestion
Contrail Insights can ingest events from a registered application and perform alarms on them. You can register an application with Contrail Insights and specify the event IDs for which the application will be posting data. Upon successful registration, a token is given to the application. The application uses that token to post events to Contrail Insights for any of the event IDs registered. Alarms can be configured for these events.
Register an Application
To register an application:
Select Settings in the top right of the Dashboard.
Figure 1: Select Settings in the DashboardSelect AppFormix Settings, then click the Registered Applications tab. Click Add Application.
Provide the Application Name and add all the Application Event IDs for which the application will be posting data by clicking +Add Event. Then click Setup.
Figure 2: AppFormix Settings for Adding an Application and Application Event IDsThe Application appears as successfully added. It can be deleted by clicking the Trash icon.
Figure 3: Successfully Added Application
Application registration can also be achieved using the API:
Request:
url:
POST http://<appformix_controller:port>/appformix/v1.0/application_registration
headers:
"Content-Type": application/json, "X-Auth-Token": <>, (required) "X-Auth-Type": <> (required)
data:
{ "ApplicationName": "fluentd", "ApplicationEventIds": ["disk_capacity", "invalid_user_login_attempt"] }
Response:
{ "ApplicationName": "fluentd", "ApplicationId": "567854a8-a9ea-11e9-ab42-0242ac120005", "ApplicationToken": "abc8902cd17459fe73839494bde39310506380220" "ApplicationEventIds": ["disk_capacity", "invalid_user_login_attempt"] }
Post Events for a Registered Application
After an application is configured, it can post events to Contrail Insights.
The data should be in the following format:
Request:
url:
POST http://<appformix_controller:port>/appformix/v1.0/analytics/application_event
headers:
{ "Content-Type": application/json, "X-Auth-Token": <>, (required, provide the ApplicationToken) "X-Auth-Type": 'appformix' (required) }
data:
{ "ApplicationId": "567854a8-a9ea-11e9-ab42-0242ac120005", "EventId": "disk_capacity", # One of the event IDs registered for the application "Metric": 80, "Metadata": { <variable dictionary, not used for alarming> } }
Response:
status code:
200: Success 401: Authentication failure(ApplicationToken Missing/Invalid)
All the posted events are displayed on the UI in the Application Events page. From this page, in the right panel, select any application to toggle the displaying and hiding of events from that application.
Alarms for Application Events
Alarms can be configured for any of the event IDs registered for the application.
Alarm configuration using the API:
url:
POST http://<appformix_controller:port>/appformix/v1.0/analytics/application_event
data:
{ "Name": "fluentd_disk_capacity", "ApplicationId": "567854a8-a9ea-11e9-ab42-0242ac120005", "MetricType": "disk_capacity", "AggregationFunction": "max", "ComparisonFunction": "above", "Threshold": 95, # This value compared to "Metric" in an event "IntervalsWithException": 1, "IntervalDuration": "60s", "IntervalCount": 1, "Mode": "alert", "Severity": "warning", "EventRuleScope": "application_events", "CreatedBy": "user", "DisplayEvent": true, "Module": "alarms", "EventRuleType": "static", "EntityType":"" }
When the threshold configured in the alarm is exceeded, the triggered alarm is shown on the Alarms page in the UI.
The alarm is also sent to Kafka with the topic being the alarm's name. For more information, see Contrail Insights with Kafka.