Netdata Community

${host} in alarm-notify.sh is using 'registry hostname' parameter

I noticed that in the alarm-notify.sh (specifically the Alerta section but I’m sure in general) the ${host} is being set to the value of ${args_host} which appears to be the same value of the registry hostname parameter. Is there a way to override this?

Hi! Yes, indeed the parameter is passed from the agent to the script and it’s always the registry hostname.

Could you describe the use case that needs to override it?

Thanks!

Hi @Manolis_Vasilakis,

When we configure the registry hostname we prefix a cluster-type to the host name. This is so that when we look up a host in the registry all the cluster types are together. For example, a postgres database node with a hostname of db01 would be registry hostname = postgres db01, etc.

We can modify the registry hostname to be just the FQDN but then we lose the ability to group like machines together.

Hi!

Ok, so you have a host, named for example db01, registry hostname is set to postgres db01, and you would like notifications sent to appear from db01 instead of postgres db01 ?

You could override the $host variable… It’s not particularly good advice :slight_smile: but here goes: you can set the $host variable in whatever you want inside /etc/health_alarm_notify.conf. This file will be executed from alarm-notify.sh so, it will override what the script gets from ${args_host}. But: it will only work for parent nodes (i.e. the nodes that actually send the notifications), because it will also override the $host variable value for any children that connect to this parent and send notifications through it…

I will let you know if a proper solution can be achieved.

Perhaps also host labels: Use host labels to organize systems, metrics, and alarms | Learn Netdata could be something you could use.