Remove fluent-style kingpin

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2023-04-16 11:45:07 +02:00
parent a105e088b3
commit da6898afc4
15 changed files with 487 additions and 252 deletions

View File

@@ -11,9 +11,14 @@ import (
"regexp"
)
const (
FlagSmtpServerBlacklist = "collector.smtp.server-blacklist"
FlagSmtpServerWhitelist = "collector.smtp.server-whitelist"
)
var (
serverWhitelist = kingpin.Flag("collector.smtp.server-whitelist", "Regexp of virtual servers to whitelist. Server name must both match whitelist and not match blacklist to be included.").Default(".+").String()
serverBlacklist = kingpin.Flag("collector.smtp.server-blacklist", "Regexp of virtual servers to blacklist. Server name must both match whitelist and not match blacklist to be included.").String()
serverWhitelist *string
serverBlacklist *string
)
type SMTPCollector struct {
@@ -64,6 +69,11 @@ type SMTPCollector struct {
serverBlacklistPattern *regexp.Regexp
}
func newSMTPCollectorFlags(app *kingpin.Application) {
serverWhitelist = app.Flag(FlagSmtpServerWhitelist, "Regexp of virtual servers to whitelist. Server name must both match whitelist and not match blacklist to be included.").Default(".+").String()
serverBlacklist = app.Flag(FlagSmtpServerBlacklist, "Regexp of virtual servers to blacklist. Server name must both match whitelist and not match blacklist to be included.").String()
}
func newSMTPCollector() (Collector, error) {
log.Info("smtp collector is in an experimental state! Metrics for this collector have not been tested.")
const subsystem = "smtp"