aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_server_handlers_ui.go
blob: 6fc775a6db455a269516c3b9d2f932394e19385d (plain)
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
package weed_server

import (
	"net/http"
	"path/filepath"
	"time"

	ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
	"github.com/chrislusf/seaweedfs/weed/stats"
	"github.com/chrislusf/seaweedfs/weed/util"
)

func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
	infos := make(map[string]interface{})
	infos["Up Time"] = time.Now().Sub(startTime).String()
	var ds []*stats.DiskStatus
	for _, loc := range vs.store.Locations {
		if dir, e := filepath.Abs(loc.Directory); e == nil {
			ds = append(ds, stats.NewDiskStatus(dir))
		}
	}
	args := struct {
		Version      string
		Master       string
		Volumes      interface{}
		DiskStatuses interface{}
		Stats        interface{}
		Counters     *stats.ServerStats
	}{
		util.VERSION,
		vs.masterNode,
		vs.store.Status(),
		ds,
		infos,
		serverStats,
	}
	ui.StatusTpl.Execute(w, args)
}