instance discovery and calculating disk used percentage - qnap snmp
-
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.1Let 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);
-
-
@jdowney said in instance discovery and calculating disk used percentage - qnap snmp:
I 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");
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login