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