Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: UI Example (FreeNAS 11) #12

Closed
ValigarmandaTritoch opened this issue Aug 14, 2017 · 9 comments
Closed

Enhancement: UI Example (FreeNAS 11) #12

ValigarmandaTritoch opened this issue Aug 14, 2017 · 9 comments

Comments

@ValigarmandaTritoch
Copy link

ValigarmandaTritoch commented Aug 14, 2017

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 :-)

  1. Edit /usr/local/etc/nginx/nginx.conf file to include a new alias:
    Anywhere in 'server {'
        location /temps {
            alias /mnt/tank/rrdtemp;
        }
  1. Restart nginx:
    service nginx restart

  2. Create index.html file in alias directory (my directory was /mnt/tank/rrdtemp):

<html><body>
<img src="/temps/temps-1min-cpus.png"><BR>
<img src="/temps/temps-1min-drives.png"><BR>
<img src="/temps/temps-5min-cpus.png"><BR>
<img src="/temps/temps-5min-drives.png"><BR>
<img src="/temps/temps-60min-cpus.png"><BR>
<img src="/temps/temps-60min-drives.png"><BR>
</body></html>
  1. (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>
@GusGold
Copy link
Contributor

GusGold commented Sep 6, 2017

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?

@ValigarmandaTritoch
Copy link
Author

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 :)

@svtkobra7
Copy link

@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
temps-2min-drives

Example 2: CPU Y-axis = 43°C - 64°C
temps-2min-cpus

Thanks!

@GusGold
Copy link
Contributor

GusGold commented Sep 15, 2017

@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 temps-5min-everything

@seren
Copy link
Owner

seren commented Sep 15, 2017

@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.

@seren seren mentioned this issue Sep 19, 2017
@spacecabbie
Copy link

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.

@GusGold
Copy link
Contributor

GusGold commented Sep 19, 2017

Hi @spacecabbie

does any one have a elegant solution 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.

@spacecabbie
Copy link

spacecabbie commented Sep 19, 2017

@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

@seren
Copy link
Owner

seren commented Jan 8, 2019

Closing this since it's ancient and fairly resolved.

@seren seren closed this as completed Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants