cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shortened Hostnames as variables

i_g
Frequent Guest

Hello all. Using advice from this post:
https://community.dynatrace.com/t5/Open-Q-A/Custom-Host-Names-Remove-FQDN/m-p/188561
I've shortened all of our hostnames down and it worked really quite well. However, my main driver for this was removing the FQDN from alerts that end up in ServiceNow, and that continues to occur.

I'm currently using {host.name} in the Event Template title in Events Extraction, but I'm noticing that {hostname} and {host.hostname} do not fill and remain as such in the Problem when it generates. Unsure if this is related. 

Is there a way to get the shortened hostname into a variable for these fields please?

4 REPLIES 4

p_devulapalli
Leader

@i_g Can you please try the {dt.entity.host} parameter in the event template instead?

Phani Devulapalli

Hi mate. That just returned HOST-[identifierstring] 😞

@i_g Sorry, you are right, but interestingly when you look at the dt.event.title in the event details on the host  it does show the updated name but this does not get passed on to the problem 😄

p_devulapalli_0-1761889170577.png

 

Phani Devulapalli

t_pawlak
Champion

Hi,
you can try use custom metadata/kubernetes annotation.
I mean you have two option:

in Kubernetes: add an annotation to pod with the short name, e.g., short-hostname=web01 (on the node/pod—wherever you want to read it). Dynatrace ingests such metadata, so you can reference it in tags/naming rules 

In Non-K8s hosts: set custom host metadata/tag via OneAgent, e.g.
oneagentctl --set-host-property ShortHostname=web01 (or a tag ShortHostname=web01).
Then use that metadata (e.g., {ShortHostname}) in your naming/template instead of {host.name}.

Second option is transform {host.name} with a regex. You already send this example



Featured Posts