Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a fileserver running: All in a LVM2 array, works beautifully even tho its in the closet.
2 x 500gig sata
2 x 320gig sata
My question is their an easy way to through known programs to provide me with a basic webpage that displays say an hourly, day/month harddrive temperature graph??
I know i can use a basic LAMP setup and webmin to achieve this but thats way to much bloat for such a simple task. Currently i have a cron job dumping the temps into an xml file (very, very dirty method due to bad scripting) but still have no method of graphing it nicely even through xls sheets.
Any smart utilities, miniwebservers, mods, you guys think will help lemme know!!
set terminal png medium
set grid xtics ytics
set output '/var/www/html/HDtemperature-temp.png'
set title "Hard Drive Temperature (bezier smoothed) - last 72 hours";
set xlabel "" 0.000000,0.000000 font "";
set xtics 43200
set mytics 10
set ylabel "Degrees Centigrade" 0.000000,0.000000 font ""
set yrange [25:55]
set xdata time;
set timefmt x "%b %d %H:%M:%S"
set key on outside below
set size 1.5,1.5
set rmargin 5
plot "</bin/cat /var/log/temperature.log | /bin/awk '{print $2,$3,$4,$9}'" using 1:4 smooth bezier with linespoints t 'HDA', \
"</bin/cat /var/log/temperature.log | /bin/awk '{print $2,$3,$4,$10}'" using 1:4 smooth bezier with linespoints t 'HDG';
The resulting graph is on the web page, here (HD temps are near the bottom).
I have not installed it yet as im changing cases and doing general os cleanup but how are you generating your /var/log/temperature.log?
Currently im using awk via cron to poll the 'smartctl -A /dev/sda' to grab the temps and >> to a logfile but polling 6 drives as of today is not very efficiant.
Pretty much the same. I run the following code section in a minimal priority continuous process that sleeps between iterations, yielding about one sample every 15 seconds:
Code:
#------------------------
# Motherboard temperature
#------------------------
if [ -f /sys/bus/i2c/devices/9191-0290/temp1_input ]
then
temp=`/bin/cat /sys/bus/i2c/devices/9191-0290/temp1_input`
left=${temp:0:2}
right=${temp:2:3}
MBtemp=${left}.${right}
else
MBtemp="0"
fi
#----------------
# CPU temperature
#----------------
if [ -f /sys/bus/i2c/devices/9191-0290/temp2_input ]
then
temp=`/bin/cat /sys/bus/i2c/devices/9191-0290/temp2_input`
left=${temp:0:2}
right=${temp:2:3}
CPUtemp=${left}.${right}
else
CPUtemp="0"
fi
#-------
# Drives
#-------
HDA=`/usr/sbin/smartctl -A /dev/hda 2>&1 | /bin/grep "^194" | /bin/awk '{print $10}'`
if [ "$HDA" == "" ]
then
HDA=0
fi
HDG=`/usr/sbin/smartctl -A /dev/hdg 2>&1 | /bin/grep "^194" | /bin/awk '{print $10}'`
if [ "$HDG" == "" ]
then
HDG=0
fi
#--------------------
# Update the log file
#--------------------
echo "`/bin/date` $MBtemp $CPUtemp $HDA $HDG" >> /var/log/temperature.log
#---------------------------------
# Trim log to most recent 72 hours
#---------------------------------
/usr/bin/tail -n 17280 /var/log/temperature.log > /dev/shm/temperature.log.new
/bin/mv -f /dev/shm/temperature.log.new /var/log/temperature.log
#----------------------------------------------
# Plot the motherboard and CPU temperature data
#----------------------------------------------
/usr/bin/gnuplot /usr/local/bin/temperatureplot.parms &>/dev/null
/bin/mv -f /var/www/html/temperature-temp.png /var/www/html/temperature.png
#----------------------------------------------
# Plot the temperature data for the hard drives
#----------------------------------------------
/usr/bin/gnuplot /usr/local/bin/HDtemperatureplot.parms &>/dev/null
/bin/mv -f /var/www/html/HDtemperature-temp.png /var/www/html/HDtemperature.png
If you are logging audits, then SELinux is not disabled. It could be in permissive mode, which means that it is logging audits (but not preventing anything). If you ever did disable SELinux, the entire filesystem needs to be relabled. The setroubleshoot package should be installed (if not install it); it will provide you with an explanation for any SELinux errors along with suggested corrective action.
Since this is a completely unrelated issue, I suggestion you open a new thread for it; I doubt people with SELinux expertise will be checking a SMART thread...
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
I realize this is a stupid question, but I simply could not find out how to redirect the smart output to something like "/var/log/temperature.log" in stead of /var/log/messages. How do you do that?
My script looks exactly like his above except I required the "-T permissive" option on all my sataII seagate drives because they fail one of the smart commands. no idea why but it works and im happy.
To get the script to run every 60 seconds I placed this line into my /etc/crontab:
Code:
#HDD Temps - */1 means run every whole min
*/1 * * * * root (nice -15 /root/smart_temps.sh)
/root/smart_temps.sh is the file thats has the $HDA variables and dumps the /var/log/temperatures file.
I have a question for you macemoneta, i was playing around with the .parm file and wow could i mess stuff up, I have the colors, lables, and graph looking as i want it but the scale for time on the x axis is terriblely irratic. My temperatures file is being updated every 60 seconds and I want a graph for 6hrs, 24hrs, 30days. (6hr updates 60s, 24hr updates 30min, 30day updates 3hrs) I have all the cron jobs to call the scripts but I just cant get that x scale to stick to 6/24/720hr scale.
Or a tutorial you reccomend as gnuplots ones are pretty weak.
The time scale of the graph was a problem for me as well (I'm no gnuplot expert). I work around it by creating multiple files with different amounts of data.
In your case, with one minute collections, you would create three files, trimming the data to the last n entries for each interval. For example:
The above would maintain the 30 day data for the respective graph. Since you are plotting all the data in the file(s), gnuplot calculates the range correctly.
Ahh I didnt think of that.... Explains why after i thought the graph looked good the next hour it was all out of wack as my main temp.log file is trimmed to 43200 entries for the 30day log and its only been like 2 days of monitoring.
Your quite knowledgeable and these forums seem to take 4 days for a reply 90% of the time hopefully you can give me some advice.
Group management is a pain and Im not familiar with console user management, is their a text manager for users and groups that you know about?
If not my issue is I have blu:3710, mike:3710, www-data:3710, when i do 'groups blu' it says 3710 is the primary group, I even did a 'useradd -g 3710 blu' to make sure but my /etc/groups file says:
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
Ahhh, so that is the trick. I was digging in the smartd.conf man page with no luck (have been doing that for months ). I simply overlooked the trick in your code blinded by my assumption that there was a way to redirect the logging output. Thank you, macemoneta and blu_alchemist .
blu_alchemist: I suggest you start a new thread on the issue of managing users and groups, since it's not related to the topic of this thread. There are different tools available under different distributions; update your profile so that the folks know which distribution you're using.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.