volume_server_handlers_ui.go 880 B

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