diff --git a/engine/responder.go b/engine/responder.go index ce78fc3ad..b109efc82 100644 --- a/engine/responder.go +++ b/engine/responder.go @@ -219,6 +219,7 @@ func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err erro response[utils.ActiveGoroutines] = runtime.NumGoroutine() response["Footprint"] = utils.SizeFmt(float64(memstats.Sys), "") response[utils.Version] = utils.GetCGRVersion() + response["RunningSince"] = utils.GetStartTime() *reply = response return } diff --git a/utils/coreutils.go b/utils/coreutils.go index fe93592fc..d0a036145 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -46,6 +46,20 @@ import ( "github.com/cgrates/rpcclient" ) +var startCGRateSTime time.Time + +func init() { + startCGRateSTime = time.Now() +} + +func GetTimeElapsedFromStart() string { + return time.Now().Sub(startCGRateSTime).Round(time.Second).String() +} + +func GetStartTime() string { + return startCGRateSTime.Format(time.UnixDate) +} + func NewCounter(start, limit int64) *Counter { return &Counter{ value: start,