Having been using FreeNAS for a while now I've learnt a hell of a lot from these forums, often what not to do so I thought I'd try and give something back!
I'm no expert and I certainly don't always follow the rules (no ECC Ram in my home server shhhhhh ;) ) but I hope this might be of help or interest to someone.
With FreeNAS 9.3 came the move to net-SNMP rather than bdsnmp and this means it's pretty trivial to enable monitoring of additional custom parameters via SNMP.
This tutorial looks at adding CPU and disk temperature monitoring.
Notes: My FreeNAS is an HP Microserver N54L with 5 x 3TB WD Red's in RaidZ2.
The script's here might need tweaking to match your hardware (number of CPU's etc).
The scripts are just quickly knocked up with no thought given to cleaning them up / combining them.
The custom OID's I've used were not in use on my FreeNAS install, you should check via snmpget to confirm they're also free on yours.
I won't cover how to add these extra parameters to your SNMP monitoring application. I use Cacti at home and Nagios at work, it's assumed if you want to do this you'll be familiar with those
and how to add new data sources to be monitored / graphed etc.
Step 1.
We need script to be called that will get the temperature's we want, I've used the below.
CPU0 - snmp-cpu-0-temp.sh
#!/bin/sh
if [ "$1" = "-g" ]
then
echo .1.3.6.1.2.1.25.1.8
echo gauge
sysctl -a | egrep -E "cpu\.0+\.temp" | awk '{print $2}' | cut -c 1,2,4
fi
exit 0
CPU1 - snmp-cpu-1-temp.sh
#!/bin/sh
if [ "$1" = "-g" ]
then
echo .1.3.6.1.2.1.25.1.9
echo gauge
sysctl -a | egrep -E "cpu\.1+\.temp" | awk '{print $2}' | cut -c 1,2,4
fi
exit 0
The above gives a result with 3 digits, avoiding the decimal place and removing the trailing "C". When you add this data to you will need a CDEF or similar to divide by 10 to counter this.
The -g option means echo the output to screen.
Step 2. Update SNMP config to include the new data.
In the FreeNAS gui, go to Services and the config for SNMP fill out the required fields and in Aux Parameters add the following:
pass .1.3.6.1.2.1.25.1.8 /bin/sh <path to script dir>/snmp-cpu-0-temp.sh
pass .1.3.6.1.2.1.25.1.9 /bin/sh <path to script dir>/snmp-cpu-1-temp.sh
Start the SNMP service.
SSH into your FreeNAS server and run:
snmpget -v2c -c public localhost .1.3.6.1.2.1.25.1.8
snmpget -v2c -c public localhost .1.3.6.1.2.1.25.1.9
All being well you'll see a 3 digit result (remember needs dividing by 10 for the actual result).
Pretty simple and of course easily extendible to add disk temperatures and pretty much anything else you can write a script for.
Cheers for reading,
Paddy
Credit : http://www.satsignal.eu/raspberry-pi/monitoring.html which gave me the base knowledge to expand SNMP monitoring with custom OID's etc.
I'm no expert and I certainly don't always follow the rules (no ECC Ram in my home server shhhhhh ;) ) but I hope this might be of help or interest to someone.
With FreeNAS 9.3 came the move to net-SNMP rather than bdsnmp and this means it's pretty trivial to enable monitoring of additional custom parameters via SNMP.
This tutorial looks at adding CPU and disk temperature monitoring.
Notes: My FreeNAS is an HP Microserver N54L with 5 x 3TB WD Red's in RaidZ2.
The script's here might need tweaking to match your hardware (number of CPU's etc).
The scripts are just quickly knocked up with no thought given to cleaning them up / combining them.
The custom OID's I've used were not in use on my FreeNAS install, you should check via snmpget to confirm they're also free on yours.
I won't cover how to add these extra parameters to your SNMP monitoring application. I use Cacti at home and Nagios at work, it's assumed if you want to do this you'll be familiar with those
and how to add new data sources to be monitored / graphed etc.
Step 1.
We need script to be called that will get the temperature's we want, I've used the below.
CPU0 - snmp-cpu-0-temp.sh
#!/bin/sh
if [ "$1" = "-g" ]
then
echo .1.3.6.1.2.1.25.1.8
echo gauge
sysctl -a | egrep -E "cpu\.0+\.temp" | awk '{print $2}' | cut -c 1,2,4
fi
exit 0
CPU1 - snmp-cpu-1-temp.sh
#!/bin/sh
if [ "$1" = "-g" ]
then
echo .1.3.6.1.2.1.25.1.9
echo gauge
sysctl -a | egrep -E "cpu\.1+\.temp" | awk '{print $2}' | cut -c 1,2,4
fi
exit 0
The above gives a result with 3 digits, avoiding the decimal place and removing the trailing "C". When you add this data to you will need a CDEF or similar to divide by 10 to counter this.
The -g option means echo the output to screen.
Step 2. Update SNMP config to include the new data.
In the FreeNAS gui, go to Services and the config for SNMP fill out the required fields and in Aux Parameters add the following:
pass .1.3.6.1.2.1.25.1.8 /bin/sh <path to script dir>/snmp-cpu-0-temp.sh
pass .1.3.6.1.2.1.25.1.9 /bin/sh <path to script dir>/snmp-cpu-1-temp.sh
Start the SNMP service.
SSH into your FreeNAS server and run:
snmpget -v2c -c public localhost .1.3.6.1.2.1.25.1.8
snmpget -v2c -c public localhost .1.3.6.1.2.1.25.1.9
All being well you'll see a 3 digit result (remember needs dividing by 10 for the actual result).
Pretty simple and of course easily extendible to add disk temperatures and pretty much anything else you can write a script for.
Cheers for reading,
Paddy
Credit : http://www.satsignal.eu/raspberry-pi/monitoring.html which gave me the base knowledge to expand SNMP monitoring with custom OID's etc.
Last edited: