mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 05:04:18 +02:00
add es version to status output
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -4,4 +4,4 @@
|
||||
- Fix index names custom completion
|
||||
- add cluster default <name> which would add a flag to the config, so that no -C is needed subsequently
|
||||
- add `cluster stats` from `/_cluster/stats` like mem, procs, open files, num indices, shards etc
|
||||
- add version[s] to `cluster status`
|
||||
or add these to `cluster status`, maybe add a `--stats` to include stats there?
|
||||
|
||||
@@ -129,11 +129,20 @@ func ClusterStatus(conf *cfg.Config) error {
|
||||
|
||||
slog.Debug("ES result", "cluster health", res)
|
||||
|
||||
info, err := es.Info().
|
||||
Header("content-type", "application/json").
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get cluster info: %s", err)
|
||||
}
|
||||
|
||||
table := NewTable(2, 5)
|
||||
table.Addheaders(cluster, "status")
|
||||
|
||||
table.entries = [][]string{
|
||||
{"Cluster Name", Colorize(*&res.Status.Name, res.ClusterName)},
|
||||
{"ES Version", fmt.Sprintf("%s", info.Version.Int)},
|
||||
{"Active Shards", fmt.Sprintf("%d", res.ActiveShards)},
|
||||
{"Active Primary Shards", fmt.Sprintf("%d", res.ActivePrimaryShards)},
|
||||
{"Indicies", fmt.Sprintf("%d", len(res.Indices))},
|
||||
|
||||
Reference in New Issue
Block a user