Hi everyone, i’m new on the dude, Thanks a lots for the probes thread and so on, it really help me.
I try to make a probe for free space left on disk, but i have a little problem.
This is my probe :
Function:
Name : hdd_gb
Code : (((((oid(“1.3.6.1.2.1.25.2.3.1.5.1”)-oid(“1.3.6.1.2.1.25.2.3.1.6.1”))*oid(“1.3.6.1.2.1.25.2.3.1.4.1”))/1024)/1024)/1024)
Probe :
Nom : Free space left
Type : Function
Disponible : hdd_gb()<>“False”
Erreur : if(hdd_gb()<>“False”,if(hdd_gb() > 20, “”, concatenate(" Free space low C: =", hdd_gb(), “Gb Left”)), “Failed to read Drive”)
My problem is that i have a result like 19.523645 Gb when the space left is under 20.
But i just want to have 19 Gb.
Someone have an idea ?
Maxoni, The function you created does not handle the “False” case. (that means the probe will return 0 if the function doesn’t work.
By adding code like below to your function
if(oid(x), return value, false)
you can determine if the oid is available, return the value, or false.
Keying on False in the error line will let you know the device is down. Where as keying on false in the available line will let you know if the oid is even readable. They are both useful to code for. Also a not false result on available is how the dude determines if it will install the probe when you use auto discovery to add probes.
I do, or at least I think I do - it’s showing all the servers, and detecting all relevant services (DNS/Ping/Disk etc.) I’ve set up a community just for The Dude and they’re all working like that…
Tried changing the Function to the one you posted and it’s still showing the same…
It’s not a huge issue really, as I’ve edited the built in Disk service to show as down if the free space is less than 10GB, but it’d be nice to be able to do it with additional hard drives, not just the C Drive…
It’s not a huge issue really, as I’ve edited the built in Disk service to show as down if the free space is less than 10GB, but it’d be nice to be able to do it with additional hard drives, not just the C Drive…
In this post you can see drive C and D.
It depends of OID you use.
If the dude is set to auto discover and you use -1 for false in the available line the probe will install on every device.
AVAILABLE: if((oid(“1.3.6.1.2.1.25.2.3.1.6.1”)/oid(“1.3.6.1.2.1.25.2.3.1.5.1”))*100>0, 1, -1)
The available line is to determine if the OID exists on the device in question but negative one is not false in the available line…
It is way better to create a function that returns a value or False. Then call that function from a probe.
Function
disk03test
if(array_size(oid_column(“1.3.6.1.2.1.25.2.3.1.6”,10,5)),round((oid(“1.3.6.1.2.1.25.2.3.1.6.3”,10,5)/oid(“1.3.6.1.2.1.25.2.3.1.5.3”,10,5))*100),“False”)
Another function to grabs the name of the disk then if it is in error the drive letter or unix name can be returned in the error message.
Funciton
disk03name
oid(“1.3.6.1.2.1.25.2.3.1.3.3” ,10,5)
So now in the probe the available line is simplified to test for “False”.
The error line can also detect if the probe can’t read the disk or if the disk is full…
The Probe
Available: disk03test() <> “False”
Error: if(disk03test()<>“False”,if(disk03test() < 90, “”, concatenate("Warning: “, disk03name(), " is “, disk03test(),”%”)), “Failed read 3rd disk”)
Value: disk03test()
unit: %