Hi All,
Is there a way to list the value of a given macro from all hosts regardless its a host level, template level or a global macro using a SQL query or API request?
For some reason, I cannot get it right in one go using usermacro.get API method.
I also tried using host.get >> selectMacros and template.get >> selectMacros and selectHosts.
host.get
This only gives me hostmacro, don't go a level down to find the corresponding inherited macro.
template.get
And this only gives me the template level macro, doesn't respect the hostlevel macro if set.
Am I doing something wrong?
FYI : I understand the fact that runtime macros can only get the value on the time of an event. I am only looking for the static ones here.
Is there a way to list the value of a given macro from all hosts regardless its a host level, template level or a global macro using a SQL query or API request?
For some reason, I cannot get it right in one go using usermacro.get API method.
I also tried using host.get >> selectMacros and template.get >> selectMacros and selectHosts.
host.get
PHP Code:
{
"jsonrpc" : "2.0",
"method" : "host.get",
"params" : {
"output" : [ "name" ],
"selectMacros" : [ "macro","value" ],
"groupids" : "XX",
"filter" : {
"macro" : [ "{$MEMORY.UTIL.CRIT}", "{$MEMORY.UTIL.MAX}" ]
}
},
"id" : 1
}
template.get
PHP Code:
{
"jsonrpc" : "2.0",
"method" : "template.get",
"params" : {
"output" : [ "host" ],
"templateids" : [ "XXXX" ],
"selectMacros" : [ "macro", "value" ],
"selectHosts" : ["name"]
},
"id" : 1
}
Am I doing something wrong?
FYI : I understand the fact that runtime macros can only get the value on the time of an event. I am only looking for the static ones here.