seaweedfs/weed/server/volume_server_handlers_admin.go

44 lines
1.3 KiB
Go
Raw Normal View History

package weed_server
import (
"net/http"
"path/filepath"
2018-10-16 04:44:41 +00:00
2018-10-24 06:59:49 +00:00
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
2018-10-16 04:44:41 +00:00
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util"
)
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
2020-09-20 23:00:01 +00:00
w.Header().Set("Server", "SeaweedFS Volume "+util.VERSION)
m := make(map[string]interface{})
2020-06-02 07:10:35 +00:00
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 {
2020-12-14 08:51:57 +00:00
newDiskStatus := stats.NewDiskStatus(dir)
newDiskStatus.DiskType = loc.GetDiskType()
ds = append(ds, newDiskStatus)
}
}
m["DiskStatuses"] = ds
2019-12-03 04:49:50 +00:00
m["Volumes"] = vs.store.VolumeInfos()
writeJsonQuiet(w, r, http.StatusOK, m)
}
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
2020-09-20 23:00:01 +00:00
w.Header().Set("Server", "SeaweedFS Volume "+util.VERSION)
m := make(map[string]interface{})
2020-06-02 07:10:35 +00:00
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 {
2020-12-14 08:51:57 +00:00
newDiskStatus := stats.NewDiskStatus(dir)
newDiskStatus.DiskType = loc.GetDiskType()
ds = append(ds, newDiskStatus)
}
}
2015-03-19 17:39:22 +00:00
m["DiskStatuses"] = ds
writeJsonQuiet(w, r, http.StatusOK, m)
}