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.

38 lines
884 B

10 years ago
10 years ago
10 years ago
10 years ago
  1. package weed_server
  2. import (
  3. "net/http"
  4. "path/filepath"
  5. "time"
  6. "github.com/chrislusf/seaweedfs/go/stats"
  7. "github.com/chrislusf/seaweedfs/go/util"
  8. ui "github.com/chrislusf/seaweedfs/go/weed/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. }