mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-26 03:59:12 +08:00
4ff513d64d
whem monitoring server, better to know the status of the disks & volumes in a single route.
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package weed_server
|
|
|
|
import (
|
|
"net/http"
|
|
"path/filepath"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
|
"github.com/chrislusf/seaweedfs/weed/stats"
|
|
"github.com/chrislusf/seaweedfs/weed/util"
|
|
)
|
|
|
|
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
|
|
m := make(map[string]interface{})
|
|
m["Version"] = util.VERSION
|
|
var ds []*volume_server_pb.DiskStatus
|
|
for _, loc := range vs.store.Locations {
|
|
if dir, e := filepath.Abs(loc.Directory); e == nil {
|
|
ds = append(ds, stats.NewDiskStatus(dir))
|
|
}
|
|
}
|
|
m["DiskStatuses"] = ds
|
|
m["Volumes"] = vs.store.VolumeInfos()
|
|
writeJsonQuiet(w, r, http.StatusOK, m)
|
|
}
|
|
|
|
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
|
|
m := make(map[string]interface{})
|
|
m["Version"] = util.VERSION
|
|
var ds []*volume_server_pb.DiskStatus
|
|
for _, loc := range vs.store.Locations {
|
|
if dir, e := filepath.Abs(loc.Directory); e == nil {
|
|
ds = append(ds, stats.NewDiskStatus(dir))
|
|
}
|
|
}
|
|
m["DiskStatuses"] = ds
|
|
writeJsonQuiet(w, r, http.StatusOK, m)
|
|
}
|