mirror of
https://github.com/gowvp/gb28181.git
synced 2026-04-24 00:30:51 +08:00
add wechat
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package statapi
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gowvp/gb28181/plugin/stat"
|
||||
"github.com/ixugo/goweb/pkg/web"
|
||||
)
|
||||
|
||||
func Register(g gin.IRouter, hf ...gin.HandlerFunc) {
|
||||
stat := g.Group("/stats", hf...)
|
||||
stat.GET("", web.WarpH(findStat))
|
||||
}
|
||||
|
||||
func findStat(_ *gin.Context, _ *struct{}) (gin.H, error) {
|
||||
dir, _ := os.Executable()
|
||||
return gin.H{
|
||||
"mem": stat.GetMemData(),
|
||||
"cpu": stat.GetCPUData(),
|
||||
"disk": []gin.H{
|
||||
{
|
||||
"name": filepath.Dir(dir),
|
||||
"used": stat.GetCurrentMainDisk(),
|
||||
"total": stat.GetTotalMainDisk(),
|
||||
},
|
||||
},
|
||||
"net": stat.GetNetData(),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user