silence lsof errors
authorEvgeni Golov <evgeni@debian.org>
Sat, 24 Sep 2016 09:25:32 +0000 (11:25 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sat, 24 Sep 2016 09:54:42 +0000 (11:54 +0200)
esp. when running on a host with containers with user namespaces,
lsof output might be full of lines like
 lsof: no pwd entry for UID 887434

this is not helpful and will only clutter the output sent to nagios

Signed-off-by: Peter Palfrader <peter@palfrader.org>
dsa-nagios-checks/checks/dsa-check-libs

index 77b3780..aaaf1ee 100755 (executable)
@@ -143,7 +143,7 @@ sub inVserver() {
 my $INVSERVER = inVserver();
 
 print STDERR "Running $LSOF -n\n" if $params->{'verbose'};
-open (LSOF, "$LSOF -n|") or dief ("Cannot run $LSOF -n: $!\n");
+open (LSOF, "$LSOF -n 2>/dev/null|") or dief ("Cannot run $LSOF -n: $!\n");
 my @lsof=<LSOF>;
 close LSOF;
 if ($CHILD_ERROR) { # program failed