volume_server_handlers_admin.go 844 B

123456789101112131415161718192021222324252627282930
  1. package weed_server
  2. import (
  3. "net/http"
  4. "path/filepath"
  5. "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
  6. "github.com/chrislusf/seaweedfs/weed/stats"
  7. "github.com/chrislusf/seaweedfs/weed/util"
  8. )
  9. func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
  10. m := make(map[string]interface{})
  11. m["Version"] = util.VERSION
  12. m["Volumes"] = vs.store.VolumeInfos()
  13. oldWriteJsonQuiet(w, r, http.StatusOK, m)
  14. }
  15. func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
  16. m := make(map[string]interface{})
  17. m["Version"] = util.VERSION
  18. var ds []*volume_server_pb.DiskStatus
  19. for _, loc := range vs.store.Locations {
  20. if dir, e := filepath.Abs(loc.Directory); e == nil {
  21. ds = append(ds, stats.NewDiskStatus(dir))
  22. }
  23. }
  24. m["DiskStatuses"] = ds
  25. oldWriteJsonQuiet(w, r, http.StatusOK, m)
  26. }