Couldn't directly reply to Joseph's response as I had subscribed for digest email.
======Joseph's response=============== ---------- Forwarded message ---------- From: "Joseph L. Casale" <[email protected]> To: "[email protected]" <[email protected]> Cc: Date: Thu, 5 May 2016 00:37:53 +0000 Subject: Re: [icinga-users] Hostgroup macro is not expanding in notes_url > To make it generic, I want to use icinga macros for service name,hostname,hostgroupname as url parameters. Given that a host and service is unique, does your documentation really depend on the hostgroup? ================================================ ==========================Reply================== While hostname + service is a unique combination, the number of hosts having the same check can be too many. Just like in configuration, we associate service documentation to hostgroups, as associating it with individual hosts is not practical. So the documentation system identifies only a map between hostgroups and services. If we have to settle for hostname+service combo, we will need an intermediary system to find out the associated hostgroups for that host and forward the request to the corresponding documentation Regards ~SAfeer SA by default On Thu, May 5, 2016 at 1:25 AM, Safeer CM <[email protected]> wrote: > 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
