seaweedfs/weed/server/volume_server_handlers_admin.go

31 lines
833 B
Go
Raw Normal View History

package weed_server
import (
"net/http"
"path/filepath"
2018-10-16 12:44:41 +08:00
2018-10-24 14:59:49 +08:00
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
2018-10-16 12:44:41 +08:00
"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
m["Volumes"] = vs.store.Status()
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))
}
}
2015-03-20 01:39:22 +08:00
m["DiskStatuses"] = ds
writeJsonQuiet(w, r, http.StatusOK, m)
}