1758c1758,1759
<     } 
---
>     }
> 
1771a1773,1775
> 
>         my $prev_priority = $tree->{'prev_priority'.$s} || 0;
> 
1784a1789,1795
>             my $line = "$name/$prop";
>             my $base = $cfg->{General}{datadir};
>             $line =~ s|^$base/||;
>             $line =~ s|/host$||;
>             $line =~ s|/|.|g;
>             $line .= "[from $slave]" if $slave;
> 
1788a1800,1801
>                 $x->{target} = $line;
> 
1794c1807,1808
<             if ($edgetrigger and $prevmatch != $match) {
---
>             #do_log("debug: $_ $line1 prio=$priority prev_prio=$prev_priority match=$match");
>             if ($edgetrigger and $prevmatch != $match and not defined $priority) {
1797c1811,1835
<             if (not $edgetrigger and $match) {
---
>             elsif ($edgetrigger and defined $priority and $prev_priority != -1) {
> 		#do_log "$name/$prop ($_) priority=$priority prev_priority=$prev_priority match=$match";
>                 if ($priority < $prev_priority and $match) {
>                     # activate alert with higher prio and stop
>                     $what = "(rising)";
>                     $prev_priority = -1;
>                 }
>                 elsif ($priority == $prev_priority and $match) {
>                     # previous alert stay active. stop.
>                     $prev_priority = -1;
>                 }
>                 elsif ($priority == $prev_priority and not $match) {
>                     # clear alert with current prio and continue 
>                     $prev_priority = 0;
>                     #do_log("debug: $_ $line1 clearing");
>                     
> 		}
>                 elsif ($priority > $prev_priority and $match) {
>                     # activate alert with less prio if higher was cleared and stop
>                     #do_log("");
>                     $what =  exists $tree->{'prev_priority'.$s} ? "(resuming)" : "(init)";
>                     $prev_priority = -1;
>                 }		
>             }
>             elsif (not $edgetrigger and $match) {
1799a1838
> 
1801c1840,1850
<                         $priority_done = $priority if $priority and not $priority_done;
---
>                         #$priority_done = $priority if $priority and not $priority_done;
>                 #do_log ("edgetrigger=$edgetrigger priority=$priority priority_done=$priority_done");
>                 if($priority and not $priority_done) {
>                      $priority_done = $priority;
>                      #do_log ("prio_done saved  = $priority_done");
>                      if ($edgetrigger) {
>                          $tree->{'prev_priority'.$s} = $priority;
>                           
>                          #do_log ("prio saved = $priority");
>                      }
>                 }
1804,1809c1853
<                 my $line = "$name/$prop";
<                 my $base = $cfg->{General}{datadir};
<                 $line =~ s|^$base/||;
<                 $line =~ s|/host$||;
<                 $line =~ s|/|.|g;
<                 $line .= "[from $slave]" if $slave;
---
> 
1823c1867,1871
<                         if ($edgetrigger) {
---
>                         if ($edgetrigger and defined $priority) {
>                             my $w = $what =~ /init/ ? 0 : $what =~ /resuming/ ? -1 : 1;
>                             system $cmd,$_,$line,$loss,$rtt,$tree->{host}, $w; 
>                         }
>                         elsif ($edgetrigger) {
