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