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.

54 lines
1.3 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. if ms.Topo.RaftServer != nil {
  16. args := struct {
  17. Version string
  18. Topology interface{}
  19. RaftServer raft.Server
  20. Stats map[string]interface{}
  21. Counters *stats.ServerStats
  22. VolumeSizeLimitMB uint32
  23. }{
  24. util.Version(),
  25. ms.Topo.ToInfo(),
  26. ms.Topo.RaftServer,
  27. infos,
  28. serverStats,
  29. ms.option.VolumeSizeLimitMB,
  30. }
  31. ui.StatusTpl.Execute(w, args)
  32. } else if ms.Topo.HashicorpRaft != nil {
  33. args := struct {
  34. Version string
  35. Topology interface{}
  36. RaftServer *hashicorpRaft.Raft
  37. Stats map[string]interface{}
  38. Counters *stats.ServerStats
  39. VolumeSizeLimitMB uint32
  40. }{
  41. util.Version(),
  42. ms.Topo.ToInfo(),
  43. ms.Topo.HashicorpRaft,
  44. infos,
  45. serverStats,
  46. ms.option.VolumeSizeLimitMB,
  47. }
  48. ui.StatusNewRaftTpl.Execute(w, args)
  49. }
  50. }