Added RunningSince to cgr-console status

This commit is contained in:
Trial97
2019-02-20 14:03:53 +02:00
committed by Dan Christian Bogos
parent db7826a5d7
commit f4d6f4fca8
2 changed files with 15 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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,