mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-29 22:13:11 +00:00
'status'
This commit is contained in:
@@ -2,6 +2,7 @@ package broker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"fmt"
|
||||||
"hmq/lib/acl"
|
"hmq/lib/acl"
|
||||||
"hmq/packets"
|
"hmq/packets"
|
||||||
"net"
|
"net"
|
||||||
@@ -13,6 +14,7 @@ import (
|
|||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
|
|
||||||
log "github.com/cihub/seelog"
|
log "github.com/cihub/seelog"
|
||||||
|
"github.com/shirou/gopsutil/mem"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Broker struct {
|
type Broker struct {
|
||||||
@@ -77,6 +79,17 @@ func (b *Broker) Start() {
|
|||||||
if len(b.config.Cluster.Routes) > 0 {
|
if len(b.config.Cluster.Routes) > 0 {
|
||||||
b.ConnectToRouters()
|
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() {
|
func (b *Broker) StartWebsocketListening() {
|
||||||
|
|||||||
Reference in New Issue
Block a user