diff --git a/plugins/inputs/passenger/passenger.go b/plugins/inputs/passenger/passenger.go index 84e92cb1a9b73..f00bfc824de28 100644 --- a/plugins/inputs/passenger/passenger.go +++ b/plugins/inputs/passenger/passenger.go @@ -102,7 +102,7 @@ func (p *process) getUptime() int64 { uptime += value * (24 * 60 * 60) } case strings.HasSuffix(v, "h"): - iValue := strings.TrimSuffix(v, "y") + iValue := strings.TrimSuffix(v, "h") value, err := strconv.ParseInt(iValue, 10, 64) if err == nil { uptime += value * (60 * 60) diff --git a/plugins/inputs/passenger/passenger_test.go b/plugins/inputs/passenger/passenger_test.go index 6124a968e31eb..c54239d39ecfd 100644 --- a/plugins/inputs/passenger/passenger_test.go +++ b/plugins/inputs/passenger/passenger_test.go @@ -126,7 +126,7 @@ func TestPassengerGenerateMetric(t *testing.T) { "spawn_start_time": int64(1452746844946982), "spawn_end_time": int64(1452746845013365), "last_used": int64(1452747071764940), - "uptime": int64(226), // in seconds of 3m 46s + "uptime": int64(191026), // in seconds of 2d 5h 3m 46s "cpu": int64(58), "rss": int64(418548), "pss": int64(319391), @@ -219,7 +219,7 @@ var sampleStat = ` 1452746845013365 1452747071764940 0s ago - 3m 46s + 2d 5h 3m 46s 899ac7f ALIVE ENABLED @@ -263,7 +263,7 @@ var sampleStat = ` 1452746845172460 1452747071709179 0s ago - 3m 46s + 2d 5h 3m 46s 899ac7f ALIVE ENABLED