mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-17 19:17:07 +00:00
Inhibited indicator in the UI (#838)
* Add inhibited indicator * Update bindata.go
This commit is contained in:
parent
3f60d01592
commit
ffe79ad410
@ -11,3 +11,9 @@ receivers:
|
|||||||
- name: 'webhook'
|
- name: 'webhook'
|
||||||
webhook_configs:
|
webhook_configs:
|
||||||
- url: 'http://127.0.0.1:5001/'
|
- url: 'http://127.0.0.1:5001/'
|
||||||
|
inhibit_rules:
|
||||||
|
- source_match:
|
||||||
|
severity: 'critical'
|
||||||
|
target_match:
|
||||||
|
severity: 'warning'
|
||||||
|
equal: ['alertname', 'dev', 'instance']
|
||||||
|
@ -47,7 +47,16 @@ alerts1='[
|
|||||||
"labels": {
|
"labels": {
|
||||||
"alertname": "DiskRunningFull",
|
"alertname": "DiskRunningFull",
|
||||||
"dev": "sda1",
|
"dev": "sda1",
|
||||||
"instance": "example3"
|
"instance": "example3",
|
||||||
|
"severity": "critical"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labels": {
|
||||||
|
"alertname": "DiskRunningFull",
|
||||||
|
"dev": "sda1",
|
||||||
|
"instance": "example3",
|
||||||
|
"severity": "warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]'
|
]'
|
||||||
|
@ -28,11 +28,14 @@ alertsDecoder =
|
|||||||
-}
|
-}
|
||||||
alertDecoder : Json.Decoder (String -> Alert)
|
alertDecoder : Json.Decoder (String -> Alert)
|
||||||
alertDecoder =
|
alertDecoder =
|
||||||
Json.map5 Alert
|
Json.map6 Alert
|
||||||
(Json.maybe (field "annotations" (Json.keyValuePairs Json.string))
|
(Json.maybe (field "annotations" (Json.keyValuePairs Json.string))
|
||||||
|> andThen (Maybe.withDefault [] >> Json.succeed)
|
|> andThen (Maybe.withDefault [] >> Json.succeed)
|
||||||
)
|
)
|
||||||
(field "labels" (Json.keyValuePairs Json.string))
|
(field "labels" (Json.keyValuePairs Json.string))
|
||||||
(Json.maybe (Json.at [ "status", "silencedBy", "0" ] Json.string))
|
(Json.maybe (Json.at [ "status", "silencedBy", "0" ] Json.string))
|
||||||
|
(Json.maybe (Json.at [ "status", "inhibitedBy", "0" ] Json.string)
|
||||||
|
|> Json.map ((/=) Nothing)
|
||||||
|
)
|
||||||
(field "startsAt" iso8601Time)
|
(field "startsAt" iso8601Time)
|
||||||
(field "generatorURL" Json.string)
|
(field "generatorURL" Json.string)
|
||||||
|
@ -11,6 +11,7 @@ type alias Alert =
|
|||||||
{ annotations : Labels
|
{ annotations : Labels
|
||||||
, labels : Labels
|
, labels : Labels
|
||||||
, silenceId : Maybe String
|
, silenceId : Maybe String
|
||||||
|
, isInhibited : Bool
|
||||||
, startsAt : Time
|
, startsAt : Time
|
||||||
, generatorUrl : String
|
, generatorUrl : String
|
||||||
, id : String
|
, id : String
|
||||||
|
@ -9,7 +9,6 @@ import Utils.Date
|
|||||||
import Views.FilterBar.Types as FilterBarTypes
|
import Views.FilterBar.Types as FilterBarTypes
|
||||||
import Views.AlertList.Types exposing (AlertListMsg(MsgForFilterBar, SetActive))
|
import Views.AlertList.Types exposing (AlertListMsg(MsgForFilterBar, SetActive))
|
||||||
import Utils.Filter
|
import Utils.Filter
|
||||||
import Time exposing (Time)
|
|
||||||
|
|
||||||
|
|
||||||
view : List ( String, String ) -> Maybe String -> Alert -> Html Msg
|
view : List ( String, String ) -> Maybe String -> Alert -> Html Msg
|
||||||
@ -27,7 +26,7 @@ view labels maybeActiveId alert =
|
|||||||
]
|
]
|
||||||
[ div
|
[ div
|
||||||
[ class "w-100 mb-2 d-flex align-items-start" ]
|
[ class "w-100 mb-2 d-flex align-items-start" ]
|
||||||
[ dateView alert.startsAt
|
[ titleView alert
|
||||||
, if List.length alert.annotations > 0 then
|
, if List.length alert.annotations > 0 then
|
||||||
annotationsButton maybeActiveId alert
|
annotationsButton maybeActiveId alert
|
||||||
else
|
else
|
||||||
@ -43,13 +42,24 @@ view labels maybeActiveId alert =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
dateView : Time -> Html Msg
|
titleView : Alert -> Html Msg
|
||||||
dateView time =
|
titleView { startsAt, isInhibited } =
|
||||||
span
|
let
|
||||||
[ class "text-muted align-self-center mr-2"
|
( className, inhibited ) =
|
||||||
]
|
if isInhibited then
|
||||||
[ text (Utils.Date.timeFormat time ++ ", " ++ Utils.Date.dateFormat time)
|
( "text-muted", " (inhibited)" )
|
||||||
]
|
else
|
||||||
|
( "", "" )
|
||||||
|
in
|
||||||
|
span
|
||||||
|
[ class ("align-self-center mr-2 " ++ className) ]
|
||||||
|
[ text
|
||||||
|
(Utils.Date.timeFormat startsAt
|
||||||
|
++ ", "
|
||||||
|
++ Utils.Date.dateFormat startsAt
|
||||||
|
++ inhibited
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
annotationsButton : Maybe String -> Alert -> Html Msg
|
annotationsButton : Maybe String -> Alert -> Html Msg
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user