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.

29 lines
763 B

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