I've been trying to use the {HOST.IP} macro within an sql statement of the Database monitor item.
SELECT blocked FROM ips LEFT JOIN devices ON ips.device_id=devices.id LEFT JOIN service_locations ON devices.service_location_id=service_locations.id WHERE ip_address = INET_ATON('{HOST.IP}')
It is not working. If I manually define something such as {$IP} = 10.0.0.1 and use {$IP} instead of {HOST.IP} the sql will function as expected.
Since the {HOST.IP} macro does not appear to support use within the query is there a way to generate the IP in the query without manually setting up the {$IP} macro on each host. Or is it possible to automatically create the {$IP} macro with the IP of the device as the value?
Thanks for your help!
(Edited for Clarity)
SELECT blocked FROM ips LEFT JOIN devices ON ips.device_id=devices.id LEFT JOIN service_locations ON devices.service_location_id=service_locations.id WHERE ip_address = INET_ATON('{HOST.IP}')
It is not working. If I manually define something such as {$IP} = 10.0.0.1 and use {$IP} instead of {HOST.IP} the sql will function as expected.
Since the {HOST.IP} macro does not appear to support use within the query is there a way to generate the IP in the query without manually setting up the {$IP} macro on each host. Or is it possible to automatically create the {$IP} macro with the IP of the device as the value?
Thanks for your help!
(Edited for Clarity)