diff --git a/pkg/es/node.go b/pkg/es/node.go index 89ebf0a..f9a377a 100644 --- a/pkg/es/node.go +++ b/pkg/es/node.go @@ -134,18 +134,41 @@ func NodeShow(conf *cfg.Config, nodename string) error { stat.Os.Cpu.LoadAverage["1m"], )}, {"Open FD's", *stat.Process.OpenFileDescriptors}, - {"Response time avg", fmt.Sprintf("%dns", *stat.AdaptiveSelection[id].AvgResponseTimeNs)}, + {"HTTP sesssions current/total", fmt.Sprintf("%d/%d", + *stat.Http.CurrentOpen, + *stat.Http.TotalOpened, + )}, + {"Traffic rx/tx", + printer.Bytes(*stat.Transport.RxSizeInBytes).String() + " / " + printer.Bytes(*stat.Transport.TxSizeInBytes).String()}, + {"Response time avg", time.Duration(*stat.AdaptiveSelection[id].AvgResponseTimeNs)}, {"Memory usage (used/avail)", humanize.Bytes(uint64(*stat.Os.Mem.UsedInBytes)) + " / " + humanize.Bytes(uint64(*stat.Os.Mem.TotalInBytes))}, + {"Search queries current/total", fmt.Sprintf("%d/%d", + stat.Indices.Search.QueryCurrent, + stat.Indices.Search.QueryTotal, + )}, + {"Search efficiency", stat.Indices.Search.QueryTimeInMillis / stat.Indices.Search.QueryTotal}, + {"Docs count", stat.Indices.Docs.Count}, + {"Merges current/total", fmt.Sprintf("%d/%d", + stat.Indices.Merges.Current, + stat.Indices.Merges.Total, + )}, + {"Merge docs count current/total", fmt.Sprintf("%d/%d", + stat.Indices.Merges.CurrentDocs, + stat.Indices.Merges.TotalDocs, + )}, + {"Merge size current/total", fmt.Sprintf("%s/%s", + printer.Bytes(stat.Indices.Merges.CurrentSizeInBytes).String(), + printer.Bytes(stat.Indices.Merges.TotalSizeInBytes).String(), + )}, + {"CircuitBreaker trip count", *stat.Breakers["fielddata"].Tripped}, } if len(stat.Fs.Data) > 0 { fs := stat.Fs.Data[0] - table.Entries = append(table.Entries, [][]any{ - {"Storage usage (used/avail)", - humanize.Bytes(uint64(*fs.AvailableInBytes)) + " / " + humanize.Bytes(uint64(*fs.TotalInBytes))}, - {"Storage mount", *fs.Mount}, - }...) + table.AddRow("Storage usage (used/avail)", + printer.Bytes(*fs.AvailableInBytes).String()+" / "+printer.Bytes(*fs.TotalInBytes).String()) + table.AddRow("Storage mount", *fs.Mount) } if err := table.Print(); err != nil { diff --git a/pkg/printer/bytes.go b/pkg/printer/bytes.go index cae3c58..6408f2c 100644 --- a/pkg/printer/bytes.go +++ b/pkg/printer/bytes.go @@ -22,8 +22,8 @@ type ByteSize struct { size uint64 } -func Bytes(size int64) ByteSize { - return ByteSize{size: uint64(size)} +func Bytes(size int64) *ByteSize { + return &ByteSize{size: uint64(size)} } func (b *ByteSize) String() string { diff --git a/pkg/printer/cast.go b/pkg/printer/cast.go index 8a3c27d..039b90a 100644 --- a/pkg/printer/cast.go +++ b/pkg/printer/cast.go @@ -38,12 +38,16 @@ func any2string(in any) string { return strconv.Itoa(val) case float64: return fmt.Sprintf("%.2f", val) + case float32: + return fmt.Sprintf("%.2f", val) case []string: return strings.Join(val, ",") case ByteSize: return val.String() case time.Time: return val.Format("2006-01-02 15:04:05") + case time.Duration: + return val.String() case []byte: return string(val) case nil: