Skip to content

Commit

Permalink
Merge dafd8ae into 861075b
Browse files Browse the repository at this point in the history
  • Loading branch information
gilzellner committed Jul 29, 2019
2 parents 861075b + dafd8ae commit 2fec7e5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Expand Up @@ -200,6 +200,37 @@ h.RegisterCheck(&health.Config{
})
```

#### Adding a check that ignores SSL errors:
```go
h := health.New()
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
httpclient := &http.Client{Transport: tr}

httpCheckConf := checks.HTTPCheckConfig{
CheckName: "httpbin.url.check",
Timeout: 1 * time.Second,
URL: configuration.ChefServerURL,
Client: httpclient,
}
httpCheck, err := checks.NewHTTPCheck(httpCheckConf)

err = h.RegisterCheck(&health.Config{
Check: httpCheck,
InitialDelay: time.Second, // the check will run once after 1 sec
ExecutionPeriod: 10 * time.Second, // the check will be executed every 10 sec
})

if err != nil {
aflogger.Error("Failed to register check: \n" + fmt.Sprint(err))
}

http.HandleFunc("/health", healthhttp.HandleHealthJSON(h))

```


#### Custom Checks Notes
1. If a check take longer than the specified rate period, then next execution will be delayed,
but will not be concurrently executed.
Expand Down

0 comments on commit 2fec7e5

Please sign in to comment.