diff --git a/check-tcp/lib/check-tcp.go b/check-tcp/lib/check-tcp.go index d098e489..65a63893 100644 --- a/check-tcp/lib/check-tcp.go +++ b/check-tcp/lib/check-tcp.go @@ -35,6 +35,7 @@ type exchange struct { SSL bool `short:"S" long:"ssl" description:"Use SSL for the connection."` UnixSock string `short:"U" long:"unix-sock" description:"Unix Domain Socket"` NoCheckCertificate bool `long:"no-check-certificate" description:"Do not check certificate"` + AsStatus string `long:"as-status" description:"Overwrite status=to-status, support multiple comma separetes."` expectReg *regexp.Regexp } @@ -44,12 +45,18 @@ func Do() { if err != nil { os.Exit(1) } + maps, err := checkers.Parse(opts.AsStatus) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + ckr := opts.run() ckr.Name = "TCP" if opts.Service != "" { ckr.Name = opts.Service } - ckr.Exit() + ckr.ExitAsStatus(maps) } func parseArgs(args []string) (*tcpOpts, error) {