-
New Feature Request
-
Resolution: Unresolved
-
Minor
-
None
-
2.0.9
I would like to see an improvement to media types to enable us to pass Zabbix macros to scripts in a more structured way. Today scripts that are called are passed three arguments. I would instead like to see that number be dynamic and we could choose to map up Zabbix macros to certain named arguments. Then our scripts like Python could pull those arguments in a more structured form such as dictionaries.
As a more sophisticated alternative you could pass macros in to XML or JSON encoded formats for us to then load and customize as needed. You could even allow us to do a POST of this data to the URL of our choosing without the need to write a custom script to accomplish that.
For example in actions today you can do something like this to try and structure something as JSON:
{ "event": [ { "name":"{TRIGGER.NAME}" }, { "trigger_name":"{TRIGGER.TEMPLATE.NAME}" }, { "trigger_group":"{TRIGGER.HOSTGROUP.NAME}" }, { "trigger_description":"{TRIGGER.DESCRIPTION}" }, { "id":"{TRIGGER.ID}" }, { "item_name":"{ITEM.NAME}" }, { "reference_url":"http://hostname/zabbix/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}" }, { "hostname":"{HOSTNAME}" }, { "ip":"{IPADDRESS}" }, { "value":"{TRIGGER.VALUE}" }, { "event_id":"{EVENT.ID}" }, { "severity":"{TRIGGER.SEVERITY}" }, { "datetime":"{EVENT.DATE} {EVENT.TIME}" } ] }
Something like this works and then you can use your language of choice to import this object, manipulate it as needed, and pass it along to your other systems. However, if you want to pass in something like ITEM.LASTVALUE it could be a log entry that contains multiple lines or characters that would make this structure invalid. That issue then forces you to use hacks such as creating your own unique delimiter and splitting values based off that. It works, but it would be much cleaner if we could simply bind macros of our choosing to named positional arguments or if you had a XML or JSON option. As users integrate Zabbix in to more third party systems the more this type of functionality becomes valuable.
- is duplicated by
-
ZBXNEXT-2712 Extra variables for alert scripts
- Closed