diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-07-26 16:58:25 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-07-26 16:58:25 -0400 |
| commit | 1cebf3b440a35d532b51a13f4b3dd1a90e8cdab2 (patch) | |
| tree | fde1b24a768c5d454ddbf544d3d6a32009689ed0 /cmd/main/main.go | |
| parent | 4a4c36edde5ff9580b3ef5342d67b0117d555b61 (diff) | |
| download | checkup-master.tar.gz checkup-master.tar.xz | |
Diffstat (limited to 'cmd/main/main.go')
| -rw-r--r-- | cmd/main/main.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd/main/main.go b/cmd/main/main.go index dd344d2..9210d44 100644 --- a/cmd/main/main.go +++ b/cmd/main/main.go @@ -30,6 +30,7 @@ type Config struct { CheckCerts map[string]*string `yaml:"CheckCerts"` ExpectedStatusCode int `yaml:"ExpectedStatusCode"` StatusChecks map[string]*int `yaml:"StatusChecks"` + StatusChecksNoRdr map[string]*int `yaml:"StatusChecksNoRedirect"` Workers int `yaml:"Workers"` Interval int `yaml:"Interval"` RenotifyInterval int `yaml:"RenotifyInterval"` @@ -172,21 +173,26 @@ func main() { if *once { jobNotify(conf, checkCerts(conf)) - jobNotify(conf, checkStatus(conf)) + jobNotify(conf, checkStatus(conf, conf.StatusChecks, checkup.HttpStatusOK)) + jobNotify(conf, checkStatus(conf, conf.StatusChecksNoRdr, checkup.HttpNoRedirectStatusOK)) os.Exit(0) } certsPrev := map[string]*jobResponse{} statusPrev := map[string]*jobResponse{} + statusPrevNoRdr := map[string]*jobResponse{} for { cert := checkCerts(conf) - status := checkStatus(conf) + status := checkStatus(conf, conf.StatusChecks, checkup.HttpStatusOK) + statusNoRdr := checkStatus(conf, conf.StatusChecksNoRdr, checkup.HttpNoRedirectStatusOK) jobNotifyDedup(conf, certsPrev, cert) jobNotifyDedup(conf, statusPrev, status) + jobNotifyDedup(conf, statusPrevNoRdr, statusNoRdr) certsPrev = cert statusPrev = status + statusPrevNoRdr = statusNoRdr time.Sleep(time.Duration(conf.Interval) * time.Second) } |
