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.

58 lines
1.4 KiB

3 years ago
3 years ago
10 years ago
3 years ago
3 years ago
3 years ago
  1. package weed_server
  2. import (
  3. "net/http"
  4. "time"
  5. hashicorpRaft "github.com/hashicorp/raft"
  6. "github.com/seaweedfs/raft"
  7. ui "github.com/seaweedfs/seaweedfs/weed/server/master_ui"
  8. "github.com/seaweedfs/seaweedfs/weed/stats"
  9. "github.com/seaweedfs/seaweedfs/weed/util"
  10. )
  11. func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
  12. infos := make(map[string]interface{})
  13. infos["Up Time"] = time.Now().Sub(startTime).String()
  14. infos["Max Volume Id"] = ms.Topo.GetMaxVolumeId()
  15. ms.Topo.RaftServerAccessLock.RLock()
  16. defer ms.Topo.RaftServerAccessLock.RUnlock()
  17. if ms.Topo.RaftServer != nil {
  18. args := struct {
  19. Version string
  20. Topology interface{}
  21. RaftServer raft.Server
  22. Stats map[string]interface{}
  23. Counters *stats.ServerStats
  24. VolumeSizeLimitMB uint32
  25. }{
  26. util.Version(),
  27. ms.Topo.ToInfo(),
  28. ms.Topo.RaftServer,
  29. infos,
  30. serverStats,
  31. ms.option.VolumeSizeLimitMB,
  32. }
  33. ui.StatusTpl.Execute(w, args)
  34. } else if ms.Topo.HashicorpRaft != nil {
  35. args := struct {
  36. Version string
  37. Topology interface{}
  38. RaftServer *hashicorpRaft.Raft
  39. Stats map[string]interface{}
  40. Counters *stats.ServerStats
  41. VolumeSizeLimitMB uint32
  42. }{
  43. util.Version(),
  44. ms.Topo.ToInfo(),
  45. ms.Topo.HashicorpRaft,
  46. infos,
  47. serverStats,
  48. ms.option.VolumeSizeLimitMB,
  49. }
  50. ui.StatusNewRaftTpl.Execute(w, args)
  51. }
  52. }