diff --git a/check_mysql_query_count/check_mysql_query_count.go b/check_mysql_query_count/check_mysql_query_count.go index c3b9d83..02c5921 100644 --- a/check_mysql_query_count/check_mysql_query_count.go +++ b/check_mysql_query_count/check_mysql_query_count.go @@ -11,6 +11,7 @@ import ( // Option to parse var ( + HELP = flag.Bool("help", false, "print the help message") HOSTNAME = flag.String("hostname", "localhost", "mysql hostname") PORT = flag.Int("port", 3306, "mysql port") USERNAME = flag.String("username", "", "mysql username") @@ -24,6 +25,11 @@ var ( func init() { flag.Parse() + if *HELP { + flag.PrintDefaults() + os.Exit(3) + } + if *QUERY == "" { Critical("Please set query option") } @@ -87,4 +93,3 @@ func main() { Ok(msg) } -