seren / freenas-temperature-graphing

Scripts to graph FreeNAS CPU and drive temperatures
Other
77 stars 14 forks source link

CPU Monitoring for ESXi Users #9

Closed svtkobra7 closed 7 years ago

svtkobra7 commented 7 years ago

Issue: ESXi doesn't pass through CPU temperatures to FreeNAS, so no CPU temperatures are graphed.

Proposed Solution:

  1. Add variable where user specifies BMC IP ADDRESS and USERNAME.

$ipmitool = "/usr/local/bin/ipmitool -I lanplus -H <BMC IP ADDRESS> -U <USERNAME> -f /root/.ipmi

  1. Use remote IPMI command (sdr elist) to obtain sensor name (CPUX) and temperature. An example from my server follows for your reference.

$ipmitool sdr elist | grep "CPU" | grep "Temp" | awk '{print $1, $4}'

CPU1 43 CPU2 62

seren commented 7 years ago

The first stab at addressing this is in: https://github.com/seren/freenas-temperature-graphing/commit/0f5a3ed885bc13ddff791b83c3d67362370012b3, in the exsi branch

seren commented 7 years ago

From @svtkobra7 in outside channel (paraphrased). Copied here for tracking:

I just attempted to test and got the following errors via SSH. Let me know what other info I can provide.

In the below obviously I have substituted my username and IP without quotes.

[root@NAS] /mnt/Tank1/System/Scripts/freenas-temperature-graphing-esxi# ./rrd.sh --platform "esxi" --ipmitool_username x --impitool_ip x --debug
--platform
esxi
Creating rrdtool db file: esxi
Rrdtool arguments:  DS:cpu0:GAUGE:0:0:150 DS:cpu1:GAUGE:0:0:150 DS:cpu2:GAUGE:0:0:150 DS:cpu3:GAUGE:0:0:150 DS:da1:GAUGE:0:0:100 DS:da2:GAUGE:0:0:100 DS:da3:GAUGE:0:0:100 DS:da4:GAUGE:0:0:100 DS:da5:GAUGE:0:0:100 DS:da6:GAUGE:0:0:100 DS:da7:GAUGE:0:0:100 DS:da8:GAUGE:0:0:100 DS:da9:GAUGE:0:0:100 DS:da10:GAUGE:0:0:100 DS:da11:GAUGE:0:0:100 DS:da12:GAUGE:0:0:100 DS:da13:GAUGE:0:0:100 DS:da14:GAUGE:0:0:100 DS:da15:GAUGE:0:0:100 DS:da16:GAUGE:0:0:100
/usr/local/bin/rrdtool create esxi --step 0 DS:cpu0:GAUGE:0:0:150 DS:cpu1:GAUGE:0:0:150 DS:cpu2:GAUGE:0:0:150 DS:cpu3:GAUGE:0:0:150 DS:da1:GAUGE:0:0:100 DS:da2:GAUGE:0:0:100 DS:da3:GAUGE:0:0:100 DS:da4:GAUGE:0:0:100 DS:da5:GAUGE:0:0:100 DS:da6:GAUGE:0:0:100 DS:da7:GAUGE:0:0:100 DS:da8:GAUGE:0:0:100 DS:da9:GAUGE:0:0:100 DS:da10:GAUGE:0:0:100 DS:da11:GAUGE:0:0:100 DS:da12:GAUGE:0:0:100 DS:da13:GAUGE:0:0:100 DS:da14:GAUGE:0:0:100 DS:da15:GAUGE:0:0:100 DS:da16:GAUGE:0:0:100 RRA:MAX:0.5:1:3000
ERROR: step size: value must be positive
ERROR: Couldn't initialize esxi. Running diagnostics...
Script version: 1.0
Testing file permissions...
'esxi' doesn't exist
Testing chmod...
'esxi' doesn't exist
Testing file field count...
Data variable is empty
Test failed (returned 1)
[root@NAS] /mnt/Tank1/System/Scripts/freenas-temperature-graphing-esxi# ./rrd-graph.sh --platform "esxi" --ipmitool_username x --impitool_ip x --debug
./rrd-graph.sh: Unrecognized option: --platform (try --help)
seren commented 7 years ago

Added fixes for some issues. Could you pull the latest changes and see how it works? Also, if you get an error, could you try with the '-d' flag?

svtkobra7 commented 7 years ago

My pleasure ...

[root@NAS] /mnt/Temp# /mnt/Temp/rrd.sh /mnt/Temp/temps-1min.rrd -d --platform "esxi" --ipmitool_username --impitool_ip -d

Output follows: sysctl: unknown oid 'dev.cpu.0.temperature' ERROR: /mnt/Temp/temps-1min.rrd: expected 18 data source readings (got 1) from N ERROR: Couldn't update /mnt/Temp/temps-1min.rrd with the data provided. Running diagnostics... Script version: 1.0 Testing file permissions... Testing chmod... Testing file field count... Data variable is empty Test failed (returned 1)``

temps-1min-drives temps-1min-cpus cron

seren commented 7 years ago

Sorry for the radio silence. I think I've got ipmi support working, though it's hard to know without testing live. Could you test the esxi branch (https://github.com/seren/freenas-temperature-graphing/tree/esxi) and see how it goes (using -d if you get an error).

svtkobra7 commented 7 years ago

No worries at all! Thank you for taking another shot at this.

Command issued via SSH:

/mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/rrd.sh --platform "esxi" --ipmitool_username X --ipmitool_address Y /mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/temps-1min.rrd -d

where X = username and Y = IP address without quotes

Output: sysctl: unknown oid 'dev.cpu.0.temperature' ERROR: /mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/temps-1min.rrd: expected 20 data source readings (got 1) from N ERROR: Couldn't update /mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/temps-1min.rrd with the data provided. Running diagnostics... Script version: 1.0 Testing file permissions... Testing chmod... Testing file field count... Data variable is empty Test failed (returned 1)

Command issued via SSH:

/mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/rrd-graph.sh /mnt/Tank1/System/CronJobs/freenas-temperature-graphing-esxi/temps-1min.rrd -d

Output: null

I'm happy to test subsequent updates and revert as quickly as possible. Also, please let me know if I may be doing something wrong on my end. Thanks for your continued work on this.

seren commented 7 years ago

The changes for this have been tested and merged into the master branch.