From: Evgeni Golov Date: Sat, 24 Sep 2016 09:25:33 +0000 (+0200) Subject: set $user to if lsof could not tell the username X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-nagios.git;a=commitdiff_plain;h=6e1c9dcd866cae677f7f995693e337ae8ab7510c set $user to if lsof could not tell the username this happens e.g. on hosts that run containers in own user namespaces without, the output will be full of warnings: Use of uninitialized value $user in hash element at dsa-check-libs line 188. Signed-off-by: Peter Palfrader --- diff --git a/dsa-nagios-checks/checks/dsa-check-libs b/dsa-nagios-checks/checks/dsa-check-libs index aaaf1ee..fd9e338 100755 --- a/dsa-nagios-checks/checks/dsa-check-libs +++ b/dsa-nagios-checks/checks/dsa-check-libs @@ -156,7 +156,7 @@ LINE: for my $line (@lsof) { my %fields = map { m/^(.)(.*)$/ ; $1 => $2 } grep { defined $_ and length $_ >1} split /\0/, $line; $process = $fields{c}; $pid = $fields{p}; - $user = $fields{L}; + $user = $fields{L} || ''; next; }