The Notifier API was renamed to the Action API. However, in the actual API, no renaming has been done so far.
GET /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers
Example:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/sandbox/alertnotifiers \
-H "Authorization: Bearer $TOKEN"
GET /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers/$ID
Example:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/sandbox/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj \
-H "Authorization: Bearer $TOKEN"
POST /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers
Params:
name
— stringentity
— string — EmailNotifier, HumioRepoNotifier, OpsGenieNotifier, PagerDutyNotifier, SlackNotifier, SlackPostMessageNotifier, VictorOpsNotifier, WebHookNotifierproperties
:
recipients
— array — array of email address stringssubjectTemplate
— stringbodyTemplate
— stringuseProxy
— booleaningestToken
— stringapiUrl
— stringgenieKey
— stringuseProxy
— booleanseverity
— string — critical, error, warning, inforoutingKey
— stringuseProxy
— booleanurl
— stringfields
— map(string, string)useProxy
— booleanapiToken
— stringchannels
— array — array of Slack channel stringsfields
— map(string, string)useProxy
— booleanmessageType
— stringnotifyUrl
— stringuseProxy
— booleanurl
— stringmethod
— string — GET, HEAD, OPTIONS, PATCH, POST, PUTheaders
— map(string, string)bodyTemplate
— stringignoreSSL
— booleanuseProxy
— booleanExample:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/sandbox/alertnotifiers \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"test", "entity": "WebHookNotifier", "properties": {"url":"http://example.com", "method":"POST", "headers": {"Content-Type":"application/json"}, "bodyTemplate":"{\n \"repository\": \"{repo_name}\",\n \"timestamp\": \"{alert_triggered_timestamp}\",\n \"alert\": {\n \"name\": \"{alert_name}\",\n \"description\": \"{alert_description}\",\n \"query\": {\n \"queryString\": \"{query_string} \",\n \"end\": \"{query_time_end}\",\n \"start\": \"{query_time_start}\"\n },\n \"notifierID\": \"{alert_notifier_id}\",\n \"id\": \"{alert_id}\"\n },\n \"warnings\": \"{warnings}\",\n \"events\": {events},\n \"numberOfEvents\": {event_count}\n}",
"ignoreSSL":true, "useProxy":true}}'
PUT /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers/$ID
Params:
name
— stringentity
— string — EmailNotifier, HumioRepoNotifier, OpsGenieNotifier, PagerDutyNotifier, SlackNotifier, SlackPostMessageNotifier, VictorOpsNotifier, WebHookNotifierproperties
:
recipients
— array — array of email address stringssubjectTemplate
— stringbodyTemplate
— stringuseProxy
— booleaningestToken
— stringapiUrl
— stringgenieKey
— stringuseProxy
— booleanseverity
— string — critical, error, warning, inforoutingKey
— stringuseProxy
— booleanurl
— stringfields
— map(string, string)useProxy
— booleanapiToken
— stringchannels
— array — array of Slack channel stringsfields
— map(string, string)useProxy
— booleanmessageType
— stringnotifyUrl
— stringuseProxy
— booleanurl
— stringmethod
— string — GET, HEAD, OPTIONS, PATCH, POST, PUTheaders
— map(string, string)bodyTemplate
— stringignoreSSL
— booleanuseProxy
— booleanExample:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/sandbox/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj \
-X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"test", "entity": "WebHookNotifier", "properties": {"url":"http://example.com", "method":"POST", "headers": {"Content-Type":"application/json"}, "bodyTemplate":"{\n \"repository\": \"{repo_name}\",\n \"timestamp\": \"{alert_triggered_timestamp}\",\n \"alert\": {\n \"name\": \"{alert_name}\",\n \"description\": \"{alert_description}\",\n \"query\": {\n \"queryString\": \"{query_string} \",\n \"end\": \"{query_time_end}\",\n \"start\": \"{query_time_start}\"\n },\n \"notifierID\": \"{alert_notifier_id}\",\n \"id\": \"{alert_id}\"\n },\n \"warnings\": \"{warnings}\",\n \"events\": {events},\n \"numberOfEvents\": {event_count}\n}",
"ignoreSSL":true, "useProxy":true}}'
DELETE /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers/$ID
Example:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/$REPOSITORY_NAME/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj \
-X DELETE \
-H "Authorization: Bearer $TOKEN"
POST /api/v1/repositories/$REPOSITORY_NAME/alertnotifiers/$ID/test
Params:
alertName
— stringevents
— array — array of Humio log eventsExample:
curl http://$YOUR_HUMIO_URL/api/v1/repositories/sandbox/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj/test \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"alertName":"testAlertName", events: [{"@timestamp": 0, "@timezone": "Z", "#host": "TestHost"}]}'