Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 1 | varnishtest "Check health-check email alerts" |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 2 | #REQUIRE_OPTIONS=LUA |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 3 | |
| 4 | feature ignore_unknown_macro |
| 5 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 6 | syslog S1 -level notice { |
| 7 | recv |
Christopher Faulet | 91c3baa | 2022-09-12 09:58:47 +0200 | [diff] [blame^] | 8 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN." |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 9 | recv info |
| 10 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Result=SUCCESS Bytes=[[:digit:]]+" |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 11 | } -start |
| 12 | |
| 13 | haproxy h1 -conf { |
| 14 | global |
Frédéric Lécaille | b894f92 | 2019-03-29 16:13:48 +0100 | [diff] [blame] | 15 | lua-load ${testdir}/healthcheckmail.lua |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 16 | |
| 17 | defaults |
| 18 | timeout client 1s |
| 19 | timeout server 1s |
| 20 | timeout connect 1s |
| 21 | |
| 22 | listen lisrv |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 23 | mode tcp |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 24 | bind "fd@${lisrv}" |
| 25 | tcp-request connection reject |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 26 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 27 | listen lismtp |
| 28 | mode tcp |
| 29 | bind "fd@${lismtp}" |
| 30 | log ${S1_addr}:${S1_port} daemon |
| 31 | log-format "Result=%[var(txn.result)] Bytes=%B" |
| 32 | tcp-request content use-service lua.mailservice |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 33 | |
| 34 | frontend fe1 |
| 35 | mode http |
| 36 | bind "fd@${fe1}" |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 37 | default_backend be1 |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 38 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 39 | backend be1 |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 40 | mode http |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 41 | log ${S1_addr}:${S1_port} daemon |
| 42 | option httpchk |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 43 | option log-health-checks |
| 44 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 45 | default-server inter 200ms downinter 100ms rise 1 fall 1 |
| 46 | |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 47 | email-alert mailers mymailers |
| 48 | email-alert level info |
| 49 | email-alert from from@domain.tld |
| 50 | email-alert to to@domain.tld |
| 51 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 52 | server srv1 ${h1_lisrv_addr}:${h1_lisrv_port} check |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 53 | |
| 54 | mailers mymailers |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 55 | mailer smtp1 ${h1_lismtp_addr}:${h1_lismtp_port} |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 56 | |
| 57 | } -start |
| 58 | |
Christopher Faulet | 1d93aae | 2022-06-08 11:57:52 +0200 | [diff] [blame] | 59 | syslog S1 -wait |