@@ -85,8 +85,8 @@ func TestAlertCmd(t *testing.T) {
8585 args : []string {"run" , "../main.go" , "alert" },
8686 expected : `[CRITICAL] - 3 Alerts: 1 Firing - 1 Pending - 1 Inactive
8787\_ [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"}
9090|total=3 firing=1 pending=1 inactive=1
9191
9292exit status 2
@@ -100,8 +100,8 @@ exit status 2
100100 })),
101101 args : []string {"run" , "../main.go" , "alert" , "--problems" },
102102 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"}
105105|total=2 firing=1 pending=1 inactive=0
106106
107107exit status 2
@@ -115,7 +115,7 @@ exit status 2
115115 })),
116116 args : []string {"run" , "../main.go" , "alert" , "--problems" , "-g" , "TLS" },
117117 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"}
119119|total=1 firing=1 pending=0 inactive=0
120120
121121exit status 2
@@ -129,8 +129,8 @@ exit status 2
129129 })),
130130 args : []string {"run" , "../main.go" , "alert" , "--problems" , "-g" , "SQL" , "-g" , "TLS" },
131131 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"}
134134|total=2 firing=1 pending=1 inactive=0
135135
136136exit status 2
@@ -144,7 +144,7 @@ exit status 2
144144 })),
145145 args : []string {"run" , "../main.go" , "alert" , "--problems" , "--exclude-alert" , "Sql.*DeniedRate" },
146146 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"}
148148|total=1 firing=1 pending=0 inactive=0
149149
150150exit status 2
@@ -196,7 +196,7 @@ exit status 3
196196 args : []string {"run" , "../main.go" , "alert" , "--name" , "HostOutOfMemory" , "--name" , "BlackboxTLS" },
197197 expected : `[CRITICAL] - 2 Alerts: 1 Firing - 0 Pending - 1 Inactive
198198\_ [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"}
200200|total=2 firing=1 pending=0 inactive=1
201201
202202exit status 2
@@ -210,7 +210,7 @@ exit status 2
210210 })),
211211 args : []string {"run" , "../main.go" , "alert" , "--name" , "HostOutOfMemory" , "--name" , "BlackboxTLS" , "--problems" },
212212 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"}
214214|total=1 firing=1 pending=0 inactive=0
215215
216216exit status 2
0 commit comments