mirror of
https://github.com/fhmq/hmq.git
synced 2026-04-24 10:38:34 +00:00
'status'
This commit is contained in:
@@ -2,6 +2,7 @@ package broker
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"hmq/lib/acl"
|
||||
"hmq/packets"
|
||||
"net"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"golang.org/x/net/websocket"
|
||||
|
||||
log "github.com/cihub/seelog"
|
||||
"github.com/shirou/gopsutil/mem"
|
||||
)
|
||||
|
||||
type Broker struct {
|
||||
@@ -77,6 +79,17 @@ func (b *Broker) Start() {
|
||||
if len(b.config.Cluster.Routes) > 0 {
|
||||
b.ConnectToRouters()
|
||||
}
|
||||
|
||||
}
|
||||
func StateMonitor() {
|
||||
v, _ := mem.VirtualMemory()
|
||||
timeSticker := time.NewTicker(time.Second * 5)
|
||||
for {
|
||||
select {
|
||||
case <-timeSticker:
|
||||
fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Broker) StartWebsocketListening() {
|
||||
|
||||
Reference in New Issue
Block a user