Greeting icinga users,
I am trying to create a notes_url for every check which will point
back to my internal documentation site. To make it generic, I want to use
icinga macros for service name,hostname,hostgroupname as url parameters.
Sample url with macros will be as follows:
notes_url = "
http://documents.tld?service=$SERVICEDESC$&host=$HOSTNAME$&hostgroup=$HOSTGROUPNAME$
"
While the service name and hostname macros get replaced with their
respective value in the url, the hostgroup name is not. Icingaweb2 shows:
http://documents.tld?service=Replication Lag On
MongoDB&host=mongo1.domain.tld&hostgroup=$HOSTGROUPNAME$"
As per
http://docs.icinga.org/latest/en/macrolist.html#macrolist-hostgroupname:
$HOSTGROUPNAME$ - The short name of the hostgroup that this host belongs
to. This value is taken from the hostgroup_name directive in the hostgroup
definition. If the host belongs to more than one hostgroup this macro will
contain the name of just one of them.
What am I doing wrong here? I also tried with $HOSTGROUPNAMES$ (A comma
separated list of the short names of all the hostgroups that this host
belongs to.)
Thanks
Service Definition:
/etc/icinga2/zones.d/global-zone/services.conf
apply Service "Replication Lag On MongoDB" {
import "generic-service"
check_command = "mongodb"
vars.mongodb_address = host.address
vars.mongodb_user = "test"
vars.mondodb_passwd = "test123"
vars.mongodb_database = "aggrdb"
vars.mongodb_perfdata = true
vars.mongodb_action = "replication_lag"
vars.mongodb_critical = "1800"
assign where "mongo-db" in host.groups
notes_url = "
http://documents.tld?service=$SERVICEDESC$&host=$HOSTNAME$&hostgroup=$HOSTGROUPNAME$
"
}
Host group definition:
/etc/icinga2/zones.d/global-zone/groups.conf
object HostGroup "mongo-db" {
assign where regex("^mongo*", host.name)
}
~SAfeer
SA by default
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users