volume_server_handlers_admin.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. var ds []*volume_server_pb.DiskStatus
  13. for _, loc := range vs.store.Locations {
  14. if dir, e := filepath.Abs(loc.Directory); e == nil {
  15. ds = append(ds, stats.NewDiskStatus(dir))
  16. }
  17. }
  18. m["DiskStatuses"] = ds
  19. m["Volumes"] = vs.store.VolumeInfos()
  20. writeJsonQuiet(w, r, http.StatusOK, m)
  21. }
  22. func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
  23. m := make(map[string]interface{})
  24. m["Version"] = util.Version()
  25. var ds []*volume_server_pb.DiskStatus
  26. for _, loc := range vs.store.Locations {
  27. if dir, e := filepath.Abs(loc.Directory); e == nil {
  28. ds = append(ds, stats.NewDiskStatus(dir))
  29. }
  30. }
  31. m["DiskStatuses"] = ds
  32. writeJsonQuiet(w, r, http.StatusOK, m)
  33. }