Monitoring ZFS disk usage using SNMP

Status
Not open for further replies.

Hamish

Cadet
Joined
May 21, 2014
Messages
1
Hi guys,

Is is possible to monitor disk space usage % via SNMP of a Freenas sever? The current file system is ZFS

We use PRTG for network monitoring and I've been able to successfully setup CPU, Network, Memory and uptime monitors but when PRTG did a detailed discovery of the server nothing to monitor disk space came up?

I think I need to add something to the "Aux" part of the SNMP server setup but I have very limited knowledge of SNMP on BSD.

Any help would be greatly appreciated.

Thanks,
H
 

c32767a

Patron
Joined
Dec 13, 2012
Messages
371
The information is available via the SNMP server. I've not used PRTG, so I can't tell you how to configure PRTG to get at it, but from the command line, looking at one of my machines (actually a brand new storinator chassis I'm testing):
Code:
dalton:~ user$ snmpget -v2c -c public nas1 HOST-RESOURCES-MIB::hrStorageDescr.13
HOST-RESOURCES-MIB::hrStorageDescr.13 = STRING: /mnt/vol3, type: zfs, dev: vol3
 
dalton:~ user$ snmpget -v2c -c public nas1 HOST-RESOURCES-MIB::hrStorageType.13
HOST-RESOURCES-MIB::hrStorageType.13 = OID: HOST-RESOURCES-TYPES::hrFSOther
 
dalton:~ user$ snmpget -v2c -c public nas1 HOST-RESOURCES-MIB::hrStorageAllocationUnits.13
HOST-RESOURCES-MIB::hrStorageAllocationUnits.13 = INTEGER: 16384 Bytes
 
dalton:~ user$ snmpget -v2c -c public nas1 HOST-RESOURCES-MIB::hrStorageSize.13
HOST-RESOURCES-MIB::hrStorageSize.13 = INTEGER: 1823883035
 
dalton:~ user$ snmpget -v2c -c public nas1 HOST-RESOURCES-MIB::hrStorageUsed.13
HOST-RESOURCES-MIB::hrStorageUsed.13 = INTEGER: 118898

You would multiply the units by the counter to get the actual space used. In this case, 16384 * 1823883035 = 29 T bytes or so.
Used would be 16384 * 118898 = 2.1 G bytes or so.
 

macross

Cadet
Joined
Aug 26, 2014
Messages
8
you could just get that information from the api directly.

curl -u root:password serverhost serverhost/api/v1.0/storage/volume

parsing that info can be a pain but you can use jsawk

jsawk 'return this.pct_used'
 

c32767a

Patron
Joined
Dec 13, 2012
Messages
371
you could just get that information from the api directly.

curl -u root:password serverhost serverhost/api/v1.0/storage/volume

Including your storage platform's root password in plaintext in a script on a network management station will probably fail a basic network security audit. Your mileage may vary, but I would be very careful about doing that if your network is anything more than a home/personal 1 user network.
 

Dingin

Dabbler
Joined
Apr 15, 2014
Messages
12
Hi, did you get it working?, im trying also to monitor Freenas with prtg and cant add the sensors for cpu and partition, networking.
here is my snmp test
----------------------- New Test -----------------------
Paessler SNMP Tester 5.1.3
19.9.2014 16:43:41 (29 ms) : Device: Homenas-IP
19.9.2014 16:43:41 (44 ms) : SNMP V2c
19.9.2014 16:43:41 (65 ms) : Scan OIDLIB C:\Users\User\Desktop\freenas-HOSTRES.oidlib
Scanning OIDs
from library: "C:\Users\User\Desktop\freenas-HOSTRES.oidlib"
on device: 213.190.120.82
19.9.2014 16:43:41 Start Scan
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource index 1.3.6.1.4.1.12325.1.220.1.2.1.1
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource role 1.3.6.1.4.1.12325.1.220.1.2.1.3
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource extent size 1.3.6.1.4.1.12325.1.220.1.2.1.6
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource keep dirty 1.3.6.1.4.1.12325.1.220.1.2.1.7
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource replication 1.3.6.1.4.1.12325.1.220.1.2.1.10
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource status 1.3.6.1.4.1.12325.1.220.1.2.1.11
19.9.2014 16:43:41 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource dirty 1.3.6.1.4.1.12325.1.220.1.2.1.12
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource reads 1.3.6.1.4.1.12325.1.220.1.2.1.13
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource writes 1.3.6.1.4.1.12325.1.220.1.2.1.14
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource deletes 1.3.6.1.4.1.12325.1.220.1.2.1.15
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource flushes 1.3.6.1.4.1.12325.1.220.1.2.1.16
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource activemap updates 1.3.6.1.4.1.12325.1.220.1.2.1.17
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource read errors 1.3.6.1.4.1.12325.1.220.1.2.1.18
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource write errors 1.3.6.1.4.1.12325.1.220.1.2.1.19
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource delete errors 1.3.6.1.4.1.12325.1.220.1.2.1.20
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource flush errors 1.3.6.1.4.1.12325.1.220.1.2.1.21
19.9.2014 16:43:42 BEGEMOT-HAST-MIB|hast resource: #[1.3.6.1.4.1.12325.1.220.1.2.1.1]|hast resource worker pid 1.3.6.1.4.1.12325.1.220.1.2.1.22
Found OIDs:
No OIDs found

I have also tryed to add in the snmp ausxiliary parameters
begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"

still cant recive any info

anu help would be apresiated

Thansk!
 

Dingin

Dabbler
Joined
Apr 15, 2014
Messages
12
Well i foun that the host res that comes with freenas dont get anything, using a generic one i got this
hrStorageDescr.13 OctetString /mnt/volume1, type: zfs, dev: volume1
hrStorageSize.13 Integer 2008654673
hrStorageUsed.13 Integer 4215620
hrStorageAllocationUnits.13 Integer 512

But in not making sence of the numbers can anyone give me a direction in how to get the persentage used of the total space, and where is to know when a disk is online ( to know when a disk goes off line and needs to be replaced)
 

c32767a

Patron
Joined
Dec 13, 2012
Messages
371
If you look at this post up in the beginning of this thread, you'll see how to calculate the actual sizes.
#3


I have not configured PRTG, so I have no idea how to tell you to do that in PRTG. I'm sure there's probably a way, but I don't know what it is.
 

Dingin

Dabbler
Joined
Apr 15, 2014
Messages
12
Thanks for your answer, is the numbers i get whats making me crazy u do the operation 2008654673 ( units ) * 512 bytes = 1.28 Terabytes... I have 4x3Tb drives in raidz. How can i get the rigth messurments?
 

c32767a

Patron
Joined
Dec 13, 2012
Messages
371
Thanks for your answer, is the numbers i get whats making me crazy u do the operation 2008654673 ( units ) * 512 bytes = 1.28 Terabytes... I have 4x3Tb drives in raidz. How can i get the rigth messurments?

Hard to say. The hrstoragesize looks suspiciously close to a 32 bit integer. Are you sure prtg is querying for a 64 bit response (using v2 or higher) ?
Do you have a box around that can run the snmp-utils? Can you query it with the same commands I used above and see if you get the same answer as PRTG?
 

Dingin

Dabbler
Joined
Apr 15, 2014
Messages
12
If i do one by one i get the same numbers in prtg, prtg is not really the problem, the problem is how to interpret this numbers that are not making sense when i do the sums and conversions . My numbers are way off. Can you give me an example of yours?

Thanks alot for the help!
 

c32767a

Patron
Joined
Dec 13, 2012
Messages
371
If i do one by one i get the same numbers in prtg, prtg is not really the problem, the problem is how to interpret this numbers that are not making sense when i do the sums and conversions . My numbers are way off. Can you give me an example of yours?

Thanks alot for the help!

If you look at #3 above, that's from one of my arrays.
 

Dingin

Dabbler
Joined
Apr 15, 2014
Messages
12
I did that but the numbers are crazy, can you do the numbers with the info i get from the freenas, just to see how far am i?

Thanks
 
Status
Not open for further replies.
Top