You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

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