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

Full expression in API get.trigger function

XMLWordPrintable

    • Icon: New Feature Request New Feature Request
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 2.0.0
    • 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;

            alexei Alexei Vladishev
            attilla Attilla de Groot
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: