Hi looking for a bit of assistance of where i'm going wrong trying to calulated used % on logical qnap drives via snmp.
the qnap snmp has used and total snmp but not %.
Have the following 
parameter
.1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.{instance} 
Transformation 
sub main() 
{ 
diskfree = GetDCIValueByName($node,SNMPGetValue(transport,".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.".$1)); 
disksize = GetDCIValueByName($node,SNMPGetValue(transport,".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.".$1));
return (100*(diskfree/disksize));
 }
instance discovery
snmp walk
.1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.1
Let me know where i'm going wrong or if something is missed happy to build this in to the qnap template once working and share.
Thanks
			
			
			
				I managed to get this working just need a few tweeks as sometime receive 0 randomly. Any ideas welcome.
Description - QNAP - Storage - Disk - Logical - available {instance-name} (%)
parameter
.1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.{instance}
Transformation
// We are originally querying the actual volume size. This is required for
// calculation and to have an instance to work with.
volumeSize = $1;
// Obtain the actual instance we're after. The last octet in the OID. Result will be stored in $1.
$dci->name match "^.*\.([0-9]+)$";
// Build OID to use to obtain space used
oid = ".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4." .$1;
// Connect to node via SNMP
transport = CreateSNMPTransport($node);
if (transport == null) 
return false; // node does not support SNMP or transport cannot be created
// Obtain matching used space to calculate usage in %, which we can actually alert on.
volumefree = SNMPGetValue(transport, oid);
if (volumefree == null)
return false;
return format(int64(volumefree) / volumeSize * 100,1,2);
			
			
			
				The concatenation operator is ".." not "." so in the above script it should be 
oid = ".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4." ..$1;or else you will get an error
			
			
			
				Quote from: jdowney on November 17, 2021, 03:58:11 PMI managed to get this working just need a few tweeks as sometime receive 0 randomly. Any ideas welcome.
You can add trace command to trace data to server log when incorrect data is obtained. Like: 
trace(1, "Incorrect value");