Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-9059

Add item preprocessing operation to set value of user macro

XMLWordPrintable

      It is a longstanding wish of the Zabbix community to have the ability to store the current value of an host item in a user macro (e.g. see ZBXNEXT-4449). 

      The disadvantage of these proposals is that they require a relatively high implementation effort:

      • The item editing GUI needs to be expanded.
      • A database change would be required.
      • ZBXNEXT-4449 even proposes a completely new macro type that would need to be implemented all across the server contexts.

      It occurred to me that there is a much easier way to implement this with minimal changes to the GUI and without any changes to macros.

      I propose to add an optional operation to item preprocessing that takes the current value of the preprocessing pipeline and stores it into the specified user macro. This would be by default a user macro of the host the item belongs to. As an option that can - for obvious security reasons - only be selected by users with the Super Admin role, the value could also be stored into a global user macro.

      The advantages of this proposal over the others should be apparent: You only need to add the very small GUI of an item preprocessing operation (with a name field for the macro and an option field to choose between host and global macro).

      No changes are required anywhere else in the frontend.

      Also, you can use the power of user macro contexts to store the value into a specific context macro.

      Why add the option to store values into global macros? I have a very common use case I have found no other way to solve: It is a typical requirement to change alerting between on duty and off duty hours.

      Zabbix currently has no builtin ability to know whether a day is a workday or a local holiday. My current workaround involves using a cron job with gcal to find out if it is a holiday and then use an external script to set a global macro with the current days working hours, which I can then query in my action trigger definitions. This requires Zabbix-API scripting and storing a super admin level API access token in the script, which is awkward.

      With the proposed feature, a would just add a dummy host that has my gcal script called as an external item that sets the required global macro. Way easier and much more secure.

            vmurzins Valdis Murzins
            NPGerman Norbert Püschel
            Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: