Hello,
I'm trying to monitor the number of ongoing calls on our telephone system. This value can be accessed via the phone systems api, which I can in fact do and display on a map. The problem is, after a set amount of time the cookie used to authenticate zabbix with the api expires, so I had to find a solution to keep the cookie updated. I did some reading and settled on this scenario:
-An item that collects the current cookie
-A macro that will contain the cookie, collected by the item
-A trigger that checks if the token has changed
-An action that will run a http post request against the Zabbix api with the method "usermacro.update", which will update the macro with the current value of the cookie item
The request works as so far as that I can in fact edit the macro value but I'm not sure about the syntax I have to use which will reference the latest value of my cookie item.
The request I'm using:
{"jsonrpc":"2.0",
"method":"usermacro.update",
"id":1,
"auth":"$Key",
"params":{
"hostmacroid": "783",
"value": "???"
}
}
------------------
My item is called "ApiCookieCollector", the key is called "api.cookie.collector", and the itemid is "32563" (if that matters) but I couldn't think of any combination of these things with ".last()" or whatever to get it to work. It will always output plain text instead of the item value. Is what I'm trying to do even possible?
Can anyone provide me with the correct syntax to use the item value?
I hope I could make myself clear.
ty
I'm trying to monitor the number of ongoing calls on our telephone system. This value can be accessed via the phone systems api, which I can in fact do and display on a map. The problem is, after a set amount of time the cookie used to authenticate zabbix with the api expires, so I had to find a solution to keep the cookie updated. I did some reading and settled on this scenario:
-An item that collects the current cookie
-A macro that will contain the cookie, collected by the item
-A trigger that checks if the token has changed
-An action that will run a http post request against the Zabbix api with the method "usermacro.update", which will update the macro with the current value of the cookie item
The request works as so far as that I can in fact edit the macro value but I'm not sure about the syntax I have to use which will reference the latest value of my cookie item.
The request I'm using:
{"jsonrpc":"2.0",
"method":"usermacro.update",
"id":1,
"auth":"$Key",
"params":{
"hostmacroid": "783",
"value": "???"
}
}
------------------
My item is called "ApiCookieCollector", the key is called "api.cookie.collector", and the itemid is "32563" (if that matters) but I couldn't think of any combination of these things with ".last()" or whatever to get it to work. It will always output plain text instead of the item value. Is what I'm trying to do even possible?
Can anyone provide me with the correct syntax to use the item value?
I hope I could make myself clear.
ty
Comment