volume_server_handlers_admin.go 1.1 KB

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