SNMP Get disk free space
-
-
-
Hello
I already found the problem in my script.
It was no script problem, but a usage problem.
I tested it with the "Test" option, but I used it on the template instead of the applied server.
The transofrmation script itself seem's to be OK. It is working and returns the free disk space.However I will also have a look to your hdd template andrey-k.
Attached there is my actual template.
-
Hello andrey--k
I tested your hdd-template. In general it seems to be ok. But there is no transforamtion script to display the values in GByte.
So I decided to merge your hdd-template with filter and instances with my working transformation script (see above).
But I had no real success, because it seems that {instance} is not allowed in transformation scripts.
e.g.
...
oid = ".1.3.6.1.2.1.25.2.3.1.5." . {instance};
disksize = SNMPGetValue(transport, oid); // get Disk sizeI also created a template for getting the memory size/used/free/percent template similar to the disk templates.
My calculation of free memory here is also not working. (Other calculations are working)
transformation script:
sub main()
{
memused = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.6.".$1));
memsize = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.5.".$1));
memfree = (memsize - memused) * 64 / 1024;
return (memfree);
}Attached there are my templates for Disk size/free/used/percent and Memory size/used/free/percent
It would be nice if somebody could check what is wrong with my templates.
-
Transformation script to get disk space in Gib:
transport = CreateSNMPTransport($node); if (transport == null) { return -1; } OidInstance = substr($dci->name,rindex($dci->name,".")+1); oidBlockSize = ".1.3.6.1.2.1.25.2.3.1.4." . OidInstance; blockSize = SNMPGetValue(transport, oidBlockSize); blockSize = blockSize/1024; GiB = round($1 * blockSize/(1024*1024)); return GiB;Experiment shows, that main () {} is not needed.
-
Hello andrey-k
Transformation script is working perfect now.
Attached my modified storage template für disk an memory usage (size/used/free/percent) in Gbyte/MByte.
Maybe you can check it once more if everything is really working perfect and we can add this template to the standard
templates lib for other users.One additional question.
Is there a way to modify also the DCI description in a kind that instead of Disk {instance} the storage description
from OID .1.3.6.1.2.1.25.2.3.1.3 is displayed ? e.g. Disk C:\System
-
-
-
At the moment I provide some tests:
1 Disk usage/free gives incorrect values on empty/full disks.
2 Memory usage do not gathered 3-5 pools after hard-disk-volume add/remove. later all in order.But also good news: system normaly works when disk manipulation was done.
-
@ytrasse said in SNMP Get disk free space:
Hello
I already found the problem in my script.
It was no script problem, but a usage problem.
I tested it with the "Test" option, but I used it on the template instead of the applied server.
The transofrmation script itself seem's to be OK. It is working and returns the free disk space.However I will also have a look to your hdd template andrey-k.
Attached there is my actual template.
Hi ytrasse,
I tried to add a new DCI based on your attached file. But i could only get 0 for the last value.
-
@ytrasse said in SNMP Get disk free space:
Hello andrey--k
I tested your hdd-template. In general it seems to be ok. But there is no transforamtion script to display the values in GByte.
So I decided to merge your hdd-template with filter and instances with my working transformation script (see above).
But I had no real success, because it seems that {instance} is not allowed in transformation scripts.
e.g.
...
oid = ".1.3.6.1.2.1.25.2.3.1.5." . {instance};
disksize = SNMPGetValue(transport, oid); // get Disk sizeI also created a template for getting the memory size/used/free/percent template similar to the disk templates.
My calculation of free memory here is also not working. (Other calculations are working)
transformation script:
sub main()
{
memused = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.6.".$1));
memsize = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.5.".$1));
memfree = (memsize - memused) * 64 / 1024;
return (memfree);
}Attached there are my templates for Disk size/free/used/percent and Memory size/used/free/percent
It would be nice if somebody could check what is wrong with my templates.Hi ytrasse,
I have tried your transformation script and it's not working. Is there any updates?
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