[Icinga-devel] Custom Variable and Rest API

Nicolás del Río ndelrio2000 at hotmail.com
Mon Mar 3 16:01:31 CET 2014


Hi all. I'm having trouble accessing hosts with some value in a Custom Variable via the Rest API. I have different hosts with a Custom variable name IsFailoverHost, where possible values are 0 or 1. I want to have all the hosts with value 1, and the result I'm having is:
{"result":[],"success":"true"}
Here is the command i'm using:
curl -g 'http://10.16.147.50/icinga-web/web/api/host/filter[AND(HOST_CUSTOMVARIABLE_NAME|=|ISFAILOVERHOST;AND(HOST_CUSTOMVARIABLE_VALUE|=|0))]/columns[HOST_NAME|HOST_CURRENT_STATE|HOST_OUTPUT|HOST_LAST_CHECK|HOST_NEXT_CHECK]/authkey=mIAFrxxxxxxxxxxxxxxxxxrK/json'
If I use  curl -g 'http://10.16.147.50/icinga-web/web/api/host/columns[HOST_NAME|HOST_CURRENT_STATE|HOST_OUTPUT|HOST_LAST_CHECK|HOST_NEXT_CHECK]/authkey=mIxxxxxxxxxxxxxxxxzrK/json' i get a list of all hosts:
{"result":[{"HOST_OUTPUT":"SMTP OK - 0.004 sec. response time","HOST_ID":"60","HOST_NAME":"trafMan","HOST_CURRENT_STATE":"0","HOST_LAST_CHECK":"2014-03-03 10:57:06","HOST_NEXT_CHECK":"2014-03-03 10:58:06","HOST_IS_PENDING":"0"},{"HOST_OUTPUT":"No route to host","HOST_ID":"61","HOST_NAME":"trafMan_failover","HOST_CURRENT_STATE":"1","HOST_LAST_CHECK":"2014-03-03 10:57:46","HOST_NEXT_CHECK":"2014-03-03 10:58:46","HOST_IS_PENDING":"0"}],"success":"true"}
My host defnition is:
define host{        host_name                       trafMan        address                         10.16.147.50        address6                        10.16.147.51        check_command                   check_smtp        check_interval                  5        retry_interval                  1        max_check_attempts              5        check_period                    24x7        notification_interval           30        notification_period             24x7        notification_options            d,u,r        _IsFailoverHost                 0
}
I will apreciate any help
Thanks in advanced 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.icinga.org/pipermail/icinga-devel/attachments/20140303/a86850c7/attachment.html>


More information about the icinga-devel mailing list