1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Error checking with two line stats (#365)

* Error checking with two line stats

* Fixed some spacing problems
This commit is contained in:
Tim Pozar
2021-05-27 12:36:59 -07:00
committed by GitHub
parent b0983980b6
commit ef381d780d

View File

@@ -74,9 +74,12 @@ my @sysctls_pull = `/sbin/sysctl -q @to_pull`;
foreach my $stat (@sysctls_pull) {
chomp( $stat );
my ( $var, $val ) = split(/:/, $stat, 2);
$val =~ s/^ //;
$sysctls->{$var}=$val;
# If $val is empty, skip it. Likely a var with a newline before
# the data so it is trying to "split" the data.
if( length $val ) {
$val =~ s/^ //;
$sysctls->{$var}=$val;
}
}
# does not seem to exist for me, but some of these don't seem to be created till needed