Query to Display Custom Variable Values

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
mrochelle
Posts: 238
Joined: Fri May 04, 2012 11:20 am
Location: Heart of America

Query to Display Custom Variable Values

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Query to Display Custom Variable Values

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked