package master_ui
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/util"
"html/template"
"strconv"
"strings"
)
func percentFrom(total uint64, part_of uint64) string {
return fmt.Sprintf("%.2f", (float64(part_of)/float64(total))*100)
}
func join(data []int64) string {
var ret []string
for _, d := range data {
ret = append(ret, strconv.Itoa(int(d)))
}
return strings.Join(ret, ",")
}
var funcMap = template.FuncMap{
"join": join,
"bytesToHumanReadable": util.BytesToHumanReadable,
"percentFrom": percentFrom,
}
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`
SeaweedFS {{ .Version }}
Disk Stats
Path |
Disk |
Total |
Free |
Usage |
{{ range .DiskStatuses }}
{{ .Dir }} |
{{ .DiskType }} |
{{ bytesToHumanReadable .All }} |
{{ bytesToHumanReadable .Free }} |
{{ percentFrom .All .Used}}% |
{{ end }}
System Stats
Masters |
{{.Masters}} |
Weekly # ReadRequests |
{{ .Counters.ReadRequests.WeekCounter.ToList | join }} |
Daily # ReadRequests |
{{ .Counters.ReadRequests.DayCounter.ToList | join }} |
Hourly # ReadRequests |
{{ .Counters.ReadRequests.HourCounter.ToList | join }} |
Last Minute # ReadRequests |
{{ .Counters.ReadRequests.MinuteCounter.ToList | join }} |
{{ range $key, $val := .Stats }}
{{ $key }} |
{{ $val }} |
{{ end }}
Volumes
Id |
Collection |
Disk |
Data Size |
Files |
Trash |
TTL |
ReadOnly |
{{ range .Volumes }}
{{ .Id }} |
{{ .Collection }} |
{{ .DiskType }} |
{{ bytesToHumanReadable .Size }} |
{{ .FileCount }} |
{{ .DeleteCount }} / {{bytesToHumanReadable .DeletedByteCount}} |
{{ .Ttl }} |
{{ .ReadOnly }} |
{{ end }}
Remote Volumes
Id |
Collection |
Size |
Files |
Trash |
Remote |
Key |
{{ range .RemoteVolumes }}
{{ .Id }} |
{{ .Collection }} |
{{ bytesToHumanReadable .Size }} |
{{ .FileCount }} |
{{ .DeleteCount }} / {{bytesToHumanReadable .DeletedByteCount}} |
{{ .RemoteStorageName }} |
{{ .RemoteStorageKey }} |
{{ end }}
Erasure Coding Shards
Id |
Collection |
Shard Size |
Shards |
CreatedAt |
{{ range .EcVolumes }}
{{ .VolumeId }} |
{{ .Collection }} |
{{ bytesToHumanReadable .ShardSize }} |
{{ .ShardIdList }} |
{{ .CreatedAt.Format "02 Jan 06 15:04 -0700" }} |
{{ end }}
`))