Watcher Script for Monitoring Shard Size

I'm trying to create a Watcher Script to monitor the Shard size for all the indices. Example - If shard size reaches more than 30 GB, an alert should get trigger from Watcher

**GET _cat/shards?v&s=store:desc&format=json&pretty**

I'm using the above command to get the shards store size for the indices currently configured and it is returning the result in the below format .

Is this possible to compare the values like 10.7 gb , 972.4mb, 333.9kb in watcher script and alert should trigger if shard store size exceeds more than 30gb

Tried using the below condition. But it is not providing the expected result. Thanks for the help

      "ctx.payload.data.0.store": {
         "gt": "30gb"
**Sample Output payload** 
     "data": [
          {
              "index" : "aaa",
              "shard" : "0",
              "prirep" : "p",
              "state" : "STARTED",
              "docs" : "136633",
              "store" : "10.7gb",
              "ip" : "",
              "node" : ""
            },
            {
              "index" : "yyyyy",
              "shard" : "0",
              "prirep" : "r",
              "state" : "STARTED",
              "docs" : "33144",
              "store" : "972.4mb",
              "ip" : "",
              "node" : ""
            },
           {
              "index" : "zzz",
              "shard" : "3",
              "prirep" : "r",
              "state" : "STARTED",
              "docs" : "313",
              "store" : "333.9kb",
              "ip" : "",
              "node" : ""
            }

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