• 0

Graph that shows the number of disks in system


Henrik.Grevelund
 Share

Question

Hi,

I use SNMP to gather information from a number of linux machines. They are used as backup proxies using hot-add.
I would like to create a graph showing the number of disk each proxy has mountet.
I would also like to be able to create an alert if the number of disks doesn't return to to normal after 12 hours, but thats another question..

So how do i count the number of disk in the widget on the dashboard ?
With SNMP i get the DISK IO / Physical / Instances (1 instance pr disk and partition SDA, SDA1, SDA2, SDB)

Have a nice day,
Henrik

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You cannot use a straight SNMP check for this, but you can use a SNMP via Groovy to enumerate the disks and generate the sum as a datapoint value. There are many datasources that access SNMP via Groovy you can use as examples -- a quick search of our backups shows HP_Chassis_MemoryModules among many others.  You will want to focus on this OID - http://oidref.com/1.3.6.1.2.1.25.3

Mark

Link to comment
Share on other sites

  • 0
  • Administrators

There are several ways to do this, but the best (IMO) is to create your own DataSource that pulls the list of disks and counts them. The output would be the number of mounted disks. You could then put static or dynamic thresholds on that number to generate the appropriate alerts.

The NetSNMPdiskIO pulls the list of disks via SNMP using the OID .1.3.6.1.4.1.2021.13.15.1.1.2. You could pretty easily write a script to walk that OID and count up the various disks. 

@mnagel beat me to it. Here's what it might look like:

import com.santaba.agent.groovyapi.snmp.Snmp
def hostname = hostProps.get('system.hostname')
def props = hostProps.toProperties()
def snmp_timeout = 10000

def snmp_oid = '.1.3.6.1.4.1.2021.13.15.1.1.2'

disk_count = 0

try {
  x = Snmp.walk(hostname, snmp_oid, props, snmp_timeout)
  println(x)
  println(x.split('\n').size())
  return 0
} catch (Exception e){println(e);return 1}    

 

Link to comment
Share on other sites

  • 0

Hi Stuart,

"Great minds think alike. So, if we disagree, one of us doesn't have a great mind." 🤣

Thanks for the answer, it seems to do exaclty what i  wanted to do. I will go ahead and try to create my own (first) datasource.

 

Have a nice day,
Henrik

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share