Community discussions

MikroTik App
 
haggis
just joined
Topic Author
Posts: 19
Joined: Thu May 31, 2007 2:26 am

Setting up Probes to monitor Disk Usage

Tue Oct 16, 2007 9:56 am

I am trying to figure out using a probe for HDD_USAGE. I have seen a previous post regarding this and it suggested doing the following:

Create a new probe:

Type: function
Available: if(hdd_usage()>0, 1, -1)
Error: if(hdd_usage()<90, "", "Disk usage > 89%")
Value: hdd_usage()
Unit: %
Rate: none

Note: this probe uses the built in hdd_usage function, so for devices with multiple hard disks it looks at the average disk space usage. Of course, the above example is easily adapted for a specific hard drive. Just replace 'hdd_usage' with the appropriate oid("xxxxx") call.

This has worked ok except it looks like the probes are still working for HDD average. I have created 3 separate probes for 3 different disks. I then replaced the HDD_USAGE parameter with the Value parameter for the hard drive e.g: ‘C:\ Label:Oracle Serial Number 47565f0’ this works ok except when I replace the HDD_USAGE parameter in the error section. When I do this I get a notification that says ‘(parse failed)’.

What exactly is it that I have to do?
 
CliffThomson
just joined
Posts: 1
Joined: Wed Oct 31, 2007 12:51 pm

Re: Setting up Probes to monitor Disk Usage

Wed Oct 31, 2007 12:58 pm

I'm also having this problem I'm assuming i have to replace every instance of hdd_usage() with the specified oid (oid("iso.1.3.6.1.2.1.25.2.3.1.6.2")) in this case.
Do i have my syntax correct? I'm getting parse errors. What i want to do is set up probes for each disk, unless someone has a probe that will report if a disk reaches say, 70 or 75% on any single disk, rather than an average across all disks.
Cliff.
 
hmarques
just joined
Posts: 3
Joined: Fri Nov 02, 2007 6:33 pm

Re: Setting up Probes to monitor Disk Usage

Fri Nov 02, 2007 6:58 pm

Hi all
I´d love to have your problem :)

Because i´m unable to use correctly the hdd_usage...

Every times it says it´s ok, even when i change it to 10% or every other value...
I´m feeling dumb :S:S

In the graphic, it is always at 0...
[img=http://img221.imageshack.us/img221/8138 ... th4.th.jpg]

Can anyone help me?
 
winkelman
Member Candidate
Member Candidate
Posts: 235
Joined: Wed Aug 16, 2006 5:00 pm
Location: Amsterdam, The Netherlands

Re: Setting up Probes to monitor Disk Usage

Tue Nov 06, 2007 8:21 pm

I'm the 'creator' of the above suggested probe, so I guess I'll help you further along :D

You have to adjust the function that retrieves the specific disk's relative usage. As a matter of fact, such an OID does not exist, but you can find OID's for the absolute disk size and usage, so we can use those to calculate the relative usage (percent of disk space used). (I don't know the units (sectors perhaps?) of those OID's, but since we're only interested in the percentage, not the actual bytes, that doesn't matter.)

Perform an SNMP walk and look in the iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable... neighborhood. You can find the proper drive's name in the description part of that table. For example, in my case this piece of text will display the C-drive's usage when pasted onto a device's appearance label:
C-drive: [(oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1")/oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.1"))*100]%
Now simply replace the 'hdd_usage()' part in the above suggested probe with
(oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1")/oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.1"))*100
and you'll have a probe triggers when the C-drive goes over 90% usage.
 
winkelman
Member Candidate
Member Candidate
Posts: 235
Joined: Wed Aug 16, 2006 5:00 pm
Location: Amsterdam, The Netherlands

Re: Setting up Probes to monitor Disk Usage

Tue Nov 06, 2007 8:26 pm

To make it really copy-paste :-)

Name: Disk C < 90% (cause the probe actually checks if the usage is lower than 90%: then it's good :)
Type: function
Available: if((oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1")/oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.1"))*100>0, 1, -1)
Error: if((oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1")/oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.1"))*100<90, "", "Disk usage > 89%")
Value: (oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1")/oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.1"))*100
Unit: %
Rate: none

Tested and works! 8)
 
hmarques
just joined
Posts: 3
Joined: Fri Nov 02, 2007 6:33 pm

Re: Setting up Probes to monitor Disk Usage

Wed Nov 14, 2007 6:19 pm

hi

partially useful :)

I installed and configured snmp, now the probe doesn´t timeout everytime :shock:
feeling nerd :? :D

but your probe isnt universal...
i cant use it in an heterogeneus environment, in the "Available", "Error" and "Value" I can submit only one oid, number 1,2,3, whathever... that can refer to diferent physical things, like a diskette or a cd drive, or a disk, ...

oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.1" can refer in one server to the diskette drive and in other server to the C drive, do you see?

take a look here:

server 1:

Image

As you can see in in hrStorageDescr, oid...1 is A:, oid...2 is C: and oid...3 is D:

and it changes in other machines, take a look at server 2:

Image


but your ideia is correct, maybe we can develop it a bit in order to make it universal ;)
tomorrow´s job :)
any help appreciated


See you
 
winkelman
Member Candidate
Member Candidate
Posts: 235
Joined: Wed Aug 16, 2006 5:00 pm
Location: Amsterdam, The Netherlands

Re: Setting up Probes to monitor Disk Usage

Fri Nov 16, 2007 6:46 pm

but your probe isnt universal...
i cant use it in an heterogeneus environment, in the "Available", "Error" and "Value" I can submit only one oid, number 1,2,3, whathever... that can refer to diferent physical things, like a diskette or a cd drive, or a disk, ...
Yes, I know, that's why I wrote:
You can find the proper drive's name in the description part of that table. For example, in my case this piece of text will display the C-drive's usage when pasted onto a device's appearance label:
There is no universal way, because the exact OID of a particular drive can change in any computer. Usually 'A:\' will be '1' and 'C:\' perhaps '2', but in a computer without 'A:\' 'C:\' may become '1'. It all depends on the computers disks.

That's why you have to verify the description to see which drive actually is which number...

:D
 
slech
Long time Member
Long time Member
Posts: 537
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Setting up Probes to monitor Disk Usage

Thu Feb 14, 2008 6:19 pm

I make 1 2 3 4 5 disk partition monitor


######## Disk 1 - Disk space <90% monitored, 1 partition

Name:Disk 1 usage < 90%
Type:function

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)

Error: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<90, "", "Disk usage > 89%")


Value:(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

Unit:%

Rate:none


####### Disk 2 - Disk space <90% monitored, 2 partition
Name:Disk 2 usage < 90%

Type:function

Available:if((oid("1.3.6.1.2.1.25.2.3.1.6.2")/oid("1.3.6.1.2.1.25.2.3.1.5.2"))*100>0, 1, -1)

Error:if((oid("1.3.6.1.2.1.25.2.3.1.6.2")/oid("1.3.6.1.2.1.25.2.3.1.5.2"))*100<90, "", "Disk usage > 89%")

Value:(oid("1.3.6.1.2.1.25.2.3.1.6.2")/oid("1.3.6.1.2.1.25.2.3.1.5.2"))*100

Unit:%

Rate:none


####### Disk 3 - Disk space <90% monitored, 3 partition
Name:Disk 3 usage < 90%

Type:function

Available:if((oid("1.3.6.1.2.1.25.2.3.1.6.3")/oid("1.3.6.1.2.1.25.2.3.1.5.3"))*100>0, 1, -1)

Error:if((oid("1.3.6.1.2.1.25.2.3.1.6.3")/oid("1.3.6.1.2.1.25.2.3.1.5.3"))*100<90, "", "Disk usage > 89%")

Value:(oid("1.3.6.1.2.1.25.2.3.1.6.3")/oid("1.3.6.1.2.1.25.2.3.1.5.3"))*100

Unit:%

Rate:none


####### Disk 4 - Disk space <90% monitored, 4 partition
Name:Disk 4 usage < 90%

Type:function

Available:if((oid("1.3.6.1.2.1.25.2.3.1.6.4")/oid("1.3.6.1.2.1.25.2.3.1.5.4"))*100>0, 1, -1)

Error:if((oid("1.3.6.1.2.1.25.2.3.1.6.4")/oid("1.3.6.1.2.1.25.2.3.1.5.4"))*100<90, "", "Disk usage > 89%")

Value:(oid("1.3.6.1.2.1.25.2.3.1.6.4")/oid("1.3.6.1.2.1.25.2.3.1.5.4"))*100

Unit:%

Rate:none


####### Disk 5 - Disk space <90% monitored, 5 partition
Name:Disk 5 usage < 90%
Type:function

Available:if((oid("1.3.6.1.2.1.25.2.3.1.6.5")/oid("1.3.6.1.2.1.25.2.3.1.5.5"))*100>0, 1, -1)

Error:if((oid("1.3.6.1.2.1.25.2.3.1.6.5")/oid("1.3.6.1.2.1.25.2.3.1.5.5"))*100<90, "", "Disk usage > 89%")

Value:(oid("1.3.6.1.2.1.25.2.3.1.6.5")/oid("1.3.6.1.2.1.25.2.3.1.5.5"))*100

Unit:%

Rate:none
 
slech
Long time Member
Long time Member
Posts: 537
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Setting up Probes to monitor Disk Usage

Fri Feb 15, 2008 12:01 pm

Hi.
I try to monitor dick space with less GB

####### Disk 3 - Disk space < 2Gb monitored, 3 partition
Name:Disk 3 usage < 2 Gb
Type:function

Available:if((oid("1.3.6.1.2.1.25.2.3.1.5.3")-oid("1.3.6.1.2.1.25.2.3.1.6.3"))*oid("1.3.6.1.2.1.25.2.3.1.4.3")/1024/1024/1024>2, 1, -1)

Error:if((oid("1.3.6.1.2.1.25.2.3.1.5.3")-oid("1.3.6.1.2.1.25.2.3.1.6.3"))*oid("1.3.6.1.2.1.25.2.3.1.4.3")/1024/1024/1024<2, "", "Disk 3 space < 2Gb")

Value:if((oid("1.3.6.1.2.1.25.2.3.1.5.3")-oid("1.3.6.1.2.1.25.2.3.1.6.3"))*oid("1.3.6.1.2.1.25.2.3.1.4.3")/1024/1024/1024

Unit:Gb

Rate:none

but it doesn't work :(
Why ?
 
slech
Long time Member
Long time Member
Posts: 537
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Setting up Probes to monitor Disk Usage

Sat Feb 16, 2008 7:16 pm

I try to make universal function to monitor space on disk C in Windws, but in doesn't work.

name:disk_C
Description:disk C on WIndows
Code:oid(array_element(oid_column("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize", 600),array_find(oid_column("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageDescr", 600),"C:\ Label:")))/1024/1024

Any idea ?

Thanks.
 
User avatar
Masyanich
newbie
Posts: 49
Joined: Mon Jan 21, 2013 8:19 am
Location: Russian province
Contact:

Re: Setting up Probes to monitor Disk Usage

Sun Nov 29, 2020 5:49 pm

Hello friends!
How to display the free space in gigabytes on the map for a linux computer ?

Image

for example, I see that the root size has an index of 31, but when I put
drive: [oid("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.31")/4096]
it shows only used place space
 
slech
Long time Member
Long time Member
Posts: 537
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Setting up Probes to monitor Disk Usage

Sun Nov 29, 2020 7:36 pm

Masyanich, to get free space you probably should use a formula: Available-Used
Something like this:
(oid("Avaliable")-oid("Used")/1024/1024/1024)

Who is online

Users browsing this forum: No registered users and 26 guests