NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
crnet_de
May 12, 2013Aspirant
Munin node plugin reads ReadyNAS enclosure data
I was playing around a bit with MUNIN on the weekend, and after I had success, I'd like to share it with you.
My munin-server runs NOT on my ReadyNAS, but I installed the munin-node.
I wanted to access the Data wich I can see in the Health-Tab from Frontview directly in munin, and prefer shellscripting, so I don't need any scripting language to install.
OK - one thing I needed to install: the bash calculator, but this is IMO more a command ;)
chirpa posted here how to access the sensors and that file (/ramfs/enclosure.cfg) on my NAS (Pro 4) is
and a "cut" on a path-variable delivers the value.
The final goal could be a plugin, wich parses these Data and generates the Sub-Outputs automatically. But one after the other.
I began to create 3 scripts , one for each group (fan/temp/volt) and pimped a lttle bit, failed sometimes, but now it works for me (without parsing, I just copy&pasted the informations from /ramfs/enclosure.cfg)
Here we go:
readynas_fan
that was simple, but the next needs a bit calculation:
readynas_fan
that needed the installation of bc
And the last
readynas_power
That's it so far.
These scripts belong into /usr/share/munin/plugins and symlinked into /etc/munin/plugins and
/etc/munin/plugin-conf.d/munin-node needs 2 lines added:
The ranges for warning- and critical-level are more phantasy atm or copied from the sensors_-script.
I am not good enough with cut/sed/awk to parse the /ramfs/enclosure.cfg for a universal usuable script, but probably someone else likes the idea and works on that. A self-configuring script (readynas_) for 3 symlinks instead of 3 filenames would be great.
Thats for now, and don't forget to backup! :?
My munin-server runs NOT on my ReadyNAS, but I installed the munin-node.
I wanted to access the Data wich I can see in the Health-Tab from Frontview directly in munin, and prefer shellscripting, so I don't need any scripting language to install.
OK - one thing I needed to install: the bash calculator, but this is IMO more a command ;)
chirpa posted here how to access the sensors and that file (/ramfs/enclosure.cfg) on my NAS (Pro 4) is
fan!!0!!desc=SYS,selfcontrolled=0,minrpm=1800,required=1,alternate=0,path=/sys/devices/platform/it87.2576/fan1_input,in_path=/sys/devices/platform/it87.2576/pwm1
fan!!1!!desc=,selfcontrolled=0,minrpm=0,required=0,alternate=1,path=,in_path=
fan!!2!!desc=,selfcontrolled=0,minrpm=0,required=0,alternate=2,path=,in_path=
fan!!3!!desc=,selfcontrolled=0,minrpm=0,required=0,alternate=3,path=,in_path=
fan!!4!!desc=,selfcontrolled=0,minrpm=0,required=0,alternate=4,path=,in_path=
temp!!0!!desc=CPU,mintemp=0,maxtemp=80,divider=1000,path=/sys/devices/platform/coretemp.0/temp1_input
temp!!1!!desc=SYS,mintemp=0,maxtemp=65,divider=1,path=/sys/devices/platform/it87.2576/temp2_input
temp!!2!!desc=,mintemp=0,maxtemp=0,divider=1000,path=
vol!!0!!desc=,minvol=0,maxvol=0,divider=1000,path=
vol!!1!!desc=V5_0,minvol=4.65,maxvol=5.35,divider=1000,path=/sys/devices/platform/it87.2576/in1_input
vol!!2!!desc=,minvol=0,maxvol=0,divider=1000,path=
vol!!3!!desc=,minvol=0,maxvol=0,divider=1000,path=
vol!!4!!desc=V3_3,minvol=3.07,maxvol=3.53,divider=1000,path=/sys/devices/platform/it87.2576/in4_input
vol!!5!!desc=VCOR,minvol=0,maxvol=0,divider=1000,path=
vol!!6!!desc=V+12,minvol=11.16,maxvol=12.84,divider=1000,path=/sys/devices/platform/it87.2576/in6_input
vol!!7!!desc=3VSB,minvol=3.07,maxvol=3.53,divider=1000,path=/sys/devices/platform/it87.2576/in7_input
vol!!8!!desc=VBAT,minvol=3.07,maxvol=3.53,divider=1000,path=/sys/devices/platform/it87.2576/in8_input
vol!!9!!desc=,minvol=0,maxvol=0,divider=1000,path=
and a "cut" on a path-variable delivers the value.
The final goal could be a plugin, wich parses these Data and generates the Sub-Outputs automatically. But one after the other.
I began to create 3 scripts , one for each group (fan/temp/volt) and pimped a lttle bit, failed sometimes, but now it works for me (without parsing, I just copy&pasted the informations from /ramfs/enclosure.cfg)
Here we go:
readynas_fan
#!/bin/bash
LANG=POSIX
LC_LANG=C
#COMPONENT=${0##*_}
if [ "$1" = "config" ]
then
printf 'graph_title fans\n'
printf 'graph_category ReadyNAS Enclosure\n'
printf 'fan0.label SYS-Fan-speed\n'
printf 'fan0.warning 1800:2800\n'
printf 'fan0.critical 1600:2900\n'
printf 'pwm0.label SYS-Fan-pwm\n'
printf 'pwm0.warning 20:120\n'
printf 'pwm0.critical 15:200\n'
exit 0
fi
#get data
FAN0SPEED=$(cat /sys/devices/platform/it87.2576/fan1_input)
FAN0PWM=$(cat /sys/devices/platform/it87.2576/pwm1)
#output
printf "fan0.value %i\n" "${FAN0SPEED}"
printf "pwm0.value %i\n" "${FAN0PWM}"
that was simple, but the next needs a bit calculation:
readynas_fan
#!/bin/bash
LANG=POSIX
LC_LANG=C
#COMPONENT=${0##*_}
if [ "$1" = "config" ]
then
printf 'graph_title Temperature\n'
printf 'graph_category ReadyNAS Enclosure\n'
printf 'CPUT.label CPU-Temp\n'
printf 'CPUT.warning 0:70\n'
printf 'CPUT.critical 0:80\n'
printf 'SYST.label SYS-Temp\n'
printf 'SYST.warning 0:50\n'
printf 'SYST.critical 0:65\n'
exit 0
fi
#get data
CPUTEMPREAD=$(cat /sys/devices/platform/coretemp.0/temp1_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
CPUTEMP=$(echo "${CPUTEMPREAD}/1000" | bc)
SYSTEMP=$(cat /sys/devices/platform/it87.2576/temp2_input)
#output
printf "CPUT.value %3.3f\n" "${CPUTEMP}"
printf "SYST.value %i\n" "${SYSTEMP}"
that needed the installation of bc
And the last
readynas_power
#!/bin/bash
NG=POSIX
LC_LANG=C
#COMPONENT=${0##*_}
if [ "$1" = "config" ]
then
printf 'graph_title Voltage\n'
printf 'graph_vtitle Volts\n'
printf 'graph_vlabel Volt\n'
printf 'graph_category ReadyNAS Enclosure\n'
printf 'graph_args -u 14 -l 3\n'
printf 'volt1.label +5 Volt\n'
printf 'volt1.warning 4.70:5.30\n'
printf 'volt1.critical 4.50:5.50\n'
printf 'volt2.label +3.3 Volt\n'
printf 'volt2.warning 3.1200:3.4800\n'
printf 'volt2.critical 3.00:3.60\n'
printf 'volt3.label +12 Volt\n'
printf 'volt3.warning 11.60:12.80\n'
printf 'volt3.critical 11.20:13.20\n'
printf 'volt4.label +3 Volt SB\n'
printf 'volt4.warning 3.12:3.48\n'
printf 'volt4.critical 3.00:3.60\n'
printf 'volt5.label Battery\n'
printf 'volt5.warning 3.12:3.48\n'
printf 'volt5.critical 3.00:3.60\n'
exit 0
fi
#get data
VOL1READ=$(cat /sys/devices/platform/it87.2576/in1_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
VOL1=$(echo "${VOL1READ}/1000" | bc -l )
VOL4READ=$(cat /sys/devices/platform/it87.2576/in4_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
VOL4=$(echo "${VOL4READ}/1000" | bc -l )
VOL6READ=$(cat /sys/devices/platform/it87.2576/in6_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
VOL6=$(echo "${VOL6READ}/1000" | bc -l )
VOL7READ=$(cat /sys/devices/platform/it87.2576/in7_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
VOL7=$(echo "${VOL7READ}/1000" | bc -l )
VOL8READ=$(cat /sys/devices/platform/it87.2576/in8_input)
#haz dividier, bash calculator must be installed with "apt-get install bc"
VOL8=$(echo "${VOL8READ}/1000" | bc -l )
#output
printf "volt1.value %2.4f\n" "${VOL1}"
printf "volt2.value %2.4f\n" "${VOL4}"
printf "volt3.value %2.4f\n" "${VOL6}"
printf "volt4.value %2.4f\n" "${VOL7}"
printf "volt5.value %2.4f\n" "${VOL8}"
That's it so far.
These scripts belong into /usr/share/munin/plugins and symlinked into /etc/munin/plugins and
/etc/munin/plugin-conf.d/munin-node needs 2 lines added:
[readynas*]
user root
The ranges for warning- and critical-level are more phantasy atm or copied from the sensors_-script.
I am not good enough with cut/sed/awk to parse the /ramfs/enclosure.cfg for a universal usuable script, but probably someone else likes the idea and works on that. A self-configuring script (readynas_) for 3 symlinks instead of 3 filenames would be great.
Thats for now, and don't forget to backup! :?
1 Reply
Replies have been turned off for this discussion
- crnet_deAspirantI uploaded some pics with the results:
NAS-Overview:
http://www.crnet.de/fileadmin/CRNET/Bilder/extpics/NAS-Overview.png
its a bit long for the forum (thats why i made a link), the result from the 3 scripts is here (cutted out from above)
and a detail-page with the parameters (fan):
I played on the beginning with the fan-speed adjustemet to harvest some Data, and the NAS didn't stopped that, thats why I rebooted it later (see uptime in overview).
:D
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!