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.

35 lines
799 B

  1. package weed_server
  2. import (
  3. "net/http"
  4. "path/filepath"
  5. "github.com/chrislusf/weed-fs/go/stats"
  6. "github.com/chrislusf/weed-fs/go/util"
  7. ui "github.com/chrislusf/weed-fs/go/weed/weed_server/volume_server_ui"
  8. )
  9. func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
  10. infos := make(map[string]interface{})
  11. infos["Version"] = util.VERSION
  12. var ds []*stats.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. args := struct {
  19. Version string
  20. Master string
  21. Volumes interface{}
  22. DiskStatuses interface{}
  23. Stats interface{}
  24. }{
  25. util.VERSION,
  26. vs.masterNode,
  27. vs.store.Status(),
  28. ds,
  29. infos,
  30. }
  31. ui.StatusTpl.Execute(w, args)
  32. }