Sorry we lost some posts because of database errors!

*New 12.1 series Release:
2020-09-01: XigmaNAS 12.1.0.4.7728 - released

*New 11.4 series Release:
2020-08-27: XigmaNAS 11.4.0.4.7718 - released!


We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

HDD Temperature over SNMP

SNMP service.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
tsrodger
Starter
Starter
Posts: 34
Joined: 17 Apr 2013 08:44
Location: Russia / St Petersburg
Status: Offline

HDD Temperature over SNMP

#1

Post by tsrodger »

I'm trying to setup monitoring HDD temperature in Cacti (jail) over SNMP (The Idea from here)

Following script is used on NAS part ($1 number of SATA in /dev/ )

Code: Select all

#!/bin/sh
/usr/local/sbin/smartctl -a /dev/ada$1 | /usr/bin/grep 'Temperature_Celsius' | /usr/bin/awk '{ print $10; }'
exit 0
I added following lines in auxiliary field in SNMP service settings:

Code: Select all

extNames.2 = "HDDTemp"
extCommand.2 = "/mnt/pool_rdz/service/utils/hddtemp.sh 0"
So, I can receive the temperature of HDD #1 over SNMP by requesting .1.3.6.1.4.1.2021.8.1.101.2 (result from bsnmpwalk)
1.3.6.1.4.1.2021.8.1.101.2 = 38


unfortunately, I've 11 HDD and this method is not suitable for my system (adding of 11 externals commands)...I can rewrite sh script to receive the temperatures of all drives in system at once, but i do not know how to send this data correctly over SNMP...
Fractal Design XL / ASUS P5K WS / Intel E6850 / 8GB / Intel EXPI9301CTBLK / Sil3114 / 9x HDD

User avatar
alexey123
Moderator
Moderator
Posts: 1555
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: HDD Temperature over SNMP

#2

Post by alexey123 »

/usr/local/sbin/smartctl -a /dev/ada$1
Remove $
Home12.1.0.4 - Ingva (revision 7091)/ x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM / UPS Ippon Back Power Pro 600
Lab 12.1.0.4 - Ingva (revision 7091) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600

tsrodger
Starter
Starter
Posts: 34
Joined: 17 Apr 2013 08:44
Location: Russia / St Petersburg
Status: Offline

Re: HDD Temperature over SNMP

#3

Post by tsrodger »

Script is working fine, there is no error:
$1 - It's the first input argument for script...

The questions is how to add support of more then one hdd using only one external command script
Fractal Design XL / ASUS P5K WS / Intel E6850 / 8GB / Intel EXPI9301CTBLK / Sil3114 / 9x HDD

User avatar
alexey123
Moderator
Moderator
Posts: 1555
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: HDD Temperature over SNMP

#4

Post by alexey123 »

This example 11-14 can help you.
Home12.1.0.4 - Ingva (revision 7091)/ x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM / UPS Ippon Back Power Pro 600
Lab 12.1.0.4 - Ingva (revision 7091) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600

tsrodger
Starter
Starter
Posts: 34
Joined: 17 Apr 2013 08:44
Location: Russia / St Petersburg
Status: Offline

Re: HDD Temperature over SNMP

#5

Post by tsrodger »

alexey123 wrote:This example 11-14 can help you.
I've version of scripts which can provide all drive information...

Hm, I've currently the auxiliary field in SNMP setting like:
extNames.2 = "HDDTemp /dev/ada0"
extCommand.2 = "/mnt/pool_rdz/service/utils/hddtemp.sh 0"
extNames.3 = "HDDTemp /dev/ada1"
extCommand.3 = "/mnt/pool_rdz/service/utils/hddtemp.sh 1"
extNames.4 = "HDDTemp /dev/ada2"
extCommand.4 = "/mnt/pool_rdz/service/utils/hddtemp.sh 2"
extNames.5 = "HDDTemp /dev/ada3"
extCommand.5 = "/mnt/pool_rdz/service/utils/hddtemp.sh 3"
extNames.6 = "HDDTemp /dev/ada4"
extCommand.6 = "/mnt/pool_rdz/service/utils/hddtemp.sh 4"
extNames.7 = "HDDTemp /dev/ada5"
extCommand.7 = "/mnt/pool_rdz/service/utils/hddtemp.sh 5"
extNames.8 = "HDDTemp /dev/ada6"
extCommand.8 = "/mnt/pool_rdz/service/utils/hddtemp.sh 6"
....
so, i'm looking for the way to optimize this settings and using one or two external commands to get temperature from all drives, but not 11!!
Fractal Design XL / ASUS P5K WS / Intel E6850 / 8GB / Intel EXPI9301CTBLK / Sil3114 / 9x HDD

User avatar
alexey123
Moderator
Moderator
Posts: 1555
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: HDD Temperature over SNMP

#6

Post by alexey123 »

If you can rewrite first script for read array ?
Example

Code: Select all

 #!/bin/sh
disk0=`/usr/local/sbin/smartctl -a /dev/ada0 | /usr/bin/grep 'Temperature_Celsius' | /usr/bin/awk '{ print $10; }'`
disk1=`/usr/local/sbin/smartctl -a /dev/ada1 | /usr/bin/grep 'Temperature_Celsius' | /usr/bin/awk '{ print $10; }'`
disk2=`/usr/local/sbin/smartctl -a /dev/ada2 | /usr/bin/grep 'Temperature_Celsius' | /usr/bin/awk '{ print $10; }'`
echo $disk0 $disk1 $disk2
snmp setting is

Code: Select all

extNames.2 = "HDDTemp /dev/ada0"
extCommand.2 = "/mnt/pool_rdz/service/utils/hddtemp.sh"
Result
Image

I have 3in1
Image
Home12.1.0.4 - Ingva (revision 7091)/ x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM / UPS Ippon Back Power Pro 600
Lab 12.1.0.4 - Ingva (revision 7091) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600

tsrodger
Starter
Starter
Posts: 34
Joined: 17 Apr 2013 08:44
Location: Russia / St Petersburg
Status: Offline

Re: HDD Temperature over SNMP

#7

Post by tsrodger »

My version of script to retrieve all SATA hdds info:

Code: Select all

#!/bin/sh
set tempsData=
for nasHDD in /dev/ada*
do
  tempsData=${tempsData}\ `/usr/local/sbin/smartctl -a $nasHDD | /usr/bin/grep 'Temperature_Celsius' | /usr/bin/awk '{ print $10; }$
done
echo $tempsData
exit 0
result looks like

Code: Select all

1.3.6.1.4.1.2021.8.1.101.2 = 37 39 38 33 32 29 33 29 28 30 32 
So, the final step is to setup cacti
Fractal Design XL / ASUS P5K WS / Intel E6850 / 8GB / Intel EXPI9301CTBLK / Sil3114 / 9x HDD

User avatar
alexey123
Moderator
Moderator
Posts: 1555
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: HDD Temperature over SNMP

#8

Post by alexey123 »

tsrodger wrote:So, the final step is to setup cacti
Type your install procedure for another users, pls
Home12.1.0.4 - Ingva (revision 7091)/ x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM / UPS Ippon Back Power Pro 600
Lab 12.1.0.4 - Ingva (revision 7091) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600

ab5031
NewUser
NewUser
Posts: 3
Joined: 27 Oct 2013 16:14
Status: Offline

Re: HDD Temperature over SNMP

#9

Post by ab5031 »

tsrodger wrote:

Code: Select all

1.3.6.1.4.1.2021.8.1.101.2 = 37 39 38 33 32 29 33 29 28 30 32 
Can you please upload here Cacti Data Input Methods or Data Queries + .xml for above?

User avatar
antonio7
NewUser
NewUser
Posts: 10
Joined: 28 May 2015 19:45
Contact:
Status: Offline

Re: HDD Temperature over SNMP

#10

Post by antonio7 »

Just a little optimization:

Code: Select all

smartctl -a /dev/$1 | awk '/^194/{print $4}'
NAS4Free 10.2.0.2 (x64-embedded) - Prester (revision 2235)
MB: Gigabyte GA-MA770-US3, CPU: AMD Athlon™ X2 3600+ 2Ghz, Mem: 8GB, LAN: Intel 82574L
https://ananich.pro

Post Reply

Return to “SNMP”