Full expression in API get.trigger function

XMLWordPrintable

    • Type: New Feature Request
    • Resolution: Duplicate
    • Priority: Trivial
    • None
    • Affects Version/s: 2.0.0
    • Component/s: API (A)

      Hi,

      From most backend systems you can create trigger expressions. You should only update them if there is a change, but the API call doesn't provide the full expression. I've build the following code that fixes the issue ugly, but a permanent solution would be better.

      my $expression = $triggers->{$key}->

      {expression};
      if (!defined $expression) {next;}
      foreach my $function (@{$triggers->{$key}->{functions}}) {
      my $itemid = $function->{itemid};
      foreach my $item (@{$triggers->{$key}->{items}}) {
      if($item->{itemid} eq $itemid){
      foreach my $host (@{$triggers->{$key}->{hosts}}){
      if($host->{hostid} eq $item->{hostid}){
      my $realfunction = $host->{host}.":".$item->{key_}.".".$function->{function}."($function->{parameter})";
      $expression =~ s/$function->{functionid}/$realfunction/g;
      }
      }
      }
      }
      }
      $triggers->{$key}->{expression}

      = $expression;

            Assignee:
            Alexei Vladishev
            Reporter:
            Attilla de Groot
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: