Commit 79d9804a authored by Luc Didry's avatar Luc Didry
Browse files

[Postfwd2] better postfwd2 path check

parent 5c37d9f1
......@@ -158,13 +158,16 @@ foreach my $policy (keys %policies) {
$graphs{policy_matchs}->{series}->{$policy}->{value} = 0;
}
##### I have to parse the output BEFORE config, since policy matchs are dependant of the postfwd --dumpstats output
if (!defined($ENV{path})) {
##### Check postfwd2 path
if (!defined($ENV{path}) || !(-x $ENV{path})) {
foreach my $path (qw{/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin}) {
$ENV{path} = $path.'/postfwd2' if (!defined($ENV{path}) && -x $path.'/postfwd2');
last if (defined($ENV{path}));
}
}
munin_exit_fail() unless (defined($ENV{path}) && -x $ENV{path});
##### I have to parse the output BEFORE config, since policy matchs are dependant of the postfwd --dumpstats output
open(DATA, $ENV{path}.' --dumpstats |') or munin_exit_fail();
my $total_requests;
while(defined (my $data = <DATA>)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment