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

Global/host Macro value from custom SQl query

XMLWordPrintable

    • Icon: New Feature Request New Feature Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • None
    • None

      It would be nice if you could define a global or host macro based on a custom SQL query.

      I have added an additional table to the database that tracks the association of a support ticket with a specific triggerid or eventid. This allows me to track if a re-occurring event for a given trigger has already had a support ticket opened for it.

      If I could define a custom macro that was populated with a user defined sql query, We could use it in an action such as an email message.

      For example:
      Assume you have created an additional table in the zabbix database

      Create Table: CREATE TABLE `tickets` (
        `ticketid` bigint(20) unsigned NOT NULL,
        `triggerid` bigint(20) unsigned NOT NULL DEFAULT '0',
        `eventid` bigint(20) unsigned NOT NULL DEFAULT '0',
         PRIMARY KEY (`ticketid`),
         ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      
      

      If I were able to define two global macros similar to the following:
      {$TRIGGER.TICKET} = select ticketid from zabbix.tickets where triggerid=

      {TRIGGER.ID}

      order by ticketid dec limit 1;
      {$EVENT.TICKET} = select ticketid from zabbix.tickets where eventid=

      {EVENT.IDorder by ticketid dec limit 1}

      ;

      Then I would be able to generate emails for a triggered event that used the {$TRIGGER.TICKET} and or {$EVENT.TICKET} in the message and have the value of the above query in the message.

            Unassigned Unassigned
            cdslaughter Carl Slaughter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: