Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

alert api #27

Open
ewilde opened this issue Mar 2, 2018 · 0 comments
Open

alert api #27

ewilde opened this issue Mar 2, 2018 · 0 comments

Comments

@ewilde
Copy link

ewilde commented Mar 2, 2018

The alert api doesn't seem to work on my account. It doesn't mention in the readme that i need a special licence.

I've tried the following uris, they all return 404

https://app-eu.logz.io/v1/alerts
https://app-eu.logz.io/alerts    <- path from swagger file

Interestingly /triggers/alerts works but the data structure is not the same as the swagger file

[
    {
        "id": 123,
        "name": "Test errors",
        "description": "",
        "enabled": true,
        "search": {
            "queryString": "(level:\"ERROR\" OR level:\"FATAL\") AND environment:test",
            "filter": "{\"bool\":{\"must\":[],\"must_not\":[]}}",
            "groupBy": [],
            "periodInMinutes": 5,
            "source": {
                "allTimelessIndices": false,
                "timelessIndices": [],
                "allSubAccounts": true,
                "subAccountsIds": []
            },
            "metricsAggregations": []
        },
        "triggerOn": {
            "type": "CONDITION",
            "aggregation": {
                "aggregationType": "NONE",
                "fieldToAggregateOn": null
            },
            "comparisonOperator": "GREATER_THAN",
            "threshold": 0,
            "severities": [
                {
                    "severity": "MEDIUM",
                    "threshold": 0
                }
            ]
        },
        "output": {
            "format": {
                "type": "TABLE",
                "sortBy": null,
                "sortOrder": "DESC",
                "fieldsConfig": "[{\"name\":\"stack\",\"data\":\"\"},{\"name\":\"level\",\"data\":\"\"},{\"name\":\"service_name\",\"data\":\"\"},{\"name\":\"message\",\"data\":\"\"}]"
            },
            "target": {
                "severity": "MEDIUM",
                "emailNotifications": "{\"notifications\":[]}",
                "notificationEndpoints": [
                    {
                        "id": 123,
                        "accountId": xx,
                        "type": "HTTP",
                        "templateName": "Slack",
                        "description": null,
                        "title": "Test errors",
                        "createdDate": 1500299065000,
                        "modifiedDate": 1516189356000,
                        "params": {
                            "url": "https://hooks.slack.com/services/xxx",
                            "method": "POST",
                            "headers": null,
                            "bodyTemplate": {
                                "icon_url": "https://s3.amazonaws.com/logzio-static-content-cdn/logzio-logo.png",
                                "username": "Logz.io Alerts",
                                "attachments": [
                                    {
                                        "author_name": "{{&alert_severity}} severity",
                                        "author_icon": "https://s3.amazonaws.com/logzio-static-content-cdn/slack/{{&alert_severity_img}}.png",
                                        "fallback": "{{&alert_severity}}: {{&alert_title}}",
                                        "title": "{{&alert_title}}",
                                        "title_link": "{{&alert_app_url}}#/dashboard/alerts/definitions?switchToAccountId={{&account_id}}",
                                        "pretext": "An alert has been triggered due to an event in your {{&account_name}} account.",
                                        "text": "{{&alert_description}}",
                                        "footer": "{{&alert_timeframe_start}} to {{&alert_timeframe_end}} (UTC)",
                                        "color": "#008ab1"
                                    },
                                    {
                                        "color": "#008ab1",
                                        "fields": [
                                            {
                                                "title": "{{^alert_event_image}}Alert event samples{{/alert_event_image}}",
                                                "value": "{{^alert_event_image}}{{^alert_event_samples}}No event samples available{{/alert_event_samples}}{{&alert_event_samples}}{{/alert_event_image}}",
                                                "short": false
                                            }
                                        ],
                                        "image_url": "{{&alert_event_image}}"
                                    },
                                    {
                                        "fields": [
                                            {
                                                "value": "{{#alert_event_html}}<{{&alert_event_html}}|Open full view>{{/alert_event_html}}",
                                                "short": false
                                            },
                                            {
                                                "value": "<{{&alert_app_url}}#/dashboard/alerts/view-alert-in-kibana?eventTimestamp={{&alert_event_timestamp}}&timeRangeInMinutes={{&alert_time_range_in_millis}}&alertDefinitionId={{&alert_definition_id}}&switchToAccountId={{&account_id}}|View in Kibana>",
                                                "short": false
                                            }
                                        ],
                                        "color": "#008ab1"
                                    }
                                ]
                            }
                        },
                        "internal_type": "HTTP"
                    }
                ],
                "suppressNotificationInMinutes": 60,
                "timelessIndex": null
            }
        },
        "lastUpdatedOn": null
    },
]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant