Skip to content

Commit

Permalink
support overwrite status
Browse files Browse the repository at this point in the history
  • Loading branch information
yseto committed Sep 13, 2023
1 parent 0f93286 commit d822e27
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion check-tcp/lib/check-tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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) {
Expand Down

0 comments on commit d822e27

Please sign in to comment.