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

Postfix qshape check by age

parent 5931052f
No related branches found
No related tags found
No related merge requests found
......@@ -51,38 +51,39 @@ 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') {
for my $queue ('incoming', 'active', 'deferred', 'hold') {
my $raw_lines = run_command("/usr/sbin/qshape $queue");
my $raw_lines = run_command("/usr/sbin/qshape -t $wanted_age $queue");
my @lines = split /\n/, $raw_lines;
if(!@lines) {
die "Error running `/usr/sbin/qshape\n";
}
my @Total_line = grep(/TOTAL/,@lines);
my @total_numb = split / +/, $Total_line[0];
${$wanted_pairs}{$queue} = [$total_numb[2],"i"];
${$wanted_pairs}{$queue} = [$total_numb[3],"i"];
}
}
else {
for my $queue ('incoming', 'active', 'deferred', 'hold') {
my $raw_lines = run_command("/usr/sbin/qshape $queue");
my $raw_lines = run_command("/usr/sbin/qshape -t $wanted_age $queue");
my @lines = split /\n/, $raw_lines;
if(!@lines) {
die "Error running `/usr/sbin/qshape\n";
}
my @Domain_line = grep(/$self->{check_name}/,@lines);
my @Domain_line = grep(/ $self->{check_name}/,@lines);
my @Domain_numb = split / +/, $Domain_line[0];
$Domain_numb[2]=0 if not $Domain_numb[2];
${$wanted_pairs}{$queue.'.rcp.'.$self->{check_name}} = [$Domain_numb[2],"i"];
$raw_lines = run_command("/usr/sbin/qshape -s $queue");
$Domain_numb[3]=0 if not $Domain_numb[3];
${$wanted_pairs}{$queue.'.rcp.'.$self->{check_name}} = [$Domain_numb[3],"i"];
$raw_lines = run_command("/usr/sbin/qshape -t $wanted_age -s $queue");
@lines = split /\n/, $raw_lines;
if(!@lines) {
die "Error running `/usr/sbin/qshape\n";
}
@Domain_line = grep(/$self->{check_name}/,@lines);
@Domain_numb = split / +/, $Domain_line[0];
$Domain_numb[2]=0 if not $Domain_numb[2];
${$wanted_pairs}{$queue.'.snd.'.$self->{check_name}} = [$Domain_numb[2],"i"];
$Domain_numb[3]=0 if not $Domain_numb[3];
${$wanted_pairs}{$queue.'.snd.'.$self->{check_name}} = [$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