volume_server_handlers_ui.go 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package weed_server
  2. import (
  3. "net/http"
  4. "path/filepath"
  5. "time"
  6. "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
  7. ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
  8. "github.com/chrislusf/seaweedfs/weed/stats"
  9. "github.com/chrislusf/seaweedfs/weed/util"
  10. )
  11. func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
  12. infos := make(map[string]interface{})
  13. infos["Up Time"] = time.Now().Sub(startTime).String()
  14. var ds []*volume_server_pb.DiskStatus
  15. for _, loc := range vs.store.Locations {
  16. if dir, e := filepath.Abs(loc.Directory); e == nil {
  17. ds = append(ds, stats.NewDiskStatus(dir))
  18. }
  19. }
  20. args := struct {
  21. Version string
  22. Masters []string
  23. Volumes interface{}
  24. EcVolumes interface{}
  25. DiskStatuses interface{}
  26. Stats interface{}
  27. Counters *stats.ServerStats
  28. }{
  29. util.VERSION,
  30. vs.SeedMasterNodes,
  31. vs.store.Status(),
  32. vs.store.EcVolumes(),
  33. ds,
  34. infos,
  35. serverStats,
  36. }
  37. ui.StatusTpl.Execute(w, args)
  38. }