Last active
November 27, 2015 15:36
-
-
Save pavolloffay/85aad62884c74588b260 to your computer and use it in GitHub Desktop.
Hawkular Alerts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Plugins are for example email, sms, irc, snmp... Needs to be deployd as war in the Alerts. | |
| # Actions are instancies of action Plugins. This actions can be assigned to Triggers. Examples of actions - send email to admin, send sms to CEO, | |
| # Trigger has multiple Conditions, based on this condition Action is carried out (send email, create file) | |
| # Alert is created when conditions are met. | |
| # Standalone mode | |
| mvn clean install -Pstandalone | |
| hawkular-alerts-rest-tests/target/wildfly-9.0.1.Final/bin/standalone.sh --debug -Dhawkular.backend=embedded_cassandra | |
| -H 'Hawkular-Tenant: xmen' | |
| # Alerts | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://jdoe:password@localhost:8080/hawkular/alerts/' | jq '' | |
| delete all alerts | |
| curl -ivX PUT -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/delete' | |
| # Triggers | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/triggers' | jq '' | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/triggers/testTrigger' | jq '' | |
| match = ALL|ANY, = AND|OR | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/triggers' -d '{"id": "testTrigger", "name":"Xmens Test trigger", "enabled":"true", "description": "Test trigger", "actions":{"file" : ["testFileAction"]}}' | |
| curl -ivX PUT -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/triggers/testTrigger' -d '{"enabled": "true"}' | |
| Add action | |
| curl -ivX PUT -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/triggers/testTrigger' -d '{"enabled": "true", "actions":{"file" : ["testFileAction"], "email": ["testEmailAction"]}}' | |
| # Conditions | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/triggers/testTrigger/conditions' | jq '' | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type:application/json' 'http://localhost:8080/hawkular/alerts/triggers/testTrigger/conditions' -d '{"type": "threshold", "dataId": "testData", "threshold": 10, "operator": "GT"}' | |
| # Plugins (actions) | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/plugins' | jq '' | |
| get configurable properties of plugin | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/plugins/email' | jq '' | |
| # Actions - file, mail... | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/actions' | jq '' | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/actions/plugin/email' | jq '' | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/actions/email/testEmailAction' | jq '' | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/actions' -d '{"actionPlugin": "file", "actionId": "testFileAction"}' | |
| Files are stored under hawkular/alerts/actions/file | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/actions' -d '{"actionPlugin": "email", "actionId": "testEmailAction", "to": "user@gmail.com", "description": "Test Alert Email"}' | |
| Smtp server is configured in standalone.xml | |
| curl -ivX PUT -H 'Hawkular-Tenant: xmen' -H "Content-Type: application/json" 'http://localhost:8080/hawkular/alerts/actions/email/testEmailAction' -d '{"cc": "cc@cc.cc"}' | |
| curl -ivX DELETE -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/actions/email/testEmailAction' | |
| # Data | |
| thi should generate alert | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type:application/json' 'http://localhost:8080/hawkular/alerts/data' -d '[{"timestamp": 12, "value": 11, "id": "testData"}]' | |
| # Events | |
| filtering | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/events' | jq '' | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/events/event/testEvent' | jq '' | |
| category should be: ALERT, DEPLOYMENT, LOG, TRIGGER | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/events' -d '{"category": "trigger","id": "testEvent","text": "hola"}' | |
| with testTrigger | |
| curl -ivX POST -H 'Hawkular-Tenant: xmen' -H 'Content-Type: application/json' 'http://localhost:8080/hawkular/alerts/events' -d '{"category": "triggerko", "id": "testEvent2", "text": "hello", "trigger": {"id": "testTrigger"}}' | |
| curl -X GET -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/events/event/testEvent' | jq '' | |
| curl -ivX DELETE -H 'Hawkular-Tenant: xmen' 'http://localhost:8080/hawkular/alerts/events/testEvent' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment