mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 14:14:23 +02:00
add es version to status output
This commit is contained in:
@@ -124,16 +124,25 @@ func ClusterStatus(conf *cfg.Config) error {
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to getcluster health: %s", err)
|
||||
return fmt.Errorf("failed to get cluster health: %s", err)
|
||||
}
|
||||
|
||||
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