# Sensu - influxdb - hostname variables

**URL:** <https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786>\
**Category:** Sensu Classic (EOL)\
**Created:** [March 21, 2017, 1:09am UTC](https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786 "2017-03-21T01:09:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Watroba](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jack\_Watroba](https://discourse.sensu.io/u/Jack_Watroba)\
**Post date:** [March 21, 2017, 1:09am UTC](https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786/1 "2017-03-21T01:09:43Z")

</div>

I’m working on moving from graphite to influxdb, and I set this up: [https://github.com/jhrv/sensu-influxdb-extension](https://github.com/jhrv/sensu-influxdb-extension) and it seems to be working. My issue is that previously we were using the client hostname in the metric output, ex. (host1.cpu.usage), but it seems with Influx, I would actually want the hostname passed as a tag opposed to being in the measurement name. Does anyone know if there’s a way to use some sort of hostname variable in the sensu config so it can resolve that client’s hostname when the check is run?

Thanks.

---

<div class="post-metadata">

**Author:** ![Eric\_Heydrick](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Eric\_Heydrick](https://discourse.sensu.io/u/Eric_Heydrick)\
**Post date:** [March 21, 2017, 5:13am UTC](https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786/2 "2017-03-21T05:13:12Z")

</div>

You could use [check token substitution](https://sensuapp.org/docs/latest/reference/checks.html#check-token-substitution) and add a tags attribute with the name of the client. In your check definition you would add:

…

“tags”: {

“hostname”: “:::name:::”

}

Alternatively whatever you use to configure the client could add a [tags section in the client config](https://github.com/jhrv/sensu-influxdb-extension#tags-optional) containing the hostname and that tag would be included with every metrics result.

> **···**
>
> On Mon, Mar 20, 2017 at 6:09 PM, Jack Watroba [jwatroba@improvementdirect.com](mailto:jwatroba@improvementdirect.com) wrote:
> 
> > I’m working on moving from graphite to influxdb, and I set this up: [https://github.com/jhrv/sensu-influxdb-extension](https://github.com/jhrv/sensu-influxdb-extension) and it seems to be working. My issue is that previously we were using the client hostname in the metric output, ex. (host1.cpu.usage), but it seems with Influx, I would actually want the hostname passed as a tag opposed to being in the measurement name. Does anyone know if there’s a way to use some sort of hostname variable in the sensu config so it can resolve that client’s hostname when the check is run?
> 
> > Thanks.

---

<div class="post-metadata">

**Author:** ![Jack\_Watroba](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jack\_Watroba](https://discourse.sensu.io/u/Jack_Watroba)\
**Post date:** [March 21, 2017, 7:01pm UTC](https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786/3 "2017-03-21T19:01:37Z")

</div>

Awesome, that worked great. Thanks!

> **···**
>
> On Monday, March 20, 2017 at 10:13:14 PM UTC-7, Eric Heydrick wrote:
> 
> > You could use [check token substitution](https://sensuapp.org/docs/latest/reference/checks.html#check-token-substitution) and add a tags attribute with the name of the client. In your check definition you would add:
> 
> > …
> 
> > “tags”: {
> 
> > “hostname”: “:::name:::”
> 
> > }
> 
> > 
> 
> > Alternatively whatever you use to configure the client could add a [tags section in the client config](https://github.com/jhrv/sensu-influxdb-extension#tags-optional) containing the hostname and that tag would be included with every metrics result.
> 
> > On Mon, Mar 20, 2017 at 6:09 PM, Jack Watroba [jwat...@improvementdirect.com](mailto:jwat...@improvementdirect.com) wrote:
> > 
> > > I’m working on moving from graphite to influxdb, and I set this up: [https://github.com/jhrv/sensu-influxdb-extension](https://github.com/jhrv/sensu-influxdb-extension) and it seems to be working. My issue is that previously we were using the client hostname in the metric output, ex. (host1.cpu.usage), but it seems with Influx, I would actually want the hostname passed as a tag opposed to being in the measurement name. Does anyone know if there’s a way to use some sort of hostname variable in the sensu config so it can resolve that client’s hostname when the check is run?
> 
> > > Thanks.
> 
> >

---

<div class="post-metadata">

**Author:** ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)\
**Post date:** [November 22, 2018, 2:07am UTC](https://discourse.sensu.io/t/sensu-influxdb-hostname-variables/786/4 "2018-11-22T02:07:50Z")

</div>


