# XPack Alerting :- Get Nodes Stats and Cluster State APIs in http input plugin

**URL:** <https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500>\
**Category:** Elasticsearch\
**Created:** [January 8, 2018, 10:55am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500 "2018-01-08T10:55:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shivanshu\_Bagga](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Shivanshu\_Bagga](https://discuss.elastic.co/u/Shivanshu_Bagga)\
**Post date:** [January 8, 2018, 10:55am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/1 "2018-01-08T10:55:16Z")

</div>

Hi,

I want to use both Nodes and Cluster State APIs in http input plugin for alerting.

```
{
  "trigger": {
    "schedule": {
      "interval": "10s"
    }
  },
  "input" : {
  "http" : {
    "request" : {
      "scheme": "https",
      "host" : "<hostname>",
      "port" : <port>,
      "path" : "/_nodes/stats",
      "params" : {
        "human" : "true" 
      }
    }
  }
},
  "actions": {
  }
}

```

Now how can I add other API "/\_cluster/stats" for input.

I also try chaining -

```
{
  "trigger": {
    "schedule": {
      "interval": "10s"
    }
  },
  "input" : {
  "chain" : {
    "inputs" : [ 
      {
        "first" : {
            "http" : {
      "request" : {
      "scheme": "https",
      "host" : "<hostname>",
      "port" : 9200,
      "path" : "/_nodes/stats",
      "params" : {
        "human" : "true" 
      }
    }
  }
        }
      },
      {
        "second" : {
    "http" : {
     "request" : {
      "scheme": "https",
      "host" : "<hostname>",
      "port" : 9200,
      "path" : "/_cluster/stats",
      "params" : {
        "human" : "true" 
      }
    }
  }
        }
      }
    ]
  }
}
}

```

Any luck?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 8, 2018, 11:20am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/2 "2018-01-08T11:20:55Z")

</div>

can you provide more context? Does an error occur when you store a watch? Does an error occur when the watch is executed? What error occurs? Is there a stacktrace? Can you provide the full output of the execute watch API?

It's nearly to impossible to help if you just post two JSON snippets without knowing more.

Thank you!

--Alex

---

<div class="post-metadata">

**Author:** ![Shivanshu\_Bagga](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Shivanshu\_Bagga](https://discuss.elastic.co/u/Shivanshu_Bagga)\
**Post date:** [January 8, 2018, 11:24am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/3 "2018-01-08T11:24:29Z")

</div>

Actually my question is , can we read two http input plugins in same watcher and if yes then How.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 8, 2018, 11:25am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/4 "2018-01-08T11:25:56Z")

</div>

using the chained input is indeed the way to go. If that does not work, we need the above mentioned information.

--Alex

---

<div class="post-metadata">

**Author:** ![Shivanshu\_Bagga](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Shivanshu\_Bagga](https://discuss.elastic.co/u/Shivanshu_Bagga)\
**Post date:** [January 8, 2018, 11:35am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/5 "2018-01-08T11:35:53Z")

</div>

If I'm not using chaining, then I access value of `{{ctx.payload.nodes.gdnF8AEHSXWISPlGy1FOCA.fs.total.available_in_bytes}}`

but after enable chaining its coming blank.(Check my first comment for chain json )

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 8, 2018, 11:36am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/6 "2018-01-08T11:36:53Z")

</div>

yes, because chaining requires you to add the name of the chain, in your example you used `first` and `second`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 5, 2018, 11:37am UTC](https://discuss.elastic.co/t/xpack-alerting-get-nodes-stats-and-cluster-state-apis-in-http-input-plugin/114500/7 "2018-02-05T11:37:22Z")

</div>

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