Ad Widget

Collapse

Importing maps with trigger map element types

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rtravis
    Junior Member
    • Nov 2013
    • 8

    #1

    Importing maps with trigger map element types

    Hi Zabbix gurus,

    I'm hoping this is me being ignorant and not actually a bug.

    I am running Zabbix-Server 2.2.0 binary precompiled for RHEL6 64bit and postgreSQL as the database backend.

    I am having an issue importing maps that contain map elements of trigger type. The import fails with the message 'Cannot find trigger "<trigger name>" used in map "<map name>". In my particular case, the exact message is this:

    Cannot find trigger "Interface APX Has Not Received Data in 300 s" used in map "Local network".

    The trigger does exist, however, as seen in this psql query:

    Code:
    zabbix=> select * from triggers where description = 'Interface APX Has Not Received Data in 300 s';
     triggerid |       expression        |                 description                  | url | status | value | priority | lastchange | comments | error | templateid | type | state | flags
    -----------+-------------------------+----------------------------------------------+-----+--------+-------+----------+------------+----------+-------+------------+------+-------+-------
         14296 | {14178} - {14179} > 300 | Interface APX Has Not Received Data in 300 s |     |      0 |     1 |        2 | 1384959768 |          |       |            |    0 |     0 |     4
    (1 row)
    In this case, I exported the map, deleted the map, then immediately tried to import the map. I'm not sure where to go from here.

    rt
  • rtravis
    Junior Member
    • Nov 2013
    • 8

    #2
    After doing a little more digging, it appears to only occur on triggers generated by low level discovery. I don't have issues with import/export on triggers that are defined in a template or created on a host. I wonder if this is an issue with the way that the frontend resolves the trigger expression.

    Comment

    • rtravis
      Junior Member
      • Nov 2013
      • 8

      #3
      So it appears the selectTriggers function in CImportReferencer.php filters out triggers that are created by a discovery rule. See below code:

      Code:
       $allowedTriggers = API::Trigger()->get(array(
                                      'triggerids' => $triggerIds,
                                      'output' => array('triggerid'),
                                      'filter' => array('flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_PROTOTYPE)),
                                      'editable' => true,
                                      'preservekeys' => true
                              ));
                              foreach ($this->triggersRefs as $name => $expressions) {
                                      foreach ($expressions as $expression => $triggerId) {
                                              if (!isset($allowedTriggers[$triggerId])) {
                                                      unset($this->triggersRefs[$name][$expression]);
                                              }
                                      }
                              }
      Is there a reason for this? I assume because the trigger can go away if the discovery fails or the discovered item is changed. For the import process, I added ZBX_FLAG_DISCOVERY_CREATED to the allowed flags, imported the map (which worked without a problem), and then reverted the php file back to its original state.

      Are bad thinks going to happen to me?

      rt

      Comment

      Working...