Skip to content

Instantly share code, notes, and snippets.

@renshuki
Created April 8, 2020 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renshuki/98885ccac0bed0515f735eb2c81b1921 to your computer and use it in GitHub Desktop.
Save renshuki/98885ccac0bed0515f735eb2c81b1921 to your computer and use it in GitHub Desktop.
Elasticsearch / Watcher - Watcher to retrieve number of shards from _cluster/health
{
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  },
  "input" : {
    "http" : {
      "request" : {
        "host" : "localhost",
        "port" : 9200,
        "path" : "_cluster/health"
      }
    }
  },
  "actions": {
    "my-logging-action": {
      "logging": {
        "text": "There are {{ctx.payload.active_shards}} shards."
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment