diff --git a/playbooks/example_event.json b/playbooks/example_event.json new file mode 100644 index 0000000..645a1c3 --- /dev/null +++ b/playbooks/example_event.json @@ -0,0 +1,23 @@ +{ + "CompanyID": 24761, + "CurrentState": "n/a", + "Description": "Insight for Through Site Comparison", + "Dimensions": {}, + "EndTime": "2022-11-02 13:50:00 UTC", + "InsightDataSourceType": "ksql", + "InsightID": "k654321097", + "InsightName": "operate.site.bpsThroughWeekOverWeek", + "InsightPlainDescription": "Foobar Amsterdam AMS13 had 22% more through traffic (+139 Kbits/s) this week compared to last week.", + "IsActive": true, + "Links": { + "InsightDetailsURL": "https://portal.kentik.com/v4/operate/insights/k611587433", + "InsightsMainURL": "https://portal.kentik.com/v4/operate/insights", + "InsightsSeverityURL": "https://portal.kentik.com/v4/operate/insights?severities=notice" + }, + "Metrics": {}, + "PreviousState": "n/a", + "StartTime": "2022-11-02 11:50:00 UTC", + "Type": "EVENT_VIEW_TYPE_INSIGHT", + "issue": [], + "statistic": {} +} \ No newline at end of file diff --git a/playbooks/example_playbook.yml b/playbooks/example_playbook.yml new file mode 100644 index 0000000..faf2aca --- /dev/null +++ b/playbooks/example_playbook.yml @@ -0,0 +1,7 @@ +--- +- name: Kentik event-driven-ansible test + hosts: localhost # use for local testing of the plugin + tasks: + - name: Print Kentik alert + ansible.buitlin.debug: + msg: "{{ ansible_eda.event.payload }}" diff --git a/rulebooks/kentik_alert_example_rule.yml b/rulebooks/kentik_alert_example_rule.yml new file mode 100644 index 0000000..7c34ac5 --- /dev/null +++ b/rulebooks/kentik_alert_example_rule.yml @@ -0,0 +1,22 @@ +--- +- name: Listen for alerts using kentik_webhook + hosts: all + + ## Define our source for events + + sources: + - kentik.ansible_eda.kentik_webhook: + host: 0.0.0.0 + port: 80 + + ## Define the conditions we are looking for + + rules: + - name: Say Hello + condition: event.i == 1 + + ## Define the action we should take should the condition be met + + action: + run_playbook: + name: playbooks/example_playbook.yml