Also report the number in the deferred queue

tags/zabbix-agent-addons-0.2.64-1
Daniel Berteaud 6 years ago
parent 263253fe87
commit d381cb5d31
  1. 29
      zabbix_scripts/check_pmg_sudo

@ -8,18 +8,19 @@ use Data::Dumper;
use PMG::DBTools; use PMG::DBTools;
my $json = { my $json = {
count_in => 0, count_in => 0,
count_out => 0, count_out => 0,
bytes_in => 0, bytes_in => 0,
bytes_out => 0, bytes_out => 0,
spam_in => 0, spam_in => 0,
spam_out => 0, spam_out => 0,
virus_in => 0, virus_in => 0,
virus_out => 0, virus_out => 0,
ptime_in => 0, ptime_in => 0,
ptime_out => 0, ptime_out => 0,
queue_hold => 0, queue_hold => 0,
queue_active => 0 queue_active => 0,
queue_deferred => 0
}; };
my $pretty = 0; my $pretty = 0;
my ($domain,$what) = undef; my ($domain,$what) = undef;
@ -79,10 +80,10 @@ if (not defined $domain){
my $res = $sth->fetchrow_hashref; my $res = $sth->fetchrow_hashref;
$json->{$_} = $res->{$_} foreach (qw/rbl pregreet/); $json->{$_} = $res->{$_} foreach (qw/rbl pregreet/);
# Here we count email in the queue (active and hold queue) # Here we count email in the queue (active, deferred and hold queues)
foreach my $res (qx(postqueue -j)){ foreach my $res (qx(postqueue -j)){
$res = from_json($res); $res = from_json($res);
foreach (qw/hold active/){ foreach (qw/hold active deferred/){
$json->{'queue_' . $_} += 1 if ($res->{queue_name} eq $_); $json->{'queue_' . $_} += 1 if ($res->{queue_name} eq $_);
} }
} }

Loading…
Cancel
Save