# Use hostname as Display name

**URL:** <https://community.grafana.com/t/use-hostname-as-display-name/132628>\
**Category:** Zabbix\
**Tags:** templating\
**Created:** [September 21, 2024, 7:32am UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628 "2024-09-21T07:32:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lishan2194](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@lishan2194](https://community.grafana.com/u/lishan2194)\
**Post date:** [September 21, 2024, 7:32am UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/1 "2024-09-21T07:32:36Z")

</div>

Hello all,  
I am using the Zabbix data source. I am using this Zabbix data for the bar chart, and I am using multiple queries to build multiple bars on the chart. Unfortunately, I am unable to change the display name for the different bars

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/e/6/e64d50c2667ec3dbadb7abc55a87ad3b9da72a08.png)

as we can see in the image display name is aggregateBy(1d, avg)  
i want to change with its host name which i have selected.

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [September 22, 2024, 10:50am UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/2 "2024-09-22T10:50:03Z")

</div>

Can you display the output here in table format (.csv if possible)? Have you tried working through the different transformations that Grafana offers? Sometimes you need to ‘stack’ several in order to achieve your desired result.

---

<div class="post-metadata">

**Author:** ![isaqueprofeta](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/isaqueprofeta/32/38142_2.png) [@isaqueprofeta](https://community.grafana.com/u/isaqueprofeta)\
**Post date:** [September 23, 2024, 8:31pm UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/3 "2024-09-23T20:31:15Z")

</div>

Well, when things are “Working as Intended” there’s some global variables for it, you should add a Function of `setAlias()` and add the `$__zbx_host_name` to it. It’ll be `setAlias($__zbx_host_name)` after your function of `aggregateBy(1d, avg)`

Normally it should work as bellow:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/2/6/262a7e84d7ba3be42e3a19fe5822c275343411a7.png)

But it seems that’s some bug is happening, since when using other functions, the global variable turns into a pure string:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/8/2/82e4aa8ec013e030fbff7f884f46b1b35879beb5.png)

I just filled a bug for you, let’s see if the developers fix it for us: [Global plug-in variables ("$\_\_zbx") stop working when using more than one Function · Issue #1885 · grafana/grafana-zabbix · GitHub](https://github.com/grafana/grafana-zabbix/issues/1885)

More information on the options for naming btw, look for “Alias” under [Functions - Grafana-Zabbix Documentation](https://grafana.github.io/grafana-zabbix/reference/functions/)

---

<div class="post-metadata">

**Author:** ![lishan2194](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@lishan2194](https://community.grafana.com/u/lishan2194)\
**Post date:** [September 25, 2024, 1:30pm UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/4 "2024-09-25T13:30:41Z")

</div>

> [@isaqueprofeta](#):
>
> `$__zbx_host_name`

Hello

i have data like this :

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/b/bb304fd343332f78a3d1181bf740a85c42a52ea0.png)

i have data like this.

---

<div class="post-metadata">

**Author:** ![lishan2194](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@lishan2194](https://community.grafana.com/u/lishan2194)\
**Post date:** [September 25, 2024, 1:41pm UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/5 "2024-09-25T13:41:36Z")

</div>

Hello,  
Data in csv format is 🙂  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/e/0/e079f73a9db5365c1aea62f7ea2dbf52ff18976e.png)

yes i have try but that things are not working.  
Like :

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/6/d/6d95749ae149475fe90445e6b4cbeac85d611f69.png)

but this is not working.  
because i have multiple query’s. if i change this, this it is apply to all.

---

<div class="post-metadata">

**Author:** ![isaqueprofeta](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/isaqueprofeta/32/38142_2.png) [@isaqueprofeta](https://community.grafana.com/u/isaqueprofeta)\
**Post date:** [September 26, 2024, 1:30pm UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/6 "2024-09-26T13:30:22Z")

</div>

Please, try to focus a little more… I’ll try to summarize what I said on the other post:

1 - When you use Zabbix’s Plugin Functions like aggregateBy() it substitutes the default Item Metric name  
2 - The Zabbix Plugin’s Functions provides the `$__zbx_host_name` to be used on setAlias() function to correct the change from other Functions  
3 - The provided solution from Zabbix Plugin’s Functions seems to be bugged, and a [Bug Report was already filled](https://github.com/grafana/grafana-zabbix/issues/1885)

I don’t see any other ways to help in your case, since the “right answer” is clouded by a Software Bug.

---

<div class="post-metadata">

**Author:** ![isaqueprofeta](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/isaqueprofeta/32/38142_2.png) [@isaqueprofeta](https://community.grafana.com/u/isaqueprofeta)\
**Post date:** [October 28, 2024, 3:59am UTC](https://community.grafana.com/t/use-hostname-as-display-name/132628/7 "2024-10-28T03:59:32Z")

</div>


