MRTG temperature monitoring with smartctl
So first of all you will need self MRTG and smartmontools. Now we can go write some script to produce such graphs
So first we will need this script witch produces data to mrtg it’s source is pasted below. It’s simple perl script.
#!/usr/bin/perl
#Because my disk is SATA i need "-d ata".
#Replace sdb with our own disk.
foreach $filesystem (`/usr/sbin/smartctl -A -d ata /dev/sdb | grep "Temperature_Celsius"`)
{
@df = split(/\s+/,$filesystem);
$temp = $df[9];
}
print "$temp\n";
print "$temp\n";
print "60\n";
And MRTG config looks like:
WorkDir: /var/www/html/mrtg Target[disktemperature]: `/etc/mrtg/temperature` Title[disktemperature]: Disk temperature /mnt/western PageTop[disktemperature]:Disk temperature /mnt/western MaxBytes[disktemperature]: 100 ShortLegend[disktemperature]:C YLegend[disktemperature]: C LegendI[disktemperature]: Temp C LegendO[disktemperature]: Legend1[disktemperature]: Disk /mnt/western temperature Legend2[disktemperature]: Options[disktemperature]: growright,noo,nopercent,gauge