mirror of
https://github.com/Luzifer/mondash.git
synced 2024-12-22 12:01:19 +00:00
Support different staleness status
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
54340f1540
commit
b2d529faf8
1 changed files with 14 additions and 11 deletions
|
@ -11,10 +11,11 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
mondash "github.com/Luzifer/mondash/client"
|
||||
"github.com/Luzifer/rconfig"
|
||||
"github.com/gosimple/slug"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
mondash "github.com/Luzifer/mondash/client"
|
||||
"github.com/Luzifer/rconfig"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -24,7 +25,8 @@ var (
|
|||
MondashToken string `flag:"token,t" env:"TOKEN" default:"" description:"Token associated with the specified board" validate:"nonzero"`
|
||||
MetricID string `flag:"metric-id,m" env:"METRIC_ID" default:"" description:"ID of the metric, if not specified a generated ID from the title will be used"`
|
||||
MetricTitle string `flag:"metric-title" env:"METRIC_TITLE" default:"" description:"Title of the metric, if not specified the command line will be used"`
|
||||
Freshness time.Duration `flag:"Freshness" env:"FRESHNESS" default:"1h" description:"Freshness of the metric (will turn to unknown if no new result was submitted)"`
|
||||
Freshness time.Duration `flag:"freshness" env:"FRESHNESS" default:"1h" description:"Freshness of the metric (will turn to unknown if no new result was submitted)"`
|
||||
StaleStatus string `flag:"stale-status" default:"Unknown" description:"Status to set when metric is stale (One of Unknown, OK, Warning, Critical)"`
|
||||
Timeout time.Duration `flag:"timeout" env:"TIMEOUT" default:"1m" description:"Timeout for the script command to be killed"`
|
||||
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
|
||||
}{}
|
||||
|
@ -102,14 +104,15 @@ func main() {
|
|||
|
||||
client := mondash.New(cfg.MondashBoard, cfg.MondashToken).WithHost(cfg.MondashHost)
|
||||
if err := client.PostMetric(&mondash.PostMetricInput{
|
||||
MetricID: cfg.MetricID,
|
||||
Title: cfg.MetricTitle,
|
||||
Description: output,
|
||||
Status: statusMapping[exitCode],
|
||||
Value: value,
|
||||
Freshness: int64(cfg.Freshness / time.Second),
|
||||
IgnoreMAD: true,
|
||||
HideMAD: true,
|
||||
MetricID: cfg.MetricID,
|
||||
Title: cfg.MetricTitle,
|
||||
Description: output,
|
||||
Status: statusMapping[exitCode],
|
||||
Value: value,
|
||||
Freshness: int64(cfg.Freshness / time.Second),
|
||||
IgnoreMAD: true,
|
||||
HideMAD: true,
|
||||
StalenessStatus: cfg.StaleStatus,
|
||||
}); err != nil {
|
||||
log.WithError(err).Fatal("Could not submit metric")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue