seaweedfs/go/weed/weed_server/volume_server_handlers_ui.go

39 lines
884 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
"github.com/chrislusf/seaweedfs/go/stats"
"github.com/chrislusf/seaweedfs/go/util"
ui "github.com/chrislusf/seaweedfs/go/weed/weed_server/volume_server_ui"
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()
2015-03-20 01:39:22 +08:00
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{}
2015-03-23 03:50:04 +08:00
Counters *stats.ServerStats
2015-03-20 01:39:22 +08:00
}{
util.VERSION,
vs.masterNode,
vs.store.Status(),
ds,
infos,
2015-03-23 03:50:04 +08:00
serverStats,
2015-03-20 01:39:22 +08:00
}
ui.StatusTpl.Execute(w, args)
}