seaweedfs/weed/server/volume_server_handlers_ui.go

42 lines
1008 B
Go
Raw Normal View History

2015-03-20 01:39:22 +08:00
package weed_server
import (
"net/http"
"path/filepath"
2015-03-23 03:50:04 +08:00
"time"
2015-03-20 01:39:22 +08:00
2018-10-24 14:59:49 +08:00
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
2018-05-28 02:52:26 +08:00
ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util"
2015-03-20 01:39:22 +08:00
)
func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
infos := make(map[string]interface{})
2015-03-23 03:50:04 +08:00
infos["Up Time"] = time.Now().Sub(startTime).String()
var ds []*volume_server_pb.DiskStatus
2015-03-20 01:39:22 +08:00
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
Masters []string
2015-03-20 01:39:22 +08:00
Volumes interface{}
2019-06-05 12:52:37 +08:00
EcVolumes interface{}
2015-03-20 01:39:22 +08:00
DiskStatuses interface{}
Stats interface{}
2015-03-23 03:50:04 +08:00
Counters *stats.ServerStats
2015-03-20 01:39:22 +08:00
}{
util.VERSION,
vs.SeedMasterNodes,
2015-03-20 01:39:22 +08:00
vs.store.Status(),
2019-06-05 12:52:37 +08:00
vs.store.EcVolumes(),
2015-03-20 01:39:22 +08:00
ds,
infos,
2015-03-23 03:50:04 +08:00
serverStats,
2015-03-20 01:39:22 +08:00
}
ui.StatusTpl.Execute(w, args)
}