Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test coverage lint vet

build:
go build
export CGO_ENABLED=0; go build
lint:
go fmt $(go list ./... | grep -v /vendor/)
vet:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Flags:
-v, --version version for check_prometheus
```

The check plugin respects the environment variables `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`.

### Health

Checks the health or readiness status of the Prometheus server.
Expand Down
19 changes: 12 additions & 7 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package cmd
import (
"context"
"fmt"
"github.com/NETWAYS/check_prometheus/internal/client"
"github.com/NETWAYS/go-check"
"github.com/prometheus/common/config"
"net"
"net/http"
"net/url"
"strconv"
"strings"
"time"

"github.com/NETWAYS/check_prometheus/internal/client"
"github.com/NETWAYS/go-check"
"github.com/prometheus/common/config"
)

type AlertConfig struct {
Expand Down Expand Up @@ -82,10 +84,13 @@ func (c *Config) NewClient() *client.Client {
}

var rt http.RoundTripper = &http.Transport{
TLSClientConfig: tlsConfig,
IdleConnTimeout: 10 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 10 * time.Second,
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
TLSHandshakeTimeout: 10 * time.Second,
TLSClientConfig: tlsConfig,
}

// Using a Bearer Token for authentication
Expand Down