[Nagiosplug-devel] check_ms_spooler modified for perl framework
Stanley Hopcroft
Stanley.Hopcroft at IPAustralia.Gov.AU
Thu Apr 1 23:04:01 CEST 2004
Dear Sir,
Here is a patch for check_ms_spooler.pl without which the output is many
lines of unhelpful info from the spooler.
pc09011> ./check_ms_spooler.pl.orig -H ipaprint -u foo -p bar |
& head -c 480
Ok. Connected to 17 queues on //ipaprint. Queues BW02:
Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
IT02: Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager
4.0] Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager
4.0] N001: Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN
Manager 4.0] Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN
Manager 4.0] Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN
Manager 4.0]pc09011>
--- check_ms_spooler.pl.orig Fri Apr 2 16:58:53 2004
+++ check_ms_spooler.pl Fri Apr 2 16:53:24 2004
@@ -205,10 +205,12 @@
# Howard Wilkinson
# Remove added interface messages our machines have 1000's.
- foreach my $result (@tresults) {
- next if ($result =~ m/^added interface/i);
- push @results, $result;
- }
+ # foreach my $result (@tresults) {
+ # next if ($result =~ m/^added interface/i);
+ # push @results, $result;
+ # }
+
+ @results = grep !/^added interface/i, @tresults ;
print STDERR "\"@results\"\n" if $debug ;
Performance is not as big an issue with this plugin as check_wins; since
the elapsed time is bounded below by the sum of spooler response times,
this plugin runs about the as slowly as one without the framework.
pc09011> ~anwsmh/perl/dotime 10 "./check_ms_spooler.pl -H ipaprint -u
foo -p bar"
Running ./check_ms_spooler.pl -H ipaprint -u helpdesk -p helpme 10 times
1 2 3 4 5 6 7 8 9 10 done
Avg 1 2 3 4 5 6
7 8 9 10
------ ------ ------ ------ ------ ------ ------
------ ------ ------ ------
real 5.100 4.70 5.28 5.31 4.99 4.97 5.25
4.69 5.27 4.99 5.55
user 0.205 0.22 0.21 0.24 0.20 0.21 0.20
0.17 0.23 0.19 0.18
sys 0.140 0.11 0.14 0.12 0.14 0.12 0.16
0.16 0.12 0.15 0.18
pc09011> ~anwsmh/perl/dotime 10 "./check_ms_spooler -H ipaprint -u
foo -p bar"
Running ./check_ms_spooler -H ipaprint -u helpdesk -p helpme 10 times
1 2 3 4 5 6 7 8 9 10 done
Avg 1 2 3 4 5 6
7 8 9 10
------ ------ ------ ------ ------ ------ ------
------ ------ ------ ------
real 4.937 5.19 4.62 4.90 5.17 4.87 5.18
4.65 4.89 4.90 5.00
user 0.137 0.13 0.15 0.12 0.15 0.14 0.16
0.08 0.12 0.16 0.16
sys 0.125 0.13 0.10 0.14 0.12 0.13 0.11
0.17 0.14 0.10 0.11
pc09011>
pc09011> ./check_ms_spooler.pl -V
check_ms_spooler.pl (nagios-plugins 1.4.0alpha2) 1.1
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may
redistribute
copies of the plugins under the terms of the GNU General Public License.
For
more information about these matters, see the file named COPYING.
pc09011> ./check_ms_spooler -V
check_ms_spooler (netsaint-plugins 1.2.9-4) 2.5
The netsaint plugins come with ABSOLUTELY NO WARRANTY. You may
redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
pc09011>
--
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------
'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'
from Meditation 17, J Donne.
More information about the Devel
mailing list