How to monitor system (CPU, HDD, mobo, GPU) temperatures on FreeNAS 8?

Joined
Nov 3, 2012
Messages
3
<div class="bbWrapper"><blockquote data-attributes="" data-quote="Yell" data-source="post: 41878" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=41878" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-41878">Yell said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> do you mean the &quot;Drive Activity Status&quot;,<br /> if yes, sorry to shatter your dreams but there is a second ada filter xD<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if(match($i, '/<span style="color: #FF0000">ada</span>/')) print $i }' ); do echo -n $i:; adastat $i; done; echo ; echo</pre></div><br /> <br /> Ok srly, this will call the &quot;adastat&quot; function which will call &quot;camcontrol&quot; for each found disk, you may want to check the output of this tool against you drives on the LSI </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote><br /> Yes, I had caught that and modified accordingly, but the result of the adastat function call to the LSI card ports is:<br /> <br /> &quot;camcontrol: error sending command&quot;<br /> <br /> Seems that camcontrol command being sent here doesn't apply to the LSI ports the same as it does with onboard ports...<br /> <br /> If someone knows the correct command sequence, great, but really it's not as useful to me as the temps anyway.<br /> <br /> Thanks, Karl</div>
 

Yell

Explorer
Joined
Oct 24, 2012
Messages
74
<div class="bbWrapper">well then to remove you errors readd that /ada/ for the adastat function call.<br /> Does LSI supply FreeBSD binary's ? Maybe the even ship a little control center to monitor the attached drives?</div>
 

ThomasDK81

Dabbler
Joined
Mar 19, 2012
Messages
49
<div class="bbWrapper"><blockquote data-attributes="" data-quote="Yell" data-source="post: 41901" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=41901" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-41901">Yell said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> well then to remove you errors readd that /ada/ for the adastat function call.<br /> Does LSI supply FreeBSD binary's ? Maybe the even ship a little control center to monitor the attached drives? </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote><br /> Like this: <a href="http://portsmon.freebsd.org/portoverview.py?category=sysutils&amp;portname=megacli" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://portsmon.freebsd.org/portoverview.py?category=sysutils&amp;portname=megacli</a> ?</div>
 

bogenfisch

Cadet
Joined
Feb 22, 2013
Messages
1
<div class="bbWrapper">Love the script - as I have little to no knowledge of scripting. Unfortunately it only gives a static view of the temperture at that instance<br /> <br /> In the Freenas feature request there is a open request for HDD temps in the reporting tab, which is quite old. It would be nice to be able to look at how the temperatures vary over time. Especially for private people who can't afford airconditioned server rooms at home<br /> <br /> If the output could be a file with the format<br /> <br /> Timestamp; CPU1; CPU2; ...; CPUn; HHD SN1; HDD SN2; ...; HDD SNn<br /> 28.02.2013 15:00:00; TEMP string ....<br /> 28.02.2013 15:15:00; TEMP string ....<br /> etc<br /> <br /> then this could be imported into a spreadsheet, and a diagram over time generated.<br /> <br /> Volunteers?</div>
 

virus

Cadet
Joined
Mar 13, 2013
Messages
1
<div class="bbWrapper"><blockquote data-attributes="" data-quote="madmax" data-source="post: 38847" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=38847" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-38847">madmax said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> Your right. It works now both in 8.2 and 8.3.1. Thanks!<br /> <br /> <br /> I used the esmart script and put this script together to send myself email of this information<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /usr/local/bin/sh ( echo &quot;To: your email address &quot; echo &quot;Subject: System Temperatures INFO&quot; echo &quot; &quot; ) &gt; /var/cover adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } &gt;&gt; /var/cover echo echo System Temperatures - `date` &gt;&gt; /var/cover cat /etc/version &gt;&gt; /var/cover uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' &gt;&gt; /var/cover echo &quot;CPU Temperature:&quot; &gt;&gt; /var/cover sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; &gt;&gt; /var/cover echo echo &quot;Drive Activity Status&quot; &gt;&gt; /var/cover for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if(match($i, '/ada/')) print $i }' ); do echo -n $i:; adastat $i; done; echo ; echo &gt;&gt; /var/cover echo &quot;HDD Temperature:&quot; &gt;&gt; /var/cover for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if(match($i, '/ada/')) print $i }' ) do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` &gt;&gt; /var/cover done echo sendmail -t &lt; /var/cover exit 0</pre></div><br /> <br /> when I do run it though i get an echo of the hard letters. Not sure which echo is the cause of it and if I can turn if off from outputting. Otherwise the email is looks good. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote><br /> Hi there,<br /> this scrip i received all time error somethig like waiting for } ...<br /> i inpire my self and made this:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>#!/bin/sh ( echo &quot;To: ***x@***.com&quot; echo &quot;Subject: System Temperatures INFO&quot; echo &quot; &quot; ) &gt; /var/cover echo Pc temp `sysctl -n hw.acpi.thermal.tz0.temperature` &gt;&gt; /var/cover echo CPU1 `sysctl -n dev.cpu.0.temperature` &gt;&gt; /var/cover echo CPU2 `sysctl -n dev.cpu.1.temperature` &gt;&gt; /var/cover echo &quot;Hdd&quot; &gt;&gt; /var/cover echo DevTemp1=`smartctl -a /dev/ada0 | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 &quot;C&quot;}'` \ DevSerNum1=`smartctl -a /dev/ada0 | awk '/Serial Number:/{print $0}' | awk '{print $3}'` \ DevName1=`smartctl -a /dev/ada0 | awk '/Device Model:/{print $0}' | awk '{print $3}'`\ DevTemp2=`smartctl -a /dev/ada1 | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 &quot;C&quot;}'` \ DevSerNum2=`smartctl -a /dev/ada1 | awk '/Serial Number:/{print $0}' | awk '{print $3}'` \ DevName2=`smartctl -a /dev/ada1 | awk '/Device Model:/{print $0}' | awk '{print $3}'` &gt;&gt; /var/cover sendmail -t &lt; /var/cover exit 0</pre></div><br /> for:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>System Information Hostname freenas.local Build FreeNAS-8.3.0-RELEASE-p1-x64 (r12825) Platform Dual Core AMD Opteron(tm) Processor 170 Memory 1519MB System Time Wed Mar 13 21:05:19 CET 2013 Uptime 9:05PM up 4 days, 20:47, 0 users Load Average 0.07, 0.08, 0.08 Connected through 192.168.10.180</pre></div></div>
 

firest0rm

Cadet
Joined
Aug 1, 2013
Messages
5
<div class="bbWrapper">can some one tell me how to install this?<br /> i am a total noob when it comes to linux + freenas<br /> <br /> also is there any better plugin out there that can show this in a spread sheet and log down the tempratures some how?</div>
 

gpsguy

Active Member
Joined
Jan 22, 2012
Messages
4,472
<div class="bbWrapper">You don't need to &quot;install it&quot; - just run it. Here's a recent forum message, explaining how: <a href="http://forums.freenas.org/threads/how-to-install-scripts.13758/" target="_blank" class="link link--external" rel="nofollow ugc noopener">Running scripts</a><br /> <br /> If you want to automate it, read up on cron.<br /> <br /> btw, FreeNAS isn't a Linux distro. It's a descendant of Unix.</div>
 

firest0rm

Cadet
Joined
Aug 1, 2013
Messages
5
<div class="bbWrapper">just shows the lack of knowledge lol<br /> <br /> can u explain more about this cron thing?</div>
 

gpsguy

Active Member
Joined
Jan 22, 2012
Messages
4,472
<div class="bbWrapper">Learn about <a href="http://lmgtfy.com/?q=cron" target="_blank" class="link link--external" rel="nofollow ugc noopener">cron</a>. <br /> <br /> The FreeNAS manual has a section on how to create cron jobs.</div>
 

Z300M

Guru
Joined
Sep 9, 2011
Messages
882
<div class="bbWrapper"><blockquote data-attributes="member: 23318" data-quote="NASbox" data-source="post: 27898" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=27898" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-27898">NASbox said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> <b>FreeNAS CPU / Hard Drive Temperature Script</b><br /> <br /> Nice Job djoole ... thanks for the inspiration.... I cleaned up the awk script in the for loop a bit so that it is only necessary to call smartctl once for each disk drive to save the unnecessary overhead.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /bin/bash adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } echo echo System Temperatures - `date` cat /etc/version.freenas uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' echo &quot;CPU Temperature:&quot; sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; echo echo &quot;Drive Activity Status&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo echo &quot;HDD Temperature:&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` done echo </pre></div><br /> <br /> I also included/changed the following:<br /> <ul> <li data-xf-list-type="ul">a few cosmetic labels</li> <li data-xf-list-type="ul">included system load to correlate with the CPU termperature</li> <li data-xf-list-type="ul">list the system disks in ascending order (ada0-adaX)</li> <li data-xf-list-type="ul">omitted any disks other than adaX since they didn't apply on my system ( da0 = boot flash drive - no temp sensor).</li> <li data-xf-list-type="ul">+++show drive status (00=stopped, FF=spinning) prior to temperature reading to determine if disk was active (smartctl causes disk to start spinning)</li> </ul>+++ Credit for the drive spin down status belongs to the authors of this thread<br /> <a href="http://forums.freenas.org/showthread.php?2068-How-to-find-out-if-a-drive-is-spinning-down-properly&amp;highlight=camcontrol+cmd+-a" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://forums.freenas.org/showthread.php?2068-How-to-find-out-if-a-drive-is-spinning-down-properly&amp;highlight=camcontrol cmd -a</a><br /> <br /> Hope someone finds this useful and can improve it some more. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote>Sorry, but I am a real n00b when it comes to working with shell scripts. How could I modify it to have the Temperature, Serial Number and Name separated by Tabs?</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper"><blockquote data-attributes="member: 23318" data-quote="NASbox" data-source="post: 27898" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=27898" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-27898">NASbox said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> <b>FreeNAS CPU / Hard Drive Temperature Script</b><br /> <br /> Nice Job djoole ... thanks for the inspiration.... I cleaned up the awk script in the for loop a bit so that it is only necessary to call smartctl once for each disk drive to save the unnecessary overhead.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /bin/bash adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } echo echo System Temperatures - `date` cat /etc/version.freenas uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' echo &quot;CPU Temperature:&quot; sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; echo echo &quot;Drive Activity Status&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo echo &quot;HDD Temperature:&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` done echo </pre></div><br /> <br /> I also included/changed the following:<br /> <ul> <li data-xf-list-type="ul">list the system disks in ascending order (ada0-adaX)</li> </ul>. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote> <br /> <br /> How do I modify this to show all HDD's not just ada. I have others such as da, but want this script above to show all hdd's.<br /> <br /> Thanks</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper"><blockquote data-attributes="member: 23318" data-quote="NASbox" data-source="post: 27898" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=27898" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-27898">NASbox said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> <b>FreeNAS CPU / Hard Drive Temperature Script</b><br /> <br /> Nice Job djoole ... thanks for the inspiration.... I cleaned up the awk script in the for loop a bit so that it is only necessary to call smartctl once for each disk drive to save the unnecessary overhead.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /bin/bash adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } echo echo System Temperatures - `date` cat /etc/version.freenas uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' echo &quot;CPU Temperature:&quot; sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; echo echo &quot;Drive Activity Status&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo echo &quot;HDD Temperature:&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` done echo </pre></div><br /> <br /> I also included/changed the following:<br /> <ul> <li data-xf-list-type="ul">list the system disks in ascending order (ada0-adaX)</li> </ul>. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote> <br /> <br /> How do I modify this to show all HDD's not just ada. I have others such as da, but want this script above to show all hdd's.<br /> <br /> Thanks</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper"><blockquote data-attributes="member: 23318" data-quote="NASbox" data-source="post: 27898" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=27898" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-27898">NASbox said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> <b>FreeNAS CPU / Hard Drive Temperature Script</b><br /> <br /> Nice Job djoole ... thanks for the inspiration.... I cleaned up the awk script in the for loop a bit so that it is only necessary to call smartctl once for each disk drive to save the unnecessary overhead.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /bin/bash adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } echo echo System Temperatures - `date` cat /etc/version.freenas uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' echo &quot;CPU Temperature:&quot; sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; echo echo &quot;Drive Activity Status&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo echo &quot;HDD Temperature:&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` done echo </pre></div><br /> <br /> I also included/changed the following:<br /> <ul> <li data-xf-list-type="ul">list the system disks in ascending order (ada0-adaX)</li> </ul>. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote> <br /> <br /> How do I modify this to show all HDD's not just ada. I have others such as da, but want this script above to show all hdd's.<br /> <br /> <br /> Thanks</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper">Sorry for the posts duplicating not sure what happened...<br /> <br /> Also when I run NASbox's script:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> <ol> <li data-xf-list-type="ol"></li> <li data-xf-list-type="ol">#! /bin/bash</li> <li data-xf-list-type="ol">adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; }</li> <li data-xf-list-type="ol">echo</li> <li data-xf-list-type="ol"><b>echo System Temperatures - `date`</b></li> <li data-xf-list-type="ol">cat /etc/version.freenas</li> <li data-xf-list-type="ol">uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }'</li> <li data-xf-list-type="ol">echo &quot;CPU Temperature:&quot;</li> <li data-xf-list-type="ol">sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot;</li> <li data-xf-list-type="ol"><b>echo</b></li> <li data-xf-list-type="ol">echo &quot;Drive Activity Status&quot;</li> <li data-xf-list-type="ol">for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo</li> <li data-xf-list-type="ol">echo &quot;HDD Temperature:&quot;</li> <li data-xf-list-type="ol">for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }')</li> <li data-xf-list-type="ol"><b>do</b></li> <li data-xf-list-type="ol"> echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'`</li> <li data-xf-list-type="ol">done</li> <li data-xf-list-type="ol">echo</li> </ol></pre></div><br /> <br /> It doesnt return the HDD temps.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>System Temperatures - Sun Nov 17 15:48:49 EST 2013 cat: /etc/version.freenas: No such file or directory System Load: 0.16, 0.08, 0.08 CPU Temperature: dev.cpu.0.temperature: 28.0C dev.cpu.1.temperature: 28.0C Drive Activity Status ada0:camcontrol: cam_lookup_pass: couldn't open /dev/xpt0 cam_lookup_pass: Permission denied ada1:camcontrol: cam_lookup_pass: couldn't open /dev/xpt0 cam_lookup_pass: Permission denied HDD Temperature: ada0 ada1</pre></div><br /> <br /> Any ideas? Do they have an internal temp sensor or do you add them?? Not sure if I am missing something</div>
 

warri

Guru
Joined
Jun 6, 2011
Messages
1,193
<div class="bbWrapper">Try executing the script as root.</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper"><blockquote data-attributes="member: 388" data-quote="warri" data-source="post: 83474" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=83474" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-83474">warri said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> Try executing the script as root. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote> <br /> Hi,<br /> <br /> Ok, so running as root worked. I had to change SSH setting in Services to &quot;Login with root password&quot;. <br /> <br /> However, I don't wish to have this setting activate for security. How can I give my user root privileges without changing my group. Can I change my users &quot;Shell&quot; to something other than CSH?<br /> <br /> Is it possible to set alerts with this data? e.g. if hdd temp is above 40 deg C to email me??? <br /> <br /> Also how do I modify this to show all HDD's not just ada. I have others such as da, but want this script above to show all hdd's.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #! /bin/bash adastat () { echo -n `camcontrol cmd $1 -a &quot;E5 00 00 00 00 00 00 00 00 00 00 00&quot; -r - | awk '{print $10 &quot; &quot; ; }'` &quot; &quot; ; } echo echo System Temperatures - `date` cat /etc/version.freenas uptime | awk '{ print &quot;\nSystem Load:&quot;,$8,$9,$10,&quot;\n&quot; }' echo &quot;CPU Temperature:&quot; sysctl -a | egrep -E &quot;cpu\.[0-9]+\.temp&quot; echo echo &quot;Drive Activity Status&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo echo &quot;HDD Temperature:&quot; for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') do echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` done echo</pre></div></div>
 

warri

Guru
Joined
Jun 6, 2011
Messages
1,193
<div class="bbWrapper">You can just change to the root user with <b>su</b> in the shell - no need to allow root login directly.<br /> <br /> If you want alerts, you need to extend the script and run it as regular cronjob. Then check for temperature threshold and send an email if necessary. A while ago I actually added email reports to the script: <a href="https://gist.github.com/fkleon/6147471" target="_blank" class="link link--external" rel="nofollow ugc noopener">https://gist.github.com/fkleon/6147471</a> (should still work in 9.1.1 - you can use it as a base for extension if you wanted to)<br /> To include all of your hard drives, either hard code the actual names or parse the output of camcontrol devlist.<br /> <br /> If you have SMART alerts set up, they will also notify you if the temperatures get to high. You can even <a href="http://doc.freenas.org/index.php/S.M.A.R.T." target="_blank" class="link link--external" rel="nofollow ugc noopener">set an arbitrary temperature threshold</a>. Using this is probably the better solution, since it's built into FreeNAS. And you get critical SMART reports for free as well.</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper">ok cool Ill take a look thanks.<br /> <br /> I still doesnt allow me to run it:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>user@FreeNAS:~ % su /mnt/Volume4/bin/hdd-temp.sh su: Sorry user@FreeNAS:~ % sudo /mnt/Volume4/bin/hdd-temp.sh Password: Sorry, user user is not allowed to execute '/mnt/Volume4/bin/hdd-temp.sh' as root on FreeNAS.local.</pre></div></div>
 

warri

Guru
Joined
Jun 6, 2011
Messages
1,193
<div class="bbWrapper">Just type su without anything else. You will be prompted to enter the root password. After that you're in a root shell. But yeah, use the built-in SMART if possible. ;)</div>
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
<div class="bbWrapper">Yeh I will set that up.<br /> <br /> Now just curious to get this working though.<br /> <br /> Still no luck.<br /> <br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre>user@FreeNAS:~ % su su: Sorry</pre></div><br /> <br /> not sure whats going on...</div>
 
Top