# set threshold values for metric output

**URL:** <https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542>\
**Category:** Sensu Classic (EOL)\
**Created:** [February 11, 2016, 12:57pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542 "2016-02-11T12:57:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [February 11, 2016, 12:57pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/1 "2016-02-11T12:57:36Z")

</div>

Hi All,

I had set up sensu,graphite,sensu client-All works fine.

Now i want to send alerts from sensu.And the checks i am using from sensu-plugins repo.

One of check command is :/usr/bin/env /etc/sensu/plugins/metrics-memory-percent.rb --scheme stats.:::name:::.memory([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin))

sensu-client2.memory\_percent.free 6.234994848082251 1455194786

sensu-client2.memory\_percent.buffers 5.197360829290261 1455194786

sensu-client2.memory\_percent.cached 47.49373753506521 1455194786 sensu-client2.memory\_percent.dirty 0.002144504910405648 1455194786 sensu-client2.memory\_percent.swapUsed 0.37960228391415635 1455194786 sensu-client2.memory\_percent.usedWOBuffersCaches 41.07390678756228 1455194786 sensu-client2.memory\_percent.freeWOBuffersCaches 58.92609321243772 1455194786

As the output is in metric format , I am bit dilemma how can this be set with threshold so, i can set alert.

Please help me out.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [February 18, 2016, 7:04am UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/2 "2016-02-18T07:04:44Z")

</div>

HI All,

I came to know , we have [https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb](https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb) can be used to send alerts from graphite by using graphite’s data.

But I am not sure where and how to create this check/alert .

Request anyone to suggest.

> **···**
>
> On Thursday, February 11, 2016 at 6:27:36 PM UTC+5:30, kumar kittu wrote:
> 
> > Hi All,
> 
> > I had set up sensu,graphite,sensu client-All works fine.
> 
> > Now i want to send alerts from sensu.And the checks i am using from sensu-plugins repo.
> 
> > 
> 
> > One of check command is :/usr/bin/env /etc/sensu/plugins/metrics-memory-percent.rb --scheme stats.:::name:::.memory([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin))
> 
> > 
> 
> > 
> 
> > sensu-client2.memory\_percent.free 6.234994848082251 1455194786
> 
> > sensu-client2.memory\_percent.buffers 5.197360829290261 1455194786
> 
> > sensu-client2.memory\_percent.cached 47.49373753506521 1455194786 sensu-client2.memory\_percent.dirty 0.002144504910405648 1455194786 sensu-client2.memory\_percent.swapUsed 0.37960228391415635 1455194786 sensu-client2.memory\_percent.usedWOBuffersCaches 41.07390678756228 1455194786 sensu-client2.memory\_percent.freeWOBuffersCaches 58.92609321243772 1455194786
> 
> > 
> 
> > As the output is in metric format , I am bit dilemma how can this be set with threshold so, i can set alert.
> 
> > 
> 
> > Please help me out.
> 
> > 
> 
> > Thanks in advance

---

<div class="post-metadata">

**Author:** ![Joel\_Smith1](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Joel\_Smith1](https://discourse.sensu.io/u/Joel_Smith1)\
**Post date:** [February 18, 2016, 1:25pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/3 "2016-02-18T13:25:33Z")

</div>

Have you thought about using the check for the alerting? check-memory.rb which calls check-memory.sh will allow you to set the threshold required for warning and critcal:

check-memory.sh [-w value -c value -p -h]

```
    -w --> Warning MB < value
    -c --> Critical MB < value
    -p --> print out performance data
    -h --> print this help screen

```

and will then alert accordingly using your defined handlers

> **···**
>
> On Thursday, 11 February 2016 12:57:36 UTC, kumar kittu wrote:
> 
> > Hi All,
> 
> > I had set up sensu,graphite,sensu client-All works fine.
> 
> > Now i want to send alerts from sensu.And the checks i am using from sensu-plugins repo.
> 
> > 
> 
> > One of check command is :/usr/bin/env /etc/sensu/plugins/metrics-memory-percent.rb --scheme stats.:::name:::.memory([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin))
> 
> > 
> 
> > 
> 
> > sensu-client2.memory\_percent.free 6.234994848082251 1455194786
> 
> > sensu-client2.memory\_percent.buffers 5.197360829290261 1455194786
> 
> > sensu-client2.memory\_percent.cached 47.49373753506521 1455194786 sensu-client2.memory\_percent.dirty 0.002144504910405648 1455194786 sensu-client2.memory\_percent.swapUsed 0.37960228391415635 1455194786 sensu-client2.memory\_percent.usedWOBuffersCaches 41.07390678756228 1455194786 sensu-client2.memory\_percent.freeWOBuffersCaches 58.92609321243772 1455194786
> 
> > 
> 
> > As the output is in metric format , I am bit dilemma how can this be set with threshold so, i can set alert.
> 
> > 
> 
> > Please help me out.
> 
> > 
> 
> > Thanks in advance

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [February 18, 2016, 2:03pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/4 "2016-02-18T14:03:59Z")

</div>

Yes , i thought using check for alert along with handlers.  
Here i am sending metric data to graphite from sensu(([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fsensu-plugins%2Fsensu-plugins-memory-checks%2Ftree%2Fmaster%2Fbin&sa=D&sntz=1&usg=AFQjCNEaIzdNv0XrHXP-hBASyJ0M02z_vw)) and not check-memory.rb.

So .for sending alerts i need either use a separate check, such as [https://github.com/sensu-plugins/sensu-plugins-memory-checks/blob/master/bin/check-memory.sh](https://github.com/sensu-plugins/sensu-plugins-memory-checks/blob/master/bin/check-memory.sh) or would need to alert from the graphite data using something like "check-graphite"[https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb](https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb)

Using check-memory.rb will be duplicate and hence i need to go with check-graphite.rb.

Request you to suggest the steps.

Thanks in advance

> **···**
>
> On Thursday, February 18, 2016 at 6:55:33 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> 
> > Have you thought about using the check for the alerting? check-memory.rb which calls check-memory.sh will allow you to set the threshold required for warning and critcal:
> > 
> > check-memory.sh [-w value -c value -p -h]
> > 
> > ```
> > -w --> Warning MB < value
> > -c --> Critical MB < value
> > -p --> print out performance data
> > -h --> print this help screen
> > 
> > ```
> > 
> > and will then alert accordingly using your defined handlers
> > 
> > On Thursday, 11 February 2016 12:57:36 UTC, kumar kittu wrote:
> > 
> > > Hi All,
> 
> > > I had set up sensu,graphite,sensu client-All works fine.
> 
> > > Now i want to send alerts from sensu.And the checks i am using from sensu-plugins repo.
> 
> > >
> 
> > > One of check command is :/usr/bin/env /etc/sensu/plugins/metrics-memory-percent.rb --scheme stats.:::name:::.memory([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin))
> 
> > >
> 
> > >
> 
> > > sensu-client2.memory\_percent.free 6.234994848082251 1455194786
> 
> > > sensu-client2.memory\_percent.buffers 5.197360829290261 1455194786
> 
> > > sensu-client2.memory\_percent.cached 47.49373753506521 1455194786 sensu-client2.memory\_percent.dirty 0.002144504910405648 1455194786 sensu-client2.memory\_percent.swapUsed 0.37960228391415635 1455194786 sensu-client2.memory\_percent.usedWOBuffersCaches 41.07390678756228 1455194786 sensu-client2.memory\_percent.freeWOBuffersCaches 58.92609321243772 1455194786
> 
> > >
> 
> > > As the output is in metric format , I am bit dilemma how can this be set with threshold so, i can set alert.
> 
> > >
> 
> > > Please help me out.
> 
> > >
> 
> > > Thanks in advance

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [February 19, 2016, 2:22pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/5 "2016-02-19T14:22:53Z")

</div>

HI All,  
Please help me out

> **···**
>
> On Thursday, February 18, 2016 at 7:34:00 PM UTC+5:30, kumar kittu wrote:
> 
> > Yes , i thought using check for alert along with handlers.  
> > Here i am sending metric data to graphite from sensu(([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fsensu-plugins%2Fsensu-plugins-memory-checks%2Ftree%2Fmaster%2Fbin&sa=D&sntz=1&usg=AFQjCNEaIzdNv0XrHXP-hBASyJ0M02z_vw)) and not check-memory.rb.
> 
> > 
> 
> > So .for sending alerts i need either use a separate check, such as [https://github.com/sensu-plugins/sensu-plugins-memory-checks/blob/master/bin/check-memory.sh](https://github.com/sensu-plugins/sensu-plugins-memory-checks/blob/master/bin/check-memory.sh) or would need to alert from the graphite data using something like "check-graphite"[https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb](https://github.com/sensu-plugins/sensu-plugins-graphite/blob/master/bin/check-graphite.rb)
> 
> > 
> 
> > Using check-memory.rb will be duplicate and hence i need to go with check-graphite.rb.
> 
> > 
> 
> > Request you to suggest the steps.
> 
> > Thanks in advance
> 
> > On Thursday, February 18, 2016 at 6:55:33 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> > 
> > > Have you thought about using the check for the alerting? check-memory.rb which calls check-memory.sh will allow you to set the threshold required for warning and critcal:
> > > 
> > > check-memory.sh [-w value -c value -p -h]
> > > 
> > > ```
> > > -w --> Warning MB < value
> > > -c --> Critical MB < value
> > > -p --> print out performance data
> > > -h --> print this help screen
> > > 
> > > ```
> > > 
> > > and will then alert accordingly using your defined handlers
> > > 
> > > On Thursday, 11 February 2016 12:57:36 UTC, kumar kittu wrote:
> > > 
> > > > Hi All,
> 
> > > > I had set up sensu,graphite,sensu client-All works fine.
> 
> > > > Now i want to send alerts from sensu.And the checks i am using from sensu-plugins repo.
> 
> > > >
> 
> > > > One of check command is :/usr/bin/env /etc/sensu/plugins/metrics-memory-percent.rb --scheme stats.:::name:::.memory([https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin](https://github.com/sensu-plugins/sensu-plugins-memory-checks/tree/master/bin))
> 
> > > >
> 
> > > >
> 
> > > > sensu-client2.memory\_percent.free 6.234994848082251 1455194786
> 
> > > > sensu-client2.memory\_percent.buffers 5.197360829290261 1455194786
> 
> > > > sensu-client2.memory\_percent.cached 47.49373753506521 1455194786 sensu-client2.memory\_percent.dirty 0.002144504910405648 1455194786 sensu-client2.memory\_percent.swapUsed 0.37960228391415635 1455194786 sensu-client2.memory\_percent.usedWOBuffersCaches 41.07390678756228 1455194786 sensu-client2.memory\_percent.freeWOBuffersCaches 58.92609321243772 1455194786
> 
> > > >
> 
> > > > As the output is in metric format , I am bit dilemma how can this be set with threshold so, i can set alert.
> 
> > > >
> 
> > > > Please help me out.
> 
> > > >
> 
> > > > Thanks in advance

---

<div class="post-metadata">

**Author:** ![Joel\_Smith1](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Joel\_Smith1](https://discourse.sensu.io/u/Joel_Smith1)\
**Post date:** [March 2, 2016, 9:48am UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/6 "2016-03-02T09:48:32Z")

</div>

Why is it an issue duplicating the check? You either have a second check querying graphite metrics or you have a check querying the memory. The model of sensu separates out metric collection and checks, with different handlers for both.

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [March 16, 2016, 11:39am UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/7 "2016-03-16T11:39:15Z")

</div>

Thanks Joel.

Sorry for the late reply.

I am following “create metric analysis check from” [https://sensuapp.org/docs/0.20/getting-started-with-checks/](https://sensuapp.org/docs/0.20/getting-started-with-checks/) and so bit confused whether to install graphite-api or not for querying the metrics.If yes,then please help me for installing/configuring graphite-api ,as i searched but could not find relevant documents.

Please enlighten .

> **···**
>
> On Wednesday, March 2, 2016 at 3:18:32 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> 
> > Why is it an issue duplicating the check? You either have a second check querying graphite metrics or you have a check querying the memory. The model of sensu separates out metric collection and checks, with different handlers for both.

---

<div class="post-metadata">

**Author:** ![Joel\_Smith1](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Joel\_Smith1](https://discourse.sensu.io/u/Joel_Smith1)\
**Post date:** [March 16, 2016, 11:51am UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/8 "2016-03-16T11:51:20Z")

</div>

graphite-api is used if you want to run graphite without the web interface. If you already have graphite installed, you already have the functionality of graphite-api.

For me, the installation is just a matter of doing

apt-get install graphite-api

``

and then pointing to the relevant directories.

> **···**
>
> > >
> 
> On Wednesday, 16 March 2016 11:39:15 UTC, kumar kittu wrote:
> 
> > Thanks Joel.
> 
> > Sorry for the late reply.
> 
> > 
> 
> > I am following “create metric analysis check from” [https://sensuapp.org/docs/0.20/getting-started-with-checks/](https://sensuapp.org/docs/0.20/getting-started-with-checks/) and so bit confused whether to install graphite-api or not for querying the metrics.If yes,then please help me for installing/configuring graphite-api ,as i searched but could not find relevant documents.
> 
> > Please enlighten .
> 
> > On Wednesday, March 2, 2016 at 3:18:32 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> > 
> > > Why is it an issue duplicating the check? You either have a second check querying graphite metrics or you have a check querying the memory. The model of sensu separates out metric collection and checks, with different handlers for both.

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [March 16, 2016, 12:15pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/9 "2016-03-16T12:15:49Z")

</div>

Thanks Joel.

I guess i need to use pip install graphite-api as yum is not working (saying no package).

Also please confirm the port for graphite-api.

> **···**
>
> On Wednesday, March 16, 2016 at 5:21:20 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> 
> > graphite-api is used if you want to run graphite without the web interface. If you already have graphite installed, you already have the functionality of graphite-api.
> > 
> > For me, the installation is just a matter of doing
> > 
> > apt-get install graphite-api
> 
> > ``
> 
> > and then pointing to the relevant directories.
> > 
> > > >
> > 
> > On Wednesday, 16 March 2016 11:39:15 UTC, kumar kittu wrote:
> > 
> > > Thanks Joel.
> 
> > > Sorry for the late reply.
> 
> > >
> 
> > > I am following “create metric analysis check from” [https://sensuapp.org/docs/0.20/getting-started-with-checks/](https://sensuapp.org/docs/0.20/getting-started-with-checks/) and so bit confused whether to install graphite-api or not for querying the metrics.If yes,then please help me for installing/configuring graphite-api ,as i searched but could not find relevant documents.
> 
> > > Please enlighten .
> 
> > > On Wednesday, March 2, 2016 at 3:18:32 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> > > 
> > > > Why is it an issue duplicating the check? You either have a second check querying graphite metrics or you have a check querying the memory. The model of sensu separates out metric collection and checks, with different handlers for both.

---

<div class="post-metadata">

**Author:** ![Hari\_krishna\_kumar](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@Hari\_krishna\_kumar](https://discourse.sensu.io/u/Hari_krishna_kumar)\
**Post date:** [March 16, 2016, 2:02pm UTC](https://discourse.sensu.io/t/set-threshold-values-for-metric-output/542/10 "2016-03-16T14:02:02Z")

</div>

HI,

I am getting below error when running :ruby check-graphite-data.rb -s localhost:9001 -t ‘highestCurrent(internal.dev3.\*.1.disk-usage.root.used,9)’ -w 18 -c 40 -a 120

Check failed to run: Connection refused - connect(2) for “localhost” port 9001, [“/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:879:in `initialize'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:879:in `open’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:879:in `block in connect'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/timeout.rb:75:in `timeout’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:878:in `connect'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:863:in `do\_start’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/net/http.rb:852:in `start'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:313:in `open\_http’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:724:in `buffer_open'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:210:in `block in open\_loop’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:208:in `catch'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:208:in `open\_loop’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:149:in `open_uri'", "/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:704:in `open’”, “/usr/local/rvm/rubies/ruby-2.1.8/lib/ruby/2.1.0/open-uri.rb:34:in `open'", "/usr/local/rvm/gems/ruby-2.1.8/gems/sensu-plugins-graphite-0.0.7/lib/sensu-plugins-graphite/graphite_proxy/proxy.rb:87:in `retrieve\_data!'”, “check-graphite-data.rb:61:in `run'", "/usr/local/rvm/gems/ruby-2.1.8/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in class:CLI’”]

Please enlight me.

> **···**
>
> On Wednesday, March 16, 2016 at 5:45:49 PM UTC+5:30, kumar kittu wrote:
> 
> > Thanks Joel.
> 
> > I guess i need to use pip install graphite-api as yum is not working (saying no package).
> 
> > Also please confirm the port for graphite-api.
> > 
> > On Wednesday, March 16, 2016 at 5:21:20 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> > 
> > > graphite-api is used if you want to run graphite without the web interface. If you already have graphite installed, you already have the functionality of graphite-api.
> > > 
> > > For me, the installation is just a matter of doing
> > > 
> > > apt-get install graphite-api
> 
> > > ``
> 
> > > and then pointing to the relevant directories.
> > > 
> > > > >
> > > 
> > > On Wednesday, 16 March 2016 11:39:15 UTC, kumar kittu wrote:
> > > 
> > > > Thanks Joel.
> 
> > > > Sorry for the late reply.
> 
> > > >
> 
> > > > I am following “create metric analysis check from” [https://sensuapp.org/docs/0.20/getting-started-with-checks/](https://sensuapp.org/docs/0.20/getting-started-with-checks/) and so bit confused whether to install graphite-api or not for querying the metrics.If yes,then please help me for installing/configuring graphite-api ,as i searched but could not find relevant documents.
> 
> > > > Please enlighten .
> 
> > > > On Wednesday, March 2, 2016 at 3:18:32 PM UTC+5:30, [joel....@nhs.net](mailto:joel....@nhs.net) wrote:
> > > > 
> > > > > Why is it an issue duplicating the check? You either have a second check querying graphite metrics or you have a check querying the memory. The model of sensu separates out metric collection and checks, with different handlers for both.
