You've already forked ssl_exporter
mirror of
https://github.com/ribbybibby/ssl_exporter.git
synced 2025-07-15 23:54:18 +02:00
Switch to kingpin flags
This commit is contained in:
10
README.md
10
README.md
@ -12,11 +12,11 @@ Whatever it is, the SSL exporter gives you visibility over those dimensions at t
|
|||||||
Similarly to the blackbox_exporter, visiting [http://localhost:9219/probe?target=https://example.com](http://localhost:9219/probe?target=https://example.com) will return certificate metrics for example.com. The ```ssl_https_connect_success``` metric indicates if the probe has been successful.
|
Similarly to the blackbox_exporter, visiting [http://localhost:9219/probe?target=https://example.com](http://localhost:9219/probe?target=https://example.com) will return certificate metrics for example.com. The ```ssl_https_connect_success``` metric indicates if the probe has been successful.
|
||||||
|
|
||||||
## Flags
|
## Flags
|
||||||
./ssl_exporter -help
|
./ssl_exporter --help
|
||||||
* __`-tls.insecure`:__ Skip certificate verification (default false). This is insecure but does allow you to collect metrics in the case where a certificate has expired. That being said, I feel that it's more important to catch verification failures than it is to identify an expired certificate, especially as the former includes the latter.
|
* __`--tls.insecure`:__ Skip certificate verification (default false). This is insecure but does allow you to collect metrics in the case where a certificate has expired. That being said, I feel that it's more important to catch verification failures than it is to identify an expired certificate, especially as the former includes the latter.
|
||||||
* __`-web.listen-address`:__ The port (default ":9219").
|
* __`--web.listen-address`:__ The port (default ":9219").
|
||||||
* __`-web.metrics-path`:__ The path metrics are exposed under (default "/metrics")
|
* __`--web.metrics-path`:__ The path metrics are exposed under (default "/metrics")
|
||||||
* __`-web.probe-path`:__ The path the probe endpoint is exposed under (default "/probe")
|
* __`--web.probe-path`:__ The path the probe endpoint is exposed under (default "/probe")
|
||||||
|
|
||||||
## Metrics
|
## Metrics
|
||||||
Metrics are exported for each certificate in the chain individually. All of the metrics are labelled with the Issuer's Common Name and the Serial ID, which is pretty much a unique identifier.
|
Metrics are exported for each certificate in the chain individually. All of the metrics are labelled with the Issuer's Common Name and the Serial ID, which is pretty much a unique identifier.
|
||||||
|
@ -2,10 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -14,6 +12,7 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"github.com/prometheus/common/log"
|
"github.com/prometheus/common/log"
|
||||||
"github.com/prometheus/common/version"
|
"github.com/prometheus/common/version"
|
||||||
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -203,19 +202,16 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
showVersion = flag.Bool("version", false, "Print version information")
|
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9219").String()
|
||||||
listenAddress = flag.String("web.listen-address", ":9219", "Address to listen on for web interface and telemetry.")
|
metricsPath = kingpin.Flag("web.metrics-path", "Path under which to expose metrics").Default("/metrics").String()
|
||||||
metricsPath = flag.String("web.metrics-path", "/metrics", "Path under which to expose metrics")
|
probePath = kingpin.Flag("web.probe-path", "Path under which to expose the probe endpoint").Default("/probe").String()
|
||||||
probePath = flag.String("web.probe-path", "/probe", "Path under which to expose the probe endpoint")
|
insecure = kingpin.Flag("tls.insecure", "Skip certificate verification").Default("false").Bool()
|
||||||
insecure = flag.Bool("tls.insecure", false, "Skip certificate verification")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.Parse()
|
log.AddFlags(kingpin.CommandLine)
|
||||||
|
kingpin.Version(version.Print(namespace + "_exporter"))
|
||||||
if *showVersion {
|
kingpin.HelpFlag.Short('h')
|
||||||
fmt.Fprintln(os.Stdout, version.Print(namespace + "_exporter"))
|
kingpin.Parse()
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Infoln("Starting " + namespace + "_exporter", version.Info())
|
log.Infoln("Starting " + namespace + "_exporter", version.Info())
|
||||||
log.Infoln("Build context", version.BuildContext())
|
log.Infoln("Build context", version.BuildContext())
|
||||||
|
Reference in New Issue
Block a user