Community discussions

MikroTik App
 
Skinzee
just joined
Topic Author
Posts: 17
Joined: Mon Aug 12, 2013 11:07 am
Location: Strasbourg, France

SNMP OID - Free disk size

Mon Feb 23, 2015 10:39 am

Hi,

First of all, i'm sorry for my bad English.

I would like to see on my MAP, the remaining space on my server's disks with SNMP.
I don't found the good OID on internet.

Can you help me ?

Here, a screen on my Probe :
Image
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: SNMP OID - Free disk size

Mon Feb 23, 2015 5:20 pm

Look on my Dude MAP and default gateway, that displays used disk space in %.
Screenshot 2015-02-23 17.17.24.png
You can add such information by clicking right button on the board, then select appearance, click on label and make sure you have "device performance" there.
Screenshot 2015-02-23 17.19.48.png
You do not have the required permissions to view the files attached to this post.
 
Skinzee
just joined
Topic Author
Posts: 17
Joined: Mon Aug 12, 2013 11:07 am
Location: Strasbourg, France

Re: SNMP OID - Free disk size

Mon Mar 09, 2015 9:49 am

Thanks for your reply.

When I add [Device_Performance()], I have that ...
I just want to see the remaining space on my disk.

Image
 
Skinzee
just joined
Topic Author
Posts: 17
Joined: Mon Aug 12, 2013 11:07 am
Location: Strasbourg, France

Re: SNMP OID - Free disk size

Mon Mar 09, 2015 12:29 pm

It's work, I found this :
Make a function called disk01test
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.1",10,5)/oid("1.3.6.1.2.1.25.2.3.1.5.1",10,5))*100),"False")
Repeat the above for as many disks as you have, incrementing the names and oid values by one. Note Drive C is normally disk02.
disk02test
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.2",10,5)/oid("1.3.6.1.2.1.25.2.3.1.5.2",10,5))*100),"False")

Create a probe DriveC
Available : disk02test()<>"False"
Error : if(disk02test()<>"False",if(disk02test() < 80, "", concatenate("Warning: Drive C = ", disk02test(), "%")), "Failed to read Drive C the server might be down")
Value : disk02test()
Unit %
 
Arnoldinobe
just joined
Posts: 5
Joined: Tue Mar 10, 2015 8:04 pm

Re: SNMP OID - Free disk size

Tue Mar 10, 2015 9:08 pm

Hi,

I'm also really interested by implementing a probe which can monitor free disk space.

I found a post in the probe threat of pjulian saying this :
Thanks to a number of people on this forum I have managed to finish a group of functions and probes to monitor disk free space both in MB and in % free for Windows Servers based on the drive letter rather than the disk number. I needed to do this as we monitor a number of servers with differing drive configurations and did not want to have to be specific as to which drive number was C: etc, rather just reference the drive by the drive letter.

These functions and probes can obviously be modified to look at whatever drive letter you want to just by changing the drive letter in the code.

Thanks again to the people who help put this together, you are awesome ! and I hope that this information can be of value to other users.

Please note that this is based on V3.1 of The Dude.

Functions
Function:
Name: win_diskc_free
Description: Disk C free space in megabytes
Code:
if(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:")<>4294967295,

round(((oid(concatenate("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.",
array_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_substring(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"),
(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),",",
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"))
-string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"
)
)))+1))*4096)/1024)/1024)

-

round(((oid(concatenate("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.",
array_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_substring(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"),
(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),",",
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"))
-string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"
)
)))+1))*4096)/1024)/1024)

,
""
)



Function:
Name: win_diskc_free_percent
Description: Disk C free space in percent
Code:
if(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:")<>4294967295,

string_substring(((
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.",
array_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_substring(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"),
(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),",",
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"))
-string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"
)
)))+1))*4096

-

oid(concatenate("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.",
array_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_substring(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"),
(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),",",
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"))
-string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"
)
)))+1))*4096
)

/

(
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.",
array_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_substring(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"),
(
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),",",
string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"))
-string_find(oid_column("1.3.6.1.2.1.25.2.3.1.3",600),"C:"
)
)))+1))*4096
))

*100
, 0, 4)

,
""
)



Probes

Probe Name: win_diskc_free
Available: if(win_diskc_free() > 500, 1, -1)
Error: if(win_diskc_free() < 500, concatenate("Low Disk Space C: ", win_diskc_free(), " MB Free"), "")
Value: win_diskc_free()
Unit: MB
Rate: None

Probe Name: win_diskc_free_percent
Available: if(win_diskc_free_percent() > 10, 1, -1)
Error: if(win_diskc_free_percent() < 10, concatenate("Low Disk Space C: ", win_diskc_free_percent(), " % Free"), "")
Value: win_diskc_free_percent()
Unit: %
Rate: None

Regards
Paul
So I did create the function for the % part and I have no error in it. Probe is also created with no error.

When I add the probe in the services, I get a parsed failed, which is, it seems, a code error ?

Can anyone help in this ?

Thanks

Arnaud
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: SNMP OID - Free disk size

Tue Mar 17, 2015 5:04 pm

Create two Functions, one to grab the name of the disk and one to find the remaining percent.

Name: disk01name
code: oid("1.3.6.1.2.1.25.2.3.1.3.1" ,10,5)

Name: disk01test
code: 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.1",10,5)/oid("1.3.6.1.2.1.25.2.3.1.5.1",10,5))*100),"False")

Put this on your device label.
[disk01name()] [disk01test()]% used

You can make a probe from those functions...

I have this one a device label of a linux machine
[Device.Name]
[disk01name()] [disk01test()]% used
[disk03name()] [disk03test()]% used
[disk06name()] [disk06test()]% used
[disk31name()] [disk31test()]% used
[disk32name()] [disk32test()]% used
[disk33name()] [disk33test()]% used
[disk34name()] [disk34test()]% used
[disk35name()] [disk35test()]% used
[Device.ServicesDown]
 
Arnoldinobe
just joined
Posts: 5
Joined: Tue Mar 10, 2015 8:04 pm

Re: SNMP OID - Free disk size

Fri Mar 20, 2015 4:26 pm

Thanks it works !

I still have 1 problem, it seems that if my drive is equal to 0% it gives me an error to and sees the drive down.

my syntax : if(disk03test()<>"False",if(disk03test() < 85, "", concatenate("Warning: Drive E = ", disk03test(), "%")), "Failed to read Drive E the server might be down")

Where can I specify less than 85 and 0 is ok too ?

Thanks again

Arnaud

Who is online

Users browsing this forum: No registered users and 11 guests