mirror of https://github.com/mikaku/Monitorix.git
fixed in 'lmsens' to not use the returned value if 'nvidia-smi' is not installed
This commit is contained in:
parent
a4b8372901
commit
a9a0876914
|
@ -95,6 +95,7 @@ sub httpd_setup {
|
|||
}
|
||||
|
||||
sub get_nvidia_data {
|
||||
my $myself = (caller(0))[3];
|
||||
my ($gpu) = @_;
|
||||
my $total = 0;
|
||||
my $used = 0;
|
||||
|
@ -106,9 +107,13 @@ sub get_nvidia_data {
|
|||
my $check_temp = 0;
|
||||
my $l;
|
||||
|
||||
open(IN, "nvidia-smi -q -i $gpu -d MEMORY,UTILIZATION,TEMPERATURE |");
|
||||
my @data = <IN>;
|
||||
close(IN);
|
||||
my @data = ();
|
||||
if(open(IN, "nvidia-smi -q -i $gpu -d MEMORY,UTILIZATION,TEMPERATURE |")) {
|
||||
@data = <IN>;
|
||||
close(IN);
|
||||
} else {
|
||||
logger("$myself: ERROR: 'nvidia-smi' command is not installed.");
|
||||
}
|
||||
for($l = 0; $l < scalar(@data); $l++) {
|
||||
if($data[$l] =~ /Memory Usage/) {
|
||||
$check_mem = 1;
|
||||
|
|
|
@ -240,9 +240,13 @@ sub lmsens_update {
|
|||
(undef, undef, $gpu[$n]) = split(' ', get_nvidia_data($n));
|
||||
if(!$gpu[$n]) {
|
||||
# attempt to get data using the old driver version
|
||||
open(IN, "nvidia-smi -g $n |");
|
||||
my @data = <IN>;
|
||||
close(IN);
|
||||
my @data = ();
|
||||
if(open(IN, "nvidia-smi -g $n |")) {
|
||||
@data = <IN>;
|
||||
close(IN);
|
||||
} else {
|
||||
logger("$myself: ERROR: 'nvidia-smi' command is not installed.");
|
||||
}
|
||||
for($l = 0; $l < scalar(@data); $l++) {
|
||||
if($data[$l] =~ /Temperature/) {
|
||||
my (undef, $tmp) = split(':', $data[$l]);
|
||||
|
|
Loading…
Reference in New Issue