MondashBoardstring`flag:"mondash-board" default:"" description:"ID of the Mondash board to send to" validate:"nonzero"`
MondashMetricstring`flag:"mondash-metric" default:"checkgpg" description:"ID of the metric to submit to"`
MondashMetricExpirytime.Duration`flag:"mondash-metric-expiry" default:"168h" description:"Time in seconds when to remove the metric if there is no update"`
MondashMetricFreshnesstime.Duration`flag:"mondash-metric-freshness" default:"168h" description:"Time in seconds when to switch to stale state of there is no update"`
MondashTokenstring`flag:"mondash-token" default:"" description:"Token with write access to the board" validate:"nonzero"`
VersionAndExitbool`flag:"version" default:"false" description:"Prints current version and exits"`
WarnAttime.Duration`flag:"warn-at,w" default:"336h" description:"Switch state to warning if key expires within X"`
}{}
version="dev"
)
funcinit(){
rconfig.AutoEnv(true)
iferr:=rconfig.ParseAndValidate(&cfg);err!=nil{
log.Fatalf("Unable to parse commandline options: %s",err)
}
ifcfg.VersionAndExit{
fmt.Printf("mondash-checkgpg %s\n",version)
os.Exit(0)
}
ifl,err:=log.ParseLevel(cfg.LogLevel);err!=nil{
log.WithError(err).Fatal("Unable to parse log level")