2014-04-14 15:13:18 +08:00
|
|
|
package weed_server
|
|
|
|
|
|
|
|
import (
|
2018-10-15 16:19:15 +08:00
|
|
|
"net/http"
|
|
|
|
"path/filepath"
|
2018-10-16 12:44:41 +08:00
|
|
|
|
2019-09-02 18:28:40 +08:00
|
|
|
"github.com/joeslay/seaweedfs/weed/pb/volume_server_pb"
|
|
|
|
"github.com/joeslay/seaweedfs/weed/stats"
|
|
|
|
"github.com/joeslay/seaweedfs/weed/util"
|
2014-04-14 15:13:18 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
m := make(map[string]interface{})
|
|
|
|
m["Version"] = util.VERSION
|
|
|
|
m["Volumes"] = vs.store.Status()
|
2015-01-08 16:19:32 +08:00
|
|
|
writeJsonQuiet(w, r, http.StatusOK, m)
|
2014-04-14 15:13:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
m := make(map[string]interface{})
|
|
|
|
m["Version"] = util.VERSION
|
2018-10-16 13:25:28 +08:00
|
|
|
var ds []*volume_server_pb.DiskStatus
|
2014-04-14 15:13:18 +08:00
|
|
|
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
|
2015-01-08 16:19:32 +08:00
|
|
|
writeJsonQuiet(w, r, http.StatusOK, m)
|
2014-04-14 15:13:18 +08:00
|
|
|
}
|