Skip to content
Snippets Groups Projects
Commit dd5bbfa5 authored by Sergey Joseph Ivanov's avatar Sergey Joseph Ivanov
Browse files

move domain out of checkname to have different checks for the same domain

parent 098cbfe2
No related branches found
No related tags found
No related merge requests found
......@@ -47,13 +47,15 @@ and as a sender domain.
=back
=cut
my $DEBUG=1;
my $DEBUG=0;
sub handler {
my $self = shift;
my $config = $self->{config};
my $wanted_pairs;
my $wanted_age = $self->{config}->{age} || 7*24*60;
if($self->{check_name} eq 'total') {
my $domain=$self->{config}->{domain} || 'total';
my $check=$self->{check_name};
if($domain eq 'total') {
for my $queue ('incoming', 'active', 'deferred', 'hold') {
my $raw_lines = run_command("/usr/sbin/qshape -t $wanted_age $queue");
my @lines = split /\n/, $raw_lines;
......@@ -62,7 +64,7 @@ sub handler {
}
my @Total_line = grep(/TOTAL/,@lines);
my @total_numb = split / +/, $Total_line[0];
if ($DEBUG) { print STDERR "queue=$queue,",join(":",@total_numb), "\n"}
if ($DEBUG) { print STDERR "queue=$queue, check=$check, ",join(":",@total_numb), "\n"}
${$wanted_pairs}{$queue} = [$total_numb[2]-$total_numb[3],"i"];
}
}
......@@ -73,13 +75,12 @@ sub handler {
if(!@lines) {
die "Error running `/usr/sbin/qshape\n";
}
my $domain=$self->{check_name};
my @Domain_line = grep(/ $domain/,@lines);
my @Domain_numb = split / +/, $Domain_line[0];
$Domain_numb[2]=0 if not $Domain_numb[2];
$Domain_numb[3]=0 if not $Domain_numb[3];
if ($DEBUG) { print STDERR "RCPT:domain=$domain,$queue=$queue,",join(":",@Domain_numb), "\n"}
${$wanted_pairs}{$queue.'.rcp.'.$self->{check_name}} = [$Domain_numb[2]-$Domain_numb[3],"i"];
if ($DEBUG) { print STDERR "RCPT:check=$check,domain=$domain,$queue=$queue,",join(":",@Domain_numb), "\n"}
${$wanted_pairs}{$queue.'.rcp.'.$domain} = [$Domain_numb[2]-$Domain_numb[3],"i"];
$raw_lines = run_command("/usr/sbin/qshape -t $wanted_age -s $queue");
@lines = split /\n/, $raw_lines;
if(!@lines) {
......@@ -89,8 +90,8 @@ sub handler {
@Domain_numb = split / +/, $Domain_line[0];
$Domain_numb[2]=0 if not $Domain_numb[2];
$Domain_numb[3]=0 if not $Domain_numb[3];
if ($DEBUG) { print STDERR "SND:domain=$domain,$queue=$queue,",join(":",@Domain_numb), "\n"}
${$wanted_pairs}{$queue.'.snd.'.$self->{check_name}} = [$Domain_numb[2]-$Domain_numb[3],"i"];
if ($DEBUG) { print STDERR "SND:check=$check,domain=$domain,$queue=$queue,",join(":",@Domain_numb), "\n"}
${$wanted_pairs}{$queue.'.snd.'.$domain} = [$Domain_numb[2]-$Domain_numb[3],"i"];
}
}
return $wanted_pairs;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment