Page 1 of 1

Query to Display Custom Variable Values

Posted: Tue Oct 06, 2015 3:30 pm
by mrochelle
I'm trying to pull the custom variables created for particular host and service monitors. Would any one be able to provide the column to link the custom variable with the associated service or host? Following is what I have so far:
SELECT nagios_hosts.alias as HostName, nagios_customvariables.varname, nagios_customvariables.varvalue, nagios_customvariables.object_id
from nagios_hosts, nagios_customvariables
WHERE nagios_hosts.alias like 'Hostname%'
and nagios_customvariables.instance_id = nagios_hosts.instance_id
ORDER BY HostName ASC;

Thanks,
Marcus

Re: Query to Display Custom Variable Values

Posted: Tue Oct 06, 2015 5:01 pm
by scottwilkerson
These are available as backend API calls
getcustomhostvariablestatus
getcustomservicevariablestatus

However, to answer your question
that does look correct provided you are doing the match on alias and you are replacing
like 'Hostname%'
with the begining of the host alias you are trying to match