How to send number of shard , activeshard, reallocationg shard every day via watcher

Hello team,
I need to send email every day with below status. can i know how i can achieve this using watcher.

Kibana Health check for **Todays Date** is **Green / Red /Yellow**.

PFA for detail log ingestion and cluster status report

Cluster Name: ABC
number_of_data_nodes 12
active_primary_shards 4567
active_shards 9678
relocating_shards 0
initializing_shards 0
unassigned_shards 0
delayed_unassigned_shards 0
number_of_pending_tasks 0
active_shards_percent_as_number 100

Something like this:

POST _watcher/watch/_execute
{
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "1d"
      }
    },
    "input": {
      "http": {
        "request": {
          "scheme": "https",
          "host": "mycluster.es.northamerica-northeast1.gcp.elastic-cloud.com",
          "port": 9243,
          "method": "get",
          "path": "_cluster/stats",
          "headers": {},
          "auth": {
            "basic": {
              "username": "elastic",
              "password": "xxxxxx"
            }
          }
        }
      }
    },
    "condition": {
      "script": {
        "source": "return true;"
      }
    },
    "actions": {
      "displayResults": {
        "logging": {
          "level": "info",
          "text": """
             cluster name: {{ctx.payload.cluster_name}}
             number_of_hot_data_nodes: {{ctx.payload.nodes.count.data_hot}}
             active_primary_shards : {{ctx.payload.indices.shards.primaries}}
             """
        }
      }
    }
  }
}

and also see example here for some more advanced calculations, etc.

Hi @richcollier ,
Thanks for your confirmation. Can you please help me out for variable name for below fields.

GET _cat/nodes?v=true&s=name : ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name

GET /_cat/allocation?v=true&s=node : shards disk.indices disk.used disk.avail disk.total disk.percent host ip node

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.