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.

56 lines
1.5 KiB

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