seren / freenas-temperature-graphing

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

IPMI t= #17

Closed twixt01 closed 6 years ago

twixt01 commented 6 years ago

When using IPMI tool, sed is not getting the CPU temp properly. supermicro IPMI

stripped sed:

root@freenas:/mnt/SSD/scripts/freenas-temp # ipmitool -I lanplus -H "192.168.1.5" -U "ADMIN" -f /root/.ipmi sdr elist

CPU Temp | 01h | ok | 3.1 | 68 degrees C System Temp | 0Bh | ok | 7.1 | 50 degrees C Peripheral Temp | 0Ch | ok | 7.2 | 48 degrees C MB_10G Temp | 0Dh | ok | 7.4 | 58 degrees C DIMMA1 Temp | B0h | ok | 32.64 | 51 degrees C DIMMA2 Temp | B1h | ns | 32.65 | No Reading DIMMB1 Temp | B4h | ns | 32.68 | No Reading DIMMB2 Temp | B5h | ns | 32.69 | No Reading FAN1 | 41h | ok | 29.1 | 3200 RPM FAN2 | 42h | ns | 29.2 | No Reading FAN3 | 43h | ns | 29.3 | No Reading FAN4 | 44h | ns | 29.4 | No Reading VCCP | 20h | ok | 3.2 | 1.83 Volts VDIMM | 24h | ok | 32.1 | 1.18 Volts 12V | 30h | ok | 7.17 | 12.06 Volts 5VCC | 31h | ok | 7.33 | 4.92 Volts 3.3VCC | 32h | ok | 7.32 | 3.35 Volts VBAT | 33h | ok | 7.18 | 3.17 Volts 5V Dual | 38h | ok | 7.15 | 4.95 Volts 3.3V AUX | 39h | ok | 7.12 | 3.27 Volts Chassis Intru | AAh | ok | 23.1 |

with sed:

ipmitool -I lanplus -H "192.168.1.5" -U "ADMIN" -f /root/.ipmi sdr elist | sed -Ene 's/^CPU[^ ]+ +Temp +| .* ([^ ]+) degrees C/\1/p' | sed -n "$((i+1))p"

Illegal variable name.

seren commented 6 years ago

Are you running this command in Bash? The error you're describing could possibly be due to using $() syntax in csh or tsh which doesn't support it.

I tried running the ipmitool output through the sed command you described and it worked in Bash 4.4.12.

twixt01 commented 6 years ago

Ah of course. I am trying to troubleshoot this command when it runs in the cron. I think when it runs it is creating a null value so when it runs graph the rrd is creating 7 values but CPU is empty and causing following runs to fail.

When I run it without the sed -n "$((i+1))p" section it shows this. ipmitool -I lanplus -H "192.168.1.5" -U "ADMIN" -f /root/.ipmi sdr elist | sed -Ene 's/^CPU[^ ]+ +Temp +| .* ([^ ]+) degrees C/\1/p'

CPU41 System53 Peripheral47 MB_10G55 DIMMA145

When I run the rrd script: Creating rrdtool db file: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd Rrdtool arguments: DS:cpu0:GAUGE:120:0:150 DS:ada0:GAUGE:120:0:100 DS:ada1:GAU GE:120:0:100 DS:ada2:GAUGE:120:0:100 DS:ada3:GAUGE:120:0:100 DS:ada4:GAUGE:120:0 :100 DS:ada5:GAUGE:120:0:100 /usr/local/bin/rrdtool create /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd --ste p 60 DS:cpu0:GAUGE:120:0:150 DS:ada0:GAUGE:120:0:100 DS:ada1:GAUGE:120:0:100 DS: ada2:GAUGE:120:0:100 DS:ada3:GAUGE:120:0:100 DS:ada4:GAUGE:120:0:100 DS:ada5:GAU GE:120:0:100 RRA:MAX:0.5:1:3000

root@freenas:~ # /mnt/SSD/Scripts/freenas-temp/rrd.sh --platform "esxi" --ipmitool_username ADMIN --ipmitool_address 192.168.1.5 /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd ERROR: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd: expected 7 data source readings (got 6) from N ERROR: Couldn't update /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd with the data provided. Running diagnostics... rrd.sh version: 1.0 rrd-graph.sh version: rrd-lib.sh version: 1.0 Testing file permissions... Testing chmod... Testing file field count... The number of fields in the rrd file (7) does not match the number of fields supplied (6) You may need to delete the rrd file and try again Test failed (returned 1)

If I override the temp variable in the script it works fine, (except my temp value is now made up.)

twixt01 commented 6 years ago

root@freenas:~ # /mnt/SSD/Scripts/freenas-temp/rrd.sh --platform "esxi" --ipmitool_username ADMIN --ipmitool_address 192.168.1.5 /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd -v Script version: 1.0 Platform is set to 'esxi'. Username is 'ADMIN and ip is '192.168.1.5' Rrdtool database filename: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd Current working directory is: /mnt/SSD/Scripts/freenas-temp Rrdtool database doesn't exist. Creating it. Platform is set to 'esxi'. Attempting to retrieve the list of CPUs using ipmitool with username 'ADMIN and ip 192.168.1.5... drivedevs: ada0 drivedevs: ada0 ada1 drivedevs: ada0 ada1 ada2 drivedevs: ada0 ada1 ada2 ada3 drivedevs: ada0 ada1 ada2 ada3 ada4 drivedevs: ada0 ada1 ada2 ada3 ada4 ada5 numcpus: 1 Sampling every 60 seconds Creating rrdtool db file: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd Rrdtool arguments: DS:cpu0:GAUGE:120:0:150 DS:ada0:GAUGE:120:0:100 DS:ada1:GAUGE:120:0:100 DS:ada2:GAUGE:120:0:100 DS:ada3:GAUGE:120:0:100 DS:ada4:GAUGE:120:0:100 DS:ada5:GAUGE:120:0:100 /usr/local/bin/rrdtool create /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd --step 60 DS:cpu0:GAUGE:120:0:150 DS:ada0:GAUGE:120:0:100 DS:ada1:GAUGE:120:0:100 DS:ada2:GAUGE:120:0:100 DS:ada3:GAUGE:120:0:100 DS:ada4:GAUGE:120:0:100 DS:ada5:GAUGE:120:0:100 RRA:MAX:0.5:1:3000 Initialized datafile root@freenas:~ # /mnt/SSD/Scripts/freenas-temp/rrd.sh --platform "esxi" --ipmitool_username ADMIN --ipmitool_address 192.168.1.5 /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd -v Script version: 1.0 Platform is set to 'esxi'. Username is 'ADMIN and ip is '192.168.1.5' Rrdtool database filename: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd Current working directory is: /mnt/SSD/Scripts/freenas-temp Running script: '/mnt/SSD/Scripts/freenas-temp/temps-rrd-format.sh -v --platform esxi --ipmitool_username ADMIN --ipmitool_address 192.168.1.5'

37:38:37:38:37:36

(running script again non-verbosely) Data: 37:38:37:38:37:36

Updating the db: '/usr/local/bin/rrdtool update /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd N:37:38:37:38:37:36' ERROR: /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd: expected 7 data source readings (got 6) from N ERROR: Couldn't update /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd with the data provided. Running diagnostics... rrd.sh version: 1.0 rrd-graph.sh version: rrd-lib.sh version: 1.0 Testing file permissions... Testing chmod... Testing file field count... The number of fields in the rrd file (7) does not match the number of fields supplied (6) You may need to delete the rrd file and try again Test failed (returned 1) root@freenas:~ #

twixt01 commented 6 years ago

root@freenas:~ # /mnt/SSD/Scripts/freenas-temp/rrd.sh --platform "esxi" --ipmitool_username ADMIN --ipmitool_address 192.168.1.5 /mnt/SSD/Scripts/freenas-temp/temps-1min.rrd -d

seren commented 6 years ago

It might be line 40 in rrd-lib.sh which should be split into 2 export lines. Could you try that, and if it doesn't work, try posting the output of /mnt/SSD/Scripts/freenas-temp/temps-rrd-format.sh -v --platform esxi --ipmitool_username ADMIN --ipmitool_address 192.168.1.5?

seren commented 6 years ago

I’m closing this issue since it’s been quiet for a while. If the problem still exists, please reopen it or comment.