Package: nagios-plugins-contrib
Version: 11.20140704
Tags: patch

Hi,

I noticed that check_libs sometimes parses files incorrectly
inside an OpenVZ container (wheezy host and guest, proxmox ve
2.6.32 kernel):

# /usr/lib/nagios/plugins/check_libs --verbose
Running /usr/bin/lsof -F0 -n
adding bash(28081) because of [ (deleted)/tmp/tmpfXKFYTG]:
f1aul tREGG0x8002;0x0D0x6ds218i9441399k0n (deleted)/tmp/tmpfXKFYTG
adding bash(28081) because of [ (deleted)/tmp/tmpfXKFYTG]:
f2aul tREGG0x8002;0x0D0x6ds218i9441399k0n (deleted)/tmp/tmpfXKFYTG
adding puppet(28244) because of [ (deleted)/tmp/tmpfXKFYTG]:
f1aul tREGG0x8002;0x0D0x6ds218i9441399k0n (deleted)/tmp/tmpfXKFYTG
adding puppet(28244) because of [ (deleted)/tmp/tmpfXKFYTG]:
f2aul tREGG0x8002;0x0D0x6ds218i9441399k0n (deleted)/tmp/tmpfXKFYTG
The following processes have libs linked that were upgraded: root: bash
(28081), puppet (28244)

So in some cases there is a space in front of "(deleted)".
Attached is a patch that fixes this.

Regards,
Felix
diff -Nur a/check_libs/nagios-check-libs b/check_libs/nagios-check-libs
--- a/check_libs/nagios-check-libs
+++ b/check_libs/nagios-check-libs
@@ -170,7 +170,7 @@
 	my $inode = $fields{i};
 	my $path  = $fields{n};
 	if ($path =~ m/\.dpkg-/ || $path =~ m/\(deleted\)/ || $path =~ /path inode=/ || $fd eq 'DEL') {
-		$path =~ s/^\(deleted\)//; # in some cases "(deleted)" is at the beginning of the string
+		$path =~ s/^ ?\(deleted\)//; # in some cases "(deleted)" is at the beginning of the string
 		for my $i (@{$config->{'ignorelist'}}) {
 			my $ignore = eval($i);
 			next LINE if $ignore;

Reply via email to