pai icon indicating copy to clipboard operation
pai copied to clipboard

API for user related alerts

Open suiguoxin opened this issue 4 years ago • 0 comments

Design

API: GET api/v2/alerts

Response: 200

[
        {
            "labels": {
                "alertname": "NodeFilesystemUsage",
                "severity": "warn"
                ...
            },
            "annotations": {
                "summary": "Free space in /dev/sdc1 from 10.151.40.40:9100 is less than 20% (current value is: 4.967095016467968)"
            },
            "startsAt": "2021-03-16T02:41:46.9532588Z",
            "endsAt": "2021-03-31T03:18:46.9651152Z",
            "generatorURL": "http://...",
            "status": {
                "state": "active",
                "silencedBy": [],
                "inhibitedBy": []
            },
            ...
        }
    ]

Implementation

  • API for all prometheus alerts: /alert-manager/api/v1/alerts?silenced=false
  • if user is admin: return all alerts
  • else: return only the alerts related to the user's jobs

suiguoxin avatar Mar 31 '21 03:03 suiguoxin