added support for ATI graphic cards through the 'gpu' keys in the 'lmsens' graph

This commit is contained in:
Jordi Sanfeliu 2013-04-09 12:57:00 +02:00
parent cbc50aba64
commit cbcc682b1c
3 changed files with 31 additions and 8 deletions

View File

@ -24,7 +24,7 @@ use strict;
use warnings; use warnings;
use Exporter 'import'; use Exporter 'import';
use POSIX qw(setuid setgid setsid); use POSIX qw(setuid setgid setsid);
our @EXPORT = qw(logger trim max celsius_to httpd_setup get_nvidia_data flush_accounting_rules); our @EXPORT = qw(logger trim max celsius_to httpd_setup get_nvidia_data get_ati_data flush_accounting_rules);
sub logger { sub logger {
my ($msg) = @_; my ($msg) = @_;
@ -225,6 +225,26 @@ sub get_nvidia_data {
return join(" ", $mem, $cpu, $temp); return join(" ", $mem, $cpu, $temp);
} }
sub get_ati_data {
my $myself = (caller(0))[3];
my ($gpu) = @_;
my $temp = 0;
my @data = ();
if(open(IN, "./aticonfig --odgt --adapter=$gpu |")) {
@data = <IN>;
close(IN);
} else {
logger("$myself: ERROR: 'aticonfig' command is not installed.");
}
foreach(@data) {
if(/Sensor \d: Temperature - (\d+\.\d+) C/) {
$temp = $1;
}
}
return $temp || 0;
}
# flushes out all Monitorix iptables/ipfw rules # flushes out all Monitorix iptables/ipfw rules
sub flush_accounting_rules { sub flush_accounting_rules {
my ($config, $debug) = @_; my ($config, $debug) = @_;

View File

@ -264,6 +264,9 @@ sub lmsens_update {
} }
} }
} }
if($lmsens->{list}->{$str} eq "ati") {
$gpu[$n] = get_ati_data($n);
}
} }
} }
for($n = 0; $n < scalar(@mb); $n++) { for($n = 0; $n < scalar(@mb); $n++) {

View File

@ -551,22 +551,22 @@ Then you may want to configure that \fBlist\fP as:
.P .P
Note that you need to escape the plus and minus signs in the voltage labels. Note that you need to escape the plus and minus signs in the voltage labels.
.P .P
The last one, \fIgpu0\fP, is set here just in case you have an NVIDIA card and want to monitor its temperature. Currently only NVIDIA cards are supported so the value \fInvidia\fP is mandatory. It requires the official NVIDIA drivers. The last one, \fIgpu0\fP, is set here just in case you have a supported graphics card and want to monitor its temperature. Currently only NVIDIA and ATI graphic cards are supported; with the values \fInvidia\fP and \fIati\fP respectively. It requires the official NVIDIA or ATI drivers.
.P .P
This list has the following maximums allowed: This list has the following maximums allowed:
.P .P
.RS .RS
Up to 16 \fIcore\fP keys Up to 16 \fIcore\fP keys (from core0 to core15)
.br .br
Up to 2 \fImb\fP keys Up to 2 \fImb\fP keys (mb0 and mb1)
.br .br
Up to 4 \fIcpu\fP keys Up to 4 \fIcpu\fP keys (from cpu0 to cpu3)
.br .br
Up to 9 \fIfan\fP keys Up to 9 \fIfan\fP keys (from fan0 to fan8)
.br .br
Up to 12 \fIvolt\fP keys Up to 12 \fIvolt\fP keys (from volt0 to volt11)
.br .br
Up to 9 \fIgpu\fP keys Up to 9 \fIgpu\fP keys (from gpu0 to gpu8)
.RE .RE
.RE .RE
.SS NVIDIA temperatures and usage (nvidia.rrd) .SS NVIDIA temperatures and usage (nvidia.rrd)