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.

57 lines
1.6 KiB

10 years ago
4 years ago
10 years ago
10 years ago
  1. package weed_server
  2. import (
  3. "github.com/seaweedfs/seaweedfs/weed/pb"
  4. "net/http"
  5. "path/filepath"
  6. "time"
  7. "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
  8. ui "github.com/seaweedfs/seaweedfs/weed/server/volume_server_ui"
  9. "github.com/seaweedfs/seaweedfs/weed/stats"
  10. "github.com/seaweedfs/seaweedfs/weed/storage"
  11. "github.com/seaweedfs/seaweedfs/weed/util"
  12. )
  13. func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
  14. w.Header().Set("Server", "SeaweedFS Volume "+util.VERSION)
  15. infos := make(map[string]interface{})
  16. infos["Up Time"] = time.Now().Sub(startTime).String()
  17. var ds []*volume_server_pb.DiskStatus
  18. for _, loc := range vs.store.Locations {
  19. if dir, e := filepath.Abs(loc.Directory); e == nil {
  20. newDiskStatus := stats.NewDiskStatus(dir)
  21. newDiskStatus.DiskType = loc.DiskType.String()
  22. ds = append(ds, newDiskStatus)
  23. }
  24. }
  25. volumeInfos := vs.store.VolumeInfos()
  26. var normalVolumeInfos, remoteVolumeInfos []*storage.VolumeInfo
  27. for _, vinfo := range volumeInfos {
  28. if vinfo.IsRemote() {
  29. remoteVolumeInfos = append(remoteVolumeInfos, vinfo)
  30. } else {
  31. normalVolumeInfos = append(normalVolumeInfos, vinfo)
  32. }
  33. }
  34. args := struct {
  35. Version string
  36. Masters []pb.ServerAddress
  37. Volumes interface{}
  38. EcVolumes interface{}
  39. RemoteVolumes interface{}
  40. DiskStatuses interface{}
  41. Stats interface{}
  42. Counters *stats.ServerStats
  43. }{
  44. util.Version(),
  45. vs.SeedMasterNodes,
  46. normalVolumeInfos,
  47. vs.store.EcVolumes(),
  48. remoteVolumeInfos,
  49. ds,
  50. infos,
  51. serverStats,
  52. }
  53. ui.StatusTpl.Execute(w, args)
  54. }