From 1d284f9fccfc9fc4b8c0cd76b7cc7ac43625f556 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Mon, 8 Jul 2013 12:04:12 +0200 Subject: [PATCH] fixed a message of 'Argument isn't numeric in int ...' in 'nvidia' graph when using newer official drivers --- Changes | 2 ++ lib/Monitorix.pm | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Changes b/Changes index 4841878..068f98c 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,8 @@ - Fixed a bug that prevented a correctly data collection in the 'fail2ban' graph. [#23] - Fixed the description of 'netstats_in_bps' in monitorix.conf(5) man page. +- Fixed a message of 'Argument "" isn't numeric in int ...' in 'nvidia' graph + when using newer official drivers. - Little code cleaning. diff --git a/lib/Monitorix.pm b/lib/Monitorix.pm index 20a271c..b4b9059 100644 --- a/lib/Monitorix.pm +++ b/lib/Monitorix.pm @@ -208,10 +208,12 @@ sub get_nvidia_data { my ($value, undef) = split(' ', $tmp); $value =~ s/[-]/./; $value =~ s/[^0-9.]//g; + $value ||= 0; # zero if not numeric if(int($value) > 0) { $cpu = int($value); } } + # not used if($data[$l] =~ /Memory/) { my (undef, $tmp) = split(':', $data[$l]); if($tmp eq "\n") { @@ -221,6 +223,7 @@ sub get_nvidia_data { my ($value, undef) = split(' ', $tmp); $value =~ s/[-]/./; $value =~ s/[^0-9.]//g; + $value ||= 0; # zero if not numeric if(int($value) > 0) { $mem = int($value); }