Skip to content

Commit

Permalink
use go-osstat/uptime instead of golib/uptime for getting more accurat…
Browse files Browse the repository at this point in the history
…e uptime
  • Loading branch information
Songmu committed Dec 21, 2017
1 parent 2b53296 commit 95e5729
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions check-uptime/lib/check-uptime.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/jessevdk/go-flags"
"github.com/mackerelio/checkers"
"github.com/mackerelio/golib/uptime"
"github.com/mackerelio/go-osstat/uptime"
)

var opts struct {
Expand All @@ -31,10 +31,11 @@ func run(args []string) *checkers.Checker {
if err != nil {
os.Exit(1)
}
ut, err := uptime.Get()
utDur, err := uptime.Get()
if err != nil {
return checkers.Unknown(fmt.Sprintf("Faild to fetch uptime metrics: %s", err))
}
ut := utDur.Seconds()

// for backward compatibility
if opts.WarnUnder != nil && opts.WarningUnder == nil {
Expand Down

0 comments on commit 95e5729

Please sign in to comment.