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

Full expression in API get.trigger function

    XMLWordPrintable

    Details

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

      Description

      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;

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: