@@ -85,8 +85,8 @@ func TestAlertCmd(t *testing.T) {
85
85
args : []string {"run" , "../main.go" , "alert" },
86
86
expected : `[CRITICAL] - 3 Alerts: 1 Firing - 1 Pending - 1 Inactive
87
87
\_ [OK] [HostOutOfMemory] is inactive
88
- \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40
89
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
88
+ \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40 - {"alertname":"SqlAccessDeniedRate","instance":"localhost","job":"mysql","severity":"warning"}
89
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
90
90
|total=3 firing=1 pending=1 inactive=1
91
91
92
92
exit status 2
@@ -100,8 +100,8 @@ exit status 2
100
100
})),
101
101
args : []string {"run" , "../main.go" , "alert" , "--problems" },
102
102
expected : `[CRITICAL] - 2 Alerts: 1 Firing - 1 Pending - 0 Inactive
103
- \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40
104
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
103
+ \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40 - {"alertname":"SqlAccessDeniedRate","instance":"localhost","job":"mysql","severity":"warning"}
104
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
105
105
|total=2 firing=1 pending=1 inactive=0
106
106
107
107
exit status 2
@@ -115,7 +115,7 @@ exit status 2
115
115
})),
116
116
args : []string {"run" , "../main.go" , "alert" , "--problems" , "-g" , "TLS" },
117
117
expected : `[CRITICAL] - 1 Alerts: 1 Firing - 0 Pending - 0 Inactive
118
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
118
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
119
119
|total=1 firing=1 pending=0 inactive=0
120
120
121
121
exit status 2
@@ -129,8 +129,8 @@ exit status 2
129
129
})),
130
130
args : []string {"run" , "../main.go" , "alert" , "--problems" , "-g" , "SQL" , "-g" , "TLS" },
131
131
expected : `[CRITICAL] - 2 Alerts: 1 Firing - 1 Pending - 0 Inactive
132
- \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40
133
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
132
+ \_ [WARNING] [SqlAccessDeniedRate] - Job: [mysql] on Instance: [localhost] is pending - value: 0.40 - {"alertname":"SqlAccessDeniedRate","instance":"localhost","job":"mysql","severity":"warning"}
133
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
134
134
|total=2 firing=1 pending=1 inactive=0
135
135
136
136
exit status 2
@@ -144,7 +144,7 @@ exit status 2
144
144
})),
145
145
args : []string {"run" , "../main.go" , "alert" , "--problems" , "--exclude-alert" , "Sql.*DeniedRate" },
146
146
expected : `[CRITICAL] - 1 Alerts: 1 Firing - 0 Pending - 0 Inactive
147
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
147
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
148
148
|total=1 firing=1 pending=0 inactive=0
149
149
150
150
exit status 2
@@ -196,7 +196,7 @@ exit status 3
196
196
args : []string {"run" , "../main.go" , "alert" , "--name" , "HostOutOfMemory" , "--name" , "BlackboxTLS" },
197
197
expected : `[CRITICAL] - 2 Alerts: 1 Firing - 0 Pending - 1 Inactive
198
198
\_ [OK] [HostOutOfMemory] is inactive
199
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
199
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
200
200
|total=2 firing=1 pending=0 inactive=1
201
201
202
202
exit status 2
@@ -210,7 +210,7 @@ exit status 2
210
210
})),
211
211
args : []string {"run" , "../main.go" , "alert" , "--name" , "HostOutOfMemory" , "--name" , "BlackboxTLS" , "--problems" },
212
212
expected : `[CRITICAL] - 1 Alerts: 1 Firing - 0 Pending - 0 Inactive
213
- \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00
213
+ \_ [CRITICAL] [BlackboxTLS] - Job: [blackbox] on Instance: [https://localhost:443] is firing - value: -6065338.00 - {"alertname":"TLS","instance":"https://localhost:443","job":"blackbox","severity":"critical"}
214
214
|total=1 firing=1 pending=0 inactive=0
215
215
216
216
exit status 2
0 commit comments