seren / freenas-temperature-graphing

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

First run creates RRD file for cpu + hds, second run fails trying to only update hd temps #19

Closed george-gwu closed 6 years ago

george-gwu commented 6 years ago

For some reason, this doesn't work for me. The first run creates a RRD file for 2 CPUs and 8 hard drives. The computer only has one CPU and 8 hard drives. The subsequent runs only attempts to update the 8 hard drives and errors out:

ERROR: The number of fields in the rrd file (10) does not match the number of fields supplied (8)

First Run:

/mnt/Tank/System/freenas-temperature-graphing/rrd.sh -v --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd Script version: 1.0 Platform is set to 'esxi'. Username is 'ipmi and ip is 'ipmi' Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd Current working directory is: /mnt/Tank/System/freenas-temperature-graphing Rrdtool database doesn't exist. Creating it. Platform is set to 'esxi'. Attempting to retrieve the list of CPUs using ipmitool with username 'ipmi and ip ipmi... drivedevs: da1 drivedevs: da1 da2 drivedevs: da1 da2 da3 drivedevs: da1 da2 da3 da4 drivedevs: da1 da2 da3 da4 da5 drivedevs: da1 da2 da3 da4 da5 da6 drivedevs: da1 da2 da3 da4 da5 da6 da7 drivedevs: da1 da2 da3 da4 da5 da6 da7 da8 numcpus: 2 Sampling every 60 seconds Creating rrdtool db file: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd Rrdtool arguments: DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100 /usr/local/bin/rrdtool create /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd --step 60 DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100 RRA:MAX:0.5:1:3000 Initialized datafile

Second Run:

/mnt/Tank/System/freenas-temperature-graphing/rrd.sh -v --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd Script version: 1.0 Platform is set to 'esxi'. Username is 'ipmi and ip is 'ipmi' Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd Current working directory is: /mnt/Tank/System/freenas-temperature-graphing Running script: '/mnt/Tank/System/freenas-temperature-graphing/temps-rrd-format.sh -v --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi'

35:31:34:26:26:30:32:34

(running script again non-verbosely) Data: 35:31:34:26:26:30:32:34

Updating the db: '/usr/local/bin/rrdtool update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd N:35:31:34:26:26:30:32:34' ERROR: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd: expected 10 data source readings (got 8) from N ERROR: Couldn't update /mnt/Tank/System/freenas-temperature-graphing/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 (10) does not match the number of fields supplied (8) You may need to delete the rrd file and try again Test failed (returned 1)

seren commented 6 years ago

Thanks for the error report. It looks like the initialization run correctly creates the rrd file with 10 inputs (2 CPU, and 8 drives), however subsequent update runs don't include the CPU temperatures. I'll look into this (I don't have an ESX system to test, but this should be easy to figure out).

seren commented 6 years ago

I suspect the error is either here where I was attempting to export two variables at once, or in the ipmitool command here.

I've pushed a fix for the export and also for not running all the code verbosely (which made the verbose output less useful). Could you pull the latest commit and try again?

george-gwu commented 6 years ago

Here is a new DB creation and update. Still failing but looks more promising, going to look it over now too.

root@freenas:/mnt/Tank/System/freenas-temperature-graphing # rm *.rrd
root@freenas:/mnt/Tank/System/freenas-temperature-graphing # /mnt/Tank/System/freenas-temperature-graphing/rrd.sh -v -d --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ verbose=1
+ '[' -n '' ']'
+ '[' -n 1 ']'
+ echo 'Script version: 1.0'
Script version: 1.0
+ case "${PLATFORM}" in
+ '[' -n 1 ']'
+ echo 'Platform is set to '\''esxi'\''. Username is '\''ipmi and ip is '\''ipmi'\'''
Platform is set to 'esxi'. Username is 'ipmi and ip is 'ipmi'
+ '[' -z ipmi ']'
+ '[' -z ipmi ']'
+ args=' --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi'
++ id -u
+ '[' 0 '!=' 0 ']'
+ '[' -z /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -n 1 ']'
+ echo 'Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd'
Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+++ dirname /mnt/Tank/System/freenas-temperature-graphing/rrd.sh
++ cd /mnt/Tank/System/freenas-temperature-graphing
++ pwd
+ CWD=/mnt/Tank/System/freenas-temperature-graphing
+ '[' -n 1 ']'
+ echo 'Current working directory is: /mnt/Tank/System/freenas-temperature-graphing'
Current working directory is: /mnt/Tank/System/freenas-temperature-graphing
+ . /mnt/Tank/System/freenas-temperature-graphing/rrd-lib.sh
++ RRDSCRIPTLIBVERSION=1.0
+++ mktemp
++ GETTEMP=/tmp/tmp.EKDJ5AT1
++ cat
++ trap '{ rm /tmp/tmp.EKDJ5AT1; }' EXIT
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -n 1 ']'
+ echo 'Rrdtool database doesn'\''t exist. Creating it.'
Rrdtool database doesn't exist. Creating it.
+ get_devices
+ case "${PLATFORM}" in
+ '[' -n 1 ']'
+ echo 'Platform is set to '\''esxi'\''. Attempting to retrieve the list of CPUs using ipmitool with username '\''ipmi and ip ipmi...'
Platform is set to 'esxi'. Attempting to retrieve the list of CPUs using ipmitool with username 'ipmi and ip ipmi...
++ ipmitool -I lanplus -H ipmi -U ipmi -f /root/.ipmi sdr elist all
++ grep -c -i 'cpu.*temp'
+ numcpus=2
+ drivedevs=
++ /sbin/sysctl -n kern.disks
++ awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }'
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da0
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=
+ '[' -n '' ']'
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da1
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=33
+ '[' -n 33 ']'
+ drivedevs=' da1'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1'
drivedevs:  da1
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da2
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=30
+ '[' -n 30 ']'
+ drivedevs=' da1 da2'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2'
drivedevs:  da1 da2
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da3
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=33
+ '[' -n 33 ']'
+ drivedevs=' da1 da2 da3'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3'
drivedevs:  da1 da2 da3
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da4
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=24
+ '[' -n 24 ']'
+ drivedevs=' da1 da2 da3 da4'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3 da4'
drivedevs:  da1 da2 da3 da4
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da5
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=24
+ '[' -n 24 ']'
+ drivedevs=' da1 da2 da3 da4 da5'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3 da4 da5'
drivedevs:  da1 da2 da3 da4 da5
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da6
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=29
+ '[' -n 29 ']'
+ drivedevs=' da1 da2 da3 da4 da5 da6'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3 da4 da5 da6'
drivedevs:  da1 da2 da3 da4 da5 da6
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da7
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=31
+ '[' -n 31 ']'
+ drivedevs=' da1 da2 da3 da4 da5 da6 da7'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3 da4 da5 da6 da7'
drivedevs:  da1 da2 da3 da4 da5 da6 da7
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/da8
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=32
+ '[' -n 32 ']'
+ drivedevs=' da1 da2 da3 da4 da5 da6 da7 da8'
+ '[' -n 1 ']'
+ echo 'drivedevs:  da1 da2 da3 da4 da5 da6 da7 da8'
drivedevs:  da1 da2 da3 da4 da5 da6 da7 da8
+ for i in $(/sbin/sysctl -n kern.disks | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }')
++ /usr/local/sbin/smartctl -a /dev/cd0
++ awk -f /tmp/tmp.EKDJ5AT1
+ DevTemp=
+ '[' -n '' ']'
+ '[' -n 1 ']'
+ echo 'numcpus: 2'
numcpus: 2
+ export numcpus
+ export drivedevs
++ echo /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
++ sed 's/.*temps-\(.*\)min.rrd/\1/'
+ interval=1
+ '[' -z 1 ']'
+ timespan=60
+ doubletimespan=120
+ '[' -n 1 ']'
+ echo 'Sampling every 60 seconds'
Sampling every 60 seconds
+ rrdarg=
+ (( i=0 ))
+ (( i < numcpus ))
+ rrdarg=' DS:cpu0:GAUGE:120:0:150'
+ (( i++  ))
+ (( i < numcpus ))
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150'
+ (( i++  ))
+ (( i < numcpus ))
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100'
+ for i in ${drivedevs}
+ rrdarg=' DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100'
+ echo 'Creating rrdtool db file: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd'
Creating rrdtool db file: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ echo 'Rrdtool arguments:   DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100'
Rrdtool arguments:   DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100
+ echo /usr/local/bin/rrdtool create /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd --step 60 DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100 RRA:MAX:0.5:1:3000
/usr/local/bin/rrdtool create /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd --step 60 DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100 RRA:MAX:0.5:1:3000
+ /usr/local/bin/rrdtool create /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd --step 60 DS:cpu0:GAUGE:120:0:150 DS:cpu1:GAUGE:120:0:150 DS:da1:GAUGE:120:0:100 DS:da2:GAUGE:120:0:100 DS:da3:GAUGE:120:0:100 DS:da4:GAUGE:120:0:100 DS:da5:GAUGE:120:0:100 DS:da6:GAUGE:120:0:100 DS:da7:GAUGE:120:0:100 DS:da8:GAUGE:120:0:100 RRA:MAX:0.5:1:3000
+ '[' 0 == 0 ']'
+ '[' -n 1 ']'
+ echo 'Initialized datafile'
Initialized datafile
+ exit 0
+ rm /tmp/tmp.EKDJ5AT1
root@freenas:/mnt/Tank/System/freenas-temperature-graphing # /mnt/Tank/System/freenas-temperature-graphing/rrd.sh -v -d --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ verbose=1
+ '[' -n '' ']'
+ '[' -n 1 ']'
+ echo 'Script version: 1.0'
Script version: 1.0
+ case "${PLATFORM}" in
+ '[' -n 1 ']'
+ echo 'Platform is set to '\''esxi'\''. Username is '\''ipmi and ip is '\''ipmi'\'''
Platform is set to 'esxi'. Username is 'ipmi and ip is 'ipmi'
+ '[' -z ipmi ']'
+ '[' -z ipmi ']'
+ args=' --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi'
++ id -u
+ '[' 0 '!=' 0 ']'
+ '[' -z /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -n 1 ']'
+ echo 'Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd'
Rrdtool database filename: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+++ dirname /mnt/Tank/System/freenas-temperature-graphing/rrd.sh
++ cd /mnt/Tank/System/freenas-temperature-graphing
++ pwd
+ CWD=/mnt/Tank/System/freenas-temperature-graphing
+ '[' -n 1 ']'
+ echo 'Current working directory is: /mnt/Tank/System/freenas-temperature-graphing'
Current working directory is: /mnt/Tank/System/freenas-temperature-graphing
+ . /mnt/Tank/System/freenas-temperature-graphing/rrd-lib.sh
++ RRDSCRIPTLIBVERSION=1.0
+++ mktemp
++ GETTEMP=/tmp/tmp.G0iQafey
++ cat
++ trap '{ rm /tmp/tmp.G0iQafey; }' EXIT
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ func_test_writable /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -f /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ touch /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ return 0
+ '[' -n 1 ']'
+ echo 'Running script: '\''/mnt/Tank/System/freenas-temperature-graphing/temps-rrd-format.sh -v  --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi'\'''
Running script: '/mnt/Tank/System/freenas-temperature-graphing/temps-rrd-format.sh -v  --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi'
+ '[' -n 1 ']'
+ echo ''

+ '[' -n 1 ']'
+ echo ''

+ '[' -n 1 ']'
+ /mnt/Tank/System/freenas-temperature-graphing/temps-rrd-format.sh -v --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi
Platform is set to 'esxi'. Username is 'ipmi and ip is 'ipmi'
Current working directory is: /mnt/Tank/System/freenas-temperature-graphing
Platform is set to 'esxi'. Attempting to retrieve the list of CPUs using ipmitool with username 'ipmi and ip ipmi...
drivedevs:  da1
drivedevs:  da1 da2
drivedevs:  da1 da2 da3
drivedevs:  da1 da2 da3 da4
drivedevs:  da1 da2 da3 da4 da5
drivedevs:  da1 da2 da3 da4 da5 da6
drivedevs:  da1 da2 da3 da4 da5 da6 da7
drivedevs:  da1 da2 da3 da4 da5 da6 da7 da8
numcpus: 2
Platform is set to 'esxi'. Attempting to retrieve CPU1 temperatures using ipmitool with username 'ipmi and ip ipmi...
Platform is set to 'esxi'. Attempting to retrieve CPU2 temperatures using ipmitool with username 'ipmi and ip ipmi...
Raw data: :::33:30:33:24:24:29:31:32
Cleaned up data:
33:30:33:24:24:29:31:32
Done gathering temp data returning
+ '[' -n 1 ']'
+ echo ''

+ '[' -n 1 ']'
+ echo ''

+ '[' -n 1 ']'
+ echo '(running script again non-verbosely)'
(running script again non-verbosely)
++ /mnt/Tank/System/freenas-temperature-graphing/temps-rrd-format.sh --platform esxi --ipmitool_username ipmi --ipmitool_address ipmi
+ data=33:30:33:24:24:29:31:32
+ '[' -n 1 ']'
+ echo 'Data: 33:30:33:24:24:29:31:32'
Data: 33:30:33:24:24:29:31:32
+ '[' -n 1 ']'
+ echo ''

+ '[' -n 1 ']'
+ echo 'Updating the db: '\''/usr/local/bin/rrdtool update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd N:33:30:33:24:24:29:31:32'\'''
Updating the db: '/usr/local/bin/rrdtool update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd N:33:30:33:24:24:29:31:32'
+ /usr/local/bin/rrdtool update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd N:33:30:33:24:24:29:31:32
ERROR: /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd: expected 10 data source readings (got 8) from N
+ '[' 1 == 0 ']'
+ echo 'ERROR: Couldn'\''t update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd with the data provided. Running diagnostics...'
ERROR: Couldn't update /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd with the data provided. Running diagnostics...
+ func_debug_setup
+ echo 'rrd.sh version: 1.0'
rrd.sh version: 1.0
+ echo 'rrd-graph.sh version: '
rrd-graph.sh version: 
+ echo 'rrd-lib.sh version: 1.0'
rrd-lib.sh version: 1.0
+ echo 'Testing file permissions...'
Testing file permissions...
+ func_test_writable /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -e /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ '[' -f /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd ']'
+ touch /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
+ return 0
+ func_debug_setup_return_test 0
+ '[' 0 == 0 ']'
+ echo 'Testing chmod...'
Testing chmod...
+ func_test_chmod /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
++ dd if=/dev/urandom bs=300 count=1 status=noxfer
++ sha256
+ TEMPFILENAME=77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ touch /tmp/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ chmod 600 /tmp/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ rm -f /tmp/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ dir=/mnt/Tank/System/freenas-temperature-graphing
+ '[' -d /mnt/Tank/System/freenas-temperature-graphing ']'
+ touch /mnt/Tank/System/freenas-temperature-graphing/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ chmod 600 /mnt/Tank/System/freenas-temperature-graphing/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ rm -f /mnt/Tank/System/freenas-temperature-graphing/chmodtest_77855629eeef808135a2905059f0e170c800b11e800f328c224da055cbf14c5d
+ func_debug_setup_return_test 0
+ '[' 0 == 0 ']'
+ echo 'Testing file field count...'
Testing file field count...
+ func_compare_data_field_count_to_rrd_gauge_count
+ '[' -z 33:30:33:24:24:29:31:32 ']'
++ /usr/local/bin/rrdtool info /mnt/Tank/System/freenas-temperature-graphing/temps-1min.rrd
++ grep -c 'type = "GAUGE"'
+ gauges_in_file=10
+ colons_from_data=:::::::
+ fields_in_data=8
+ '[' 10 == 8 ']'
+ echo 'The number of fields in the rrd file (10) does not match the number of fields supplied (8)'
The number of fields in the rrd file (10) does not match the number of fields supplied (8)
+ echo 'You may need to delete the rrd file and try again'
You may need to delete the rrd file and try again
+ return 1
+ func_debug_setup_return_test 1
+ '[' 1 == 0 ']'
+ echo 'Test failed (returned 1)'
Test failed (returned 1)
+ exit 1
+ rm /tmp/tmp.G0iQafey
root@freenas:/mnt/Tank/System/freenas-temperature-graphing # 
george-gwu commented 6 years ago

Here is the output of the IPMI CPU command. It seems like a secondary bug is that it detects 2 CPUs even though my server has one... I have a proposed fix below. It makes the error 9 !=8, but it is a step closer.

ipmitool -I lanplus -H ipmi -U ipmi -f /root/.ipmi sdr elist all
CPU Temp         | 01h | ok  |  3.1 | 31 degrees C
PCH Temp         | 0Ah | ok  |  7.3 | 42 degrees C
System Temp      | 0Bh | ok  |  7.1 | 33 degrees C
Peripheral Temp  | 0Ch | ok  |  7.2 | 33 degrees C
MB_10G Temp      | 0Dh | ok  |  7.4 | 44 degrees C
VcpuVRM Temp     | 10h | ok  |  8.1 | 32 degrees C
VmemABVRM Temp   | 12h | ok  |  8.2 | 29 degrees C
VmemCDVRM Temp   | 13h | ok  |  8.3 | 30 degrees C
DIMMA1 Temp      | B0h | ok  | 32.64 | 38 degrees C
DIMMB1 Temp      | B4h | ok  | 32.68 | 36 degrees C
DIMMC1 Temp      | B8h | ns  | 32.72 | No Reading
DIMMD1 Temp      | BCh | ns  | 32.76 | No Reading
FAN1             | 41h | ok  | 29.1 | 1500 RPM
FAN2             | 42h | ok  | 29.2 | 1400 RPM
FAN3             | 43h | ok  | 29.3 | 1200 RPM
FAN4             | 44h | ok  | 29.4 | 1200 RPM
FAN5             | 45h | ns  | 29.5 | No Reading
FANA             | 46h | ns  | 29.6 | No Reading
12V              | 30h | ok  |  7.17 | 12 Volts
5VCC             | 31h | ok  |  7.33 | 4.95 Volts
3.3VCC           | 32h | ok  |  7.32 | 3.28 Volts
VBAT             | 33h | ok  |  7.18 | 3.17 Volts
Vcpu             | 34h | ok  |  3.3 | 1.80 Volts
VDIMMAB          | 35h | ok  | 32.1 | 1.19 Volts
VDIMMCD          | 37h | ok  | 32.2 | 1.20 Volts
5VSB             | 38h | ok  |  7.15 | 4.92 Volts
3.3VSB           | 39h | ok  |  7.19 | 3.21 Volts
1.5V PCH         | 3Ch | ok  |  7.20 | 1.51 Volts
1.2V BMC         | 3Dh | ok  |  7.21 | 1.21 Volts
1.05V PCH        | 3Eh | ok  |  7.12 | 1.05 Volts
Chassis Intru    | AAh | ok  | 23.1 | 
BMC FRU          | 00h | ns  |  0.0 | Logical FRU @00h
ATEN BMC         | 00h | ok  |  0.0 | Dynamic MC @ 20h
NM exception     | 80h | ns  | 46.1 | Event-Only
NM health        | 81h | ns  | 46.2 | Event-Only
NM op cap        | 82h | ns  | 46.3 | Event-Only
NM alert         | 83h | ns  | 46.4 | Event-Only

It seems the grep is hitting on the VcpuVRM Temp line too... so I added a word boundary and it fixes that.

ipmitool -I lanplus -H ipmi -U ipmi -f /root/.ipmi sdr elist all | grep -i 'cpu.*temp'
CPU Temp         | 01h | ok  |  3.1 | 31 degrees C
VcpuVRM Temp     | 10h | ok  |  8.1 | 31 degrees C
ipmitool -I lanplus -H ipmi -U ipmi -f /root/.ipmi sdr elist all | grep -i 'cpu\b.*temp'
CPU Temp         | 01h | ok  |  3.1 | 31 degrees C
seren commented 6 years ago

Yes, I think that both the counting of the CPUs and the gathering of their output was broken. Thanks for the ipmitool example output; I'd only had an example from a multi-CPU system prior to this.

I think your fix will fail on a multi-CPU system because the the CPUs have their number appended (ex. "CPU1 Temp"). I've pushed a fix that I think will work. Could you try it out?

george-gwu commented 6 years ago

Thanks! That seems to have fixed it. Is there any good way to integrate the PNGs in to the control panel?

seren commented 6 years ago

Excellent. I haven't found a good way to integrate the PNGs. I'm hoping FreeNAS eventually gets this functionality natively.