Closed ValigarmandaTritoch closed 5 years ago
Awesome tutorial. Been running this for a few weeks now. Although maybe once a week, my ngninx config gets overwritten. Does the same happen to you?
Yea, I hit the same issue. I'm sure there's a way to create an add-in file to nginx rather that modify it directly, but I haven't had time to poke. I ended up creating a cron to update the nginx file if it did not contain the update :)
@ValigarmandaTritoch: Thanks for the tutorial! 👍 Question: Could you pass along your cronjob that updates the nginx file?
@ValigarmandaTritoch @seren: Question: Are you aware of any way to use a single script to graph both cpu and hdd temps (separately) without them both being constrained to the same Y-axis? a. As illustrated below, I have a much broader range for CPU temps, but like to stay "zoomed in" on HDD temps to make sure they don't cross 40°C. b. To generate both graphs, with different Y-axis, I'm running two separate scripts; however, there must be a much "cleaner" way to accomplish this!
Example 1: HDD Y-axis = 34.5°C - 40.5°C
Example 2: CPU Y-axis = 43°C - 64°C
Thanks!
@svtkobra7 It's probably a very ugly solutions compared to theirs, but here's my solution https://github.com/GusGold/FreeNASTempsGUI
Also, here's a basic graph with both cpu and hdd on the same scale until I can work out the right axis. (This is actually already included in the file, however there were some typos I corrected)
Add the following to your rrd-graph.sh
outputfilename=everything
title="Temperature: All CPUs and Drives, ${interval} minute interval"
guidrule=
defsandlines=
for (( i=0; i < ${numcpus}; i++ )); do
(( colorindex = i % NUMCOLORS )) # If we run out of colors, start over
defsandlines="${defsandlines} DEF:cpu${i}=${datafile}:cpu${i}:MAX LINE1:cpu${i}#${LINECOLORS[$colorindex]}:cpu${i}"
done
i=0
for drdev in ${drivedevs}; do
(( colorindex = ( i + numcpus ) % NUMCOLORS )) # Don't reuse the cpu colors unless we have to
defsandlines="${defsandlines} DEF:${drdev}=${datafile}:${drdev}:MAX LINE1:${drdev}#${LINECOLORS[$colorindex]}:${drdev}"
(( i = i + 1 ))
done
write_graph_to_disk
Here's what the above generates
@svtkobra7 As you've seen, the temps are hard-coded into the script at the moment (https://github.com/seren/freenas-temperature-graphing/blob/master/rrd-graph.sh#L111). The easiest way to make them variable would be to replace the temperature values to environment variable references and then set them when you run the script: Old:
MAXGRAPHTEMP=70
MINGRAPHTEMP=20
SAFETEMPMAX=46
SAFETEMPMIN=37
New:
MAXGRAPHTEMP=${MAXGRAPHTEMP:-70}
MINGRAPHTEMP=${MINGRAPHTEMP:-20}
SAFETEMPMAX=${SAFETEMPMAX:-46}
SAFETEMPMIN=${SAFETEMPMIN:-37}
Then you would run it like this:
MAXGRAPHTEMP=55 SAFETEMPMAX=44 /pathto/rrd-graph.sh /pathto/temps-5min.rrd
I've actually just added this change and updated the README, so hopefully that will help you avoid having to have two copies of the script with different values hard-coded inside.
Hi all this was exactly what i was looking for (thanks @seren for pointing me here)
I am running into the issue mention before the conf get overwritten does any one have a elegant solution for this ? I see the mention of a cron job but i only know how to set that up to replace the file risking overwriting freenas changes is it possible to cronjob only the addition of these files ? I am bit basic when it comes to linux.
Hi @spacecabbie
does any one have a
elegantsolution for this?
https://github.com/GusGold/FreeNASTempsGUI only appends to nginx.conf
, so any other changes that you or FreeNAS makes to it are preserved.
The down side to my solution is the complexity of running node in a jail but it achieves the goal of keeping the temps in the GUI.
@GusGold Perfect i am already running a jail so that not a biggie I will try your suggestion !
Ran into an problem i made an issue in https://github.com/GusGold/FreeNASTempsGUI
Closing this since it's ancient and fairly resolved.
Just a quick note on how to drop this in the UI if people are interested - yes, it probably goes away with updates, I haven't tested :-)
Edit /usr/local/etc/nginx/nginx.conf file to include a new alias: Anywhere in 'server {'
Restart nginx:
service nginx restart
Create index.html file in alias directory (my directory was /mnt/tank/rrdtemp):
(Optional) Add link to reporting tab of UI: at the end of /usr/local/www/freenasUI/templates/reporting/index.html (before the
</div>
):<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title: '{% trans "Temps" %}', href: '/temps', refreshOnShow: true"></div>