2015-03-20 01:39:22 +08:00
|
|
|
package weed_server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2020-04-24 04:37:31 +08:00
|
|
|
"time"
|
2015-03-20 01:39:22 +08:00
|
|
|
|
2022-04-07 22:37:40 +08:00
|
|
|
hashicorpRaft "github.com/hashicorp/raft"
|
2022-07-28 03:12:40 +08:00
|
|
|
"github.com/seaweedfs/raft"
|
2022-04-07 22:37:40 +08:00
|
|
|
|
2022-07-29 15:17:28 +08:00
|
|
|
ui "github.com/seaweedfs/seaweedfs/weed/server/master_ui"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/stats"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
2015-03-20 01:39:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-23 03:50:04 +08:00
|
|
|
infos := make(map[string]interface{})
|
2020-04-24 04:37:31 +08:00
|
|
|
infos["Up Time"] = time.Now().Sub(startTime).String()
|
2022-04-07 23:52:01 +08:00
|
|
|
infos["Max Volume Id"] = ms.Topo.GetMaxVolumeId()
|
2022-08-25 00:49:05 +08:00
|
|
|
|
|
|
|
ms.Topo.RaftServerAccessLock.RLock()
|
|
|
|
defer ms.Topo.RaftServerAccessLock.RUnlock()
|
|
|
|
|
2022-04-07 22:37:40 +08:00
|
|
|
if ms.Topo.RaftServer != nil {
|
|
|
|
args := struct {
|
|
|
|
Version string
|
|
|
|
Topology interface{}
|
|
|
|
RaftServer raft.Server
|
|
|
|
Stats map[string]interface{}
|
|
|
|
Counters *stats.ServerStats
|
|
|
|
VolumeSizeLimitMB uint32
|
|
|
|
}{
|
|
|
|
util.Version(),
|
2022-07-22 17:18:33 +08:00
|
|
|
ms.Topo.ToInfo(),
|
2022-04-07 22:37:40 +08:00
|
|
|
ms.Topo.RaftServer,
|
|
|
|
infos,
|
|
|
|
serverStats,
|
|
|
|
ms.option.VolumeSizeLimitMB,
|
|
|
|
}
|
|
|
|
ui.StatusTpl.Execute(w, args)
|
|
|
|
} else if ms.Topo.HashicorpRaft != nil {
|
|
|
|
args := struct {
|
|
|
|
Version string
|
|
|
|
Topology interface{}
|
|
|
|
RaftServer *hashicorpRaft.Raft
|
|
|
|
Stats map[string]interface{}
|
|
|
|
Counters *stats.ServerStats
|
|
|
|
VolumeSizeLimitMB uint32
|
|
|
|
}{
|
|
|
|
util.Version(),
|
2022-07-22 17:18:33 +08:00
|
|
|
ms.Topo.ToInfo(),
|
2022-04-07 22:37:40 +08:00
|
|
|
ms.Topo.HashicorpRaft,
|
|
|
|
infos,
|
|
|
|
serverStats,
|
|
|
|
ms.option.VolumeSizeLimitMB,
|
|
|
|
}
|
|
|
|
ui.StatusNewRaftTpl.Execute(w, args)
|
2015-03-20 01:39:22 +08:00
|
|
|
}
|
|
|
|
}
|