Upgraded: snmpdiskio 0.9.6 (Disk I/O statistics on Linux)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
mikaelf
Posts: 25
Joined: Sun Mar 19, 2006 10:39 am
Location: Uppsala, Sweden

Post by mikaelf »

fmangeant wrote:Hi

thanks for this 2.4 / 2.6 compatible version.

Do I need to re-import the templates, or copying the script is enough ?

Thanks in advance.
The only changes made are in the script.
You could just copy snmpdiskio to /usr/local/bin/hdsnmp.sh if you want.
That way you don't need to modify snmpd.conf.

I'm gonna extend this thing with # of reads/writes later if that's interesting to anyone?
lnxflocki
Posts: 5
Joined: Mon Mar 13, 2006 9:32 am

Post by lnxflocki »

mikaelf wrote:I'm gonna extend this thing with # of reads/writes later if that's interesting to anyone?
That'd be very useful!

How did you aggregate those 2 graphs by the way?
Suicidal
Posts: 6
Joined: Mon Jan 23, 2006 3:21 am
Contact:

Post by Suicidal »

lnxflocki wrote:Let me be the first to say: I love you! :D
I'll second that works great on my gentoo servers, although I modified it to go into /usr/bin as I dont put anything in /usr/local.
[color=green][size=84]Cacti-0.8.6i|Gentoo-2006.1|kernel-x86_64-2.6.17-hardened-r1|mysql-5.0.26|rrdtool-1.2.6|glibc-2.3.6-r4|gcc-3.4.6|net-snmp-5.2.1.2|php-5.1.6|apache-2.0.58[/size][/color]
suse
Posts: 23
Joined: Sun Nov 13, 2005 1:05 am

Post by suse »

can not work with 0,8,6h?
mikaelf
Posts: 25
Joined: Sun Mar 19, 2006 10:39 am
Location: Uppsala, Sweden

Post by mikaelf »

suse wrote:can not work with 0,8,6h?
It works on 0.8.6h too. Forgot to mention that in the README.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

Note - on a 2.6 machine, /proc/diskstats holds both partition performance data, and drive partition data.

This script works fine on partition data, but gives the wrong results on full disk data.

partition data is like sda1, sda2; full disk data is sda.

They are formatted differently.. I use:

Code: Select all

function hdOutBlocks()
{
        awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 ~ /[0-9]+/ { printf "%.0f\n", $10 * 512 }
              $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 !~ /[0-9]+/ { printf "%.0f\n", $5 * 512 } ' $PROCFILE
}

function hdInBlocks()
{
        awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $6 * 512 }
              $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
}
mikaelf
Posts: 25
Joined: Sun Mar 19, 2006 10:39 am
Location: Uppsala, Sweden

Post by mikaelf »

tadavis wrote:Note - on a 2.6 machine, /proc/diskstats holds both partition performance data, and drive partition data.

This script works fine on partition data, but gives the wrong results on full disk data.

partition data is like sda1, sda2; full disk data is sda.

They are formatted differently..
Yep I know, obviously I took a bit too many shortcuts to support all 3 formats (2.4, 2.6 disks, 2.6 partitions).

I need an opinion on this:

In my scripts:
hdInBlocks: writes to disk
hdOutBlocks: reads from disk

But in for example vmstat output:
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).

So before I "release" this FINAL TESTED version should I revert the in/out logic?

The way it is now confuses me. Mainly because I'm so used to the kernel point of view that vmstat has.

If there are other common interfaces and metrics using the Disks point of view please advise me.

Disk pov:
IN: writes to disk
OUT: reads from disk

Kernel pov:
IN: from disk IN to kernel
OUT: from kernel OUT to disk

I think the kernels pov should be used which means I should revert the hdInBlocks / hdOutBlocks..

I understand the ones who already installed it has to reimport the templates but isn't it better to have something you know is correct? :)

Final reverted version with 2.4, 2.6 disk, 2.6 partition support would look something like this:

Code: Select all

# disk reads (input: # of sectors read, output: bytes read)
# assume sectorsize 512
function hdInBlocks()
{
        if [ "$MODE" = "linux26" ]; then
            # on 2.6 disk stats have 14 fields
            # partition stats have 7 fields
            # if field 8 exists we assume it's disk stats
            # # of read sectors are in field #6 (disks) and #5 (partitions)
            awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $6 * 512 }
                  $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $5 * 512 } ' $PROCFILE
        else
            # on 2.4 both disk and partition stats have 15 fields
            # # of read sectors are always in field #7
            awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
        fi
}

# disk writes (input: # of sectors written, output: bytes written)
# assume sectorsize 512
function hdOutBlocks()
{       # # of written sectors are either in field #10 (disks) or #7 (partitions)
        if [ "$MODE" = "linux26" ]; then
            awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $10 * 512 }
                  $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
        else
            # on 2.4: # of written sectors are always in field #11
            awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $11 * 512 } ' $PROCFILE
        fi
}
Would someone agree or disagree? :)
indee
Posts: 6
Joined: Mon Feb 27, 2006 9:19 am

Post by indee »

hi,

I download and installed as per the read me but I am not able to create graphs at all

here are my configuration
system where cacti is installed
cacti version 0.86h (downloaded from cactiusers.org with plugin archi)
Linux XXXX 2.6.15-1.1831_FC4 #1 Tue Feb 7 13:37:42 EST 2006 i686 i686 i386 GNU/Linux
NET-SNMP version: 5.2.1.2

Monitored Server
NET-SNMP version: 5.1.2
Linux XXXX 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 x86_64 x86_64 x86_64 GNU/Linux

the snmpwalk command sends back the output but I am not able to see the graphs

this command is run from the cacti is installed

snmpwalk -v 1 hostname:2161 -c public .1.3.6.1.4.1.2021.55

UCD-SNMP-MIB::ucdavis.55.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1 = STRING: "hdIndex"
UCD-SNMP-MIB::ucdavis.55.3.1 = STRING: "/usr/local/bin/snmpdiskio hdIndex"
UCD-SNMP-MIB::ucdavis.55.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.55.101.1 = STRING: "1"
UCD-SNMP-MIB::ucdavis.55.101.2 = STRING: "2"
UCD-SNMP-MIB::ucdavis.55.101.3 = STRING: "3"
UCD-SNMP-MIB::ucdavis.55.101.4 = STRING: "4"
UCD-SNMP-MIB::ucdavis.55.101.5 = STRING: "5"
UCD-SNMP-MIB::ucdavis.55.101.6 = STRING: "6"
UCD-SNMP-MIB::ucdavis.55.101.7 = STRING: "7"
UCD-SNMP-MIB::ucdavis.55.101.8 = STRING: "8"
UCD-SNMP-MIB::ucdavis.55.101.9 = STRING: "9"
UCD-SNMP-MIB::ucdavis.55.101.10 = STRING: "10"
UCD-SNMP-MIB::ucdavis.55.101.11 = STRING: "11"
UCD-SNMP-MIB::ucdavis.55.101.12 = STRING: "12"
UCD-SNMP-MIB::ucdavis.55.101.13 = STRING: "13"
UCD-SNMP-MIB::ucdavis.55.101.14 = STRING: "14"
UCD-SNMP-MIB::ucdavis.55.101.15 = STRING: "15"
UCD-SNMP-MIB::ucdavis.55.101.16 = STRING: "16"
UCD-SNMP-MIB::ucdavis.55.101.17 = STRING: "17"
UCD-SNMP-MIB::ucdavis.55.101.18 = STRING: "18"
UCD-SNMP-MIB::ucdavis.55.101.19 = STRING: "19"
UCD-SNMP-MIB::ucdavis.55.101.20 = STRING: "20"
UCD-SNMP-MIB::ucdavis.55.101.21 = STRING: "21"
UCD-SNMP-MIB::ucdavis.55.101.22 = STRING: "22"
UCD-SNMP-MIB::ucdavis.55.101.23 = STRING: "23"
UCD-SNMP-MIB::ucdavis.55.101.24 = STRING: "24"
UCD-SNMP-MIB::ucdavis.55.101.25 = STRING: "25"
UCD-SNMP-MIB::ucdavis.55.101.26 = STRING: "26"
UCD-SNMP-MIB::ucdavis.55.101.27 = STRING: "27"
UCD-SNMP-MIB::ucdavis.55.101.28 = STRING: "28"
UCD-SNMP-MIB::ucdavis.55.101.29 = STRING: "29"
UCD-SNMP-MIB::ucdavis.55.101.30 = STRING: "30"
UCD-SNMP-MIB::ucdavis.55.101.31 = STRING: "31"
UCD-SNMP-MIB::ucdavis.55.101.32 = STRING: "32"
UCD-SNMP-MIB::ucdavis.55.101.33 = STRING: "33"
UCD-SNMP-MIB::ucdavis.55.101.34 = STRING: "34"
UCD-SNMP-MIB::ucdavis.55.101.35 = STRING: "35"
UCD-SNMP-MIB::ucdavis.55.101.36 = STRING: "36"
UCD-SNMP-MIB::ucdavis.55.101.37 = STRING: "37"
UCD-SNMP-MIB::ucdavis.55.101.38 = STRING: "38"
UCD-SNMP-MIB::ucdavis.55.101.39 = STRING: "39"
UCD-SNMP-MIB::ucdavis.55.101.40 = STRING: "40"
UCD-SNMP-MIB::ucdavis.55.101.41 = STRING: "41"
UCD-SNMP-MIB::ucdavis.55.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.55.103.1 = ""


Any help will be great

Indee
indee
Posts: 6
Joined: Mon Feb 27, 2006 9:19 am

Post by indee »

Hi ,

please ignore the above post I managed to solve the problem.

Indee
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

mikaelf wrote: I think the kernels pov should be used which means I should revert the hdInBlocks / hdOutBlocks..

I understand the ones who already installed it has to reimport the templates but isn't it better to have something you know is correct? :)

Would someone agree or disagree? :)
I prefer the kernel's point of view.

That way, you also match what a working net-snmp point's of view also.
sum
Posts: 1
Joined: Thu Apr 13, 2006 3:10 am

Post by sum »

indee

I have same problem, my system cannot create rrd for DISK I/O. I don't know the reason and i follow the README instruction to setup it.

My cacti server is running 0.8.6h version,
Linux 2.4.21-27.0.1.ELsmp CentOS release 3.6 (Final)

The client machine is running
Linux 2.6.16-1.2069_FC4smp Fedora Core release 4 (Stentz)

Anyone can help me ? thanks a lot !

Sum
user57
Posts: 3
Joined: Wed Oct 12, 2005 3:56 pm
Location: SF, CA

Post by user57 »

I was having trouble getting any data collected... after following the instructions step by step.

Eventually I discovered that no poller_item's were getting created, and then noticed that the SNMP - Disk Statistics data query did not have checks next to the associated data templates/data sources, and the drop downs were left as defaults :-(

After fixing this it appears to work... i think, will know after a few polls if its actually going to graph some data.

Why would the template .xmls be corrupt like this?

--jason
User avatar
tirexx
Posts: 5
Joined: Tue Apr 04, 2006 5:38 am

Post by tirexx »

found this patch for net-snmp-5.3.0.1 ucd-snmp-disk-io very useful to discover
"weighted # of milliseconds spent doing I/Os" (http://fxr.watson.org/fxr/source/Docume ... x-2.6.11.8) - disk queue

as result:
# snmpwalk ... .1.3.6.1.4.1.2021.13.15.1.1.14
UCD-DISKIO-MIB::diskIOEntry.14.14 = Counter32: 363226343

and
http://pics.livejournal.com/tirexx/pic/00001fay/

Code: Select all

*** ./net-snmp-5.3.0.1/agent/mibgroup/ucd-snmp/diskio.c.orig	Thu Apr 27 18:02:02 2006
--- ./net-snmp-5.3.0.1/agent/mibgroup/ucd-snmp/diskio.c	Thu Apr 27 18:05:00 2006
***************
*** 150,161 ****
--- 150,162 ----
          {DISKIO_WRITES, ASN_COUNTER, RONLY, var_diskio, 1, {6}},
          {DISKIO_LA1, ASN_INTEGER, RONLY, var_diskio, 1, {9}},
          {DISKIO_LA5, ASN_INTEGER, RONLY, var_diskio, 1, {10}},
          {DISKIO_LA15, ASN_INTEGER, RONLY, var_diskio, 1, {11}},
          {DISKIO_NREADX, ASN_COUNTER64, RONLY, var_diskio, 1, {12}},
          {DISKIO_NWRITTENX, ASN_COUNTER64, RONLY, var_diskio, 1, {13}},
+         {DISKIO_AQS, ASN_COUNTER, RONLY, var_diskio, 1, {14}},
      };
  
      /*
       * Define the OID pointer to the top of the mib tree that we're
       * registering underneath. 
       */
***************
*** 719,731 ****
  	    if (head.length == head.alloc) {
  		head.alloc += DISK_INCR;
  		head.indices = (linux_diskio *)realloc(head.indices, head.alloc*sizeof(linux_diskio));
  	    }
  	    pTemp = &head.indices[head.length];
  	    sscanf (buffer, "%d %d", &pTemp->major, &pTemp->minor);
! 	    if (pTemp->minor == 0)
  		sscanf (buffer, "%d %d %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
  		    &pTemp->major, &pTemp->minor, pTemp->name,
  		    &pTemp->rio, &pTemp->rmerge, &pTemp->rsect, &pTemp->ruse,
  		    &pTemp->wio, &pTemp->wmerge, &pTemp->wsect, &pTemp->wuse,
  		    &pTemp->running, &pTemp->use, &pTemp->aveq);
  	    else
--- 720,732 ----
  	    if (head.length == head.alloc) {
  		head.alloc += DISK_INCR;
  		head.indices = (linux_diskio *)realloc(head.indices, head.alloc*sizeof(linux_diskio));
  	    }
  	    pTemp = &head.indices[head.length];
  	    sscanf (buffer, "%d %d", &pTemp->major, &pTemp->minor);
! 	    if ((pTemp->minor & 0x3f) == 0)
  		sscanf (buffer, "%d %d %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
  		    &pTemp->major, &pTemp->minor, pTemp->name,
  		    &pTemp->rio, &pTemp->rmerge, &pTemp->rsect, &pTemp->ruse,
  		    &pTemp->wio, &pTemp->wmerge, &pTemp->wsect, &pTemp->wuse,
  		    &pTemp->running, &pTemp->use, &pTemp->aveq);
  	    else
***************
*** 815,826 ****
--- 816,830 ----
      case DISKIO_READS:
        long_ret = head.indices[indx].rio;
        return (u_char *) & long_ret;
      case DISKIO_WRITES:
        long_ret = head.indices[indx].wio;
        return (u_char *) & long_ret;
+     case DISKIO_AQS:
+       long_ret = head.indices[indx].aveq;
+       return (u_char *) & long_ret;
  
      default:
  	snmp_log(LOG_ERR, "diskio.c: don't know how to handle %d request\n", vp->magic);
    }
    return NULL;
  }
***************
*** 1142,1153 ****
--- 1146,1160 ----
          return (u_char *) & c64_ret;
      case DISKIO_NWRITTENX:
          *var_len = 8;
          c64_ret.low = (ps_disk[indx].wblks * ps_disk[indx].bsize) & 0xffffffff;;
          c64_ret.high = (ps_disk[indx].wblks * ps_disk[indx].bsize) >> 32;
          return (u_char *) & c64_ret;
+     case DISKIO_AQS:
+         long_ret = (signed long) ps_disk[indx].qdepth;
+         return (u_char *) & long_ret;
  
      default:
          ERROR_MSG("diskio.c: don't know how to handle this request.");
      }
  
      /* return NULL in case of error */

Code: Select all

*** ./net-snmp-5.3.0.1/agent/mibgroup/ucd-snmp/diskio.h.orig	Thu Apr 27 18:01:56 2006
--- ./net-snmp-5.3.0.1/agent/mibgroup/ucd-snmp/diskio.h	Thu Apr 27 18:03:10 2006
***************
*** 31,38 ****
--- 31,39 ----
  #define DISKIO_WRITES		6
  #define DISKIO_LA1		9
  #define DISKIO_LA5              10
  #define DISKIO_LA15             11
  #define DISKIO_NREADX           12
  #define DISKIO_NWRITTENX        13
+ #define DISKIO_AQS	        14
  
  #endif                          /* _MIBGROUP_DISKIO_H */
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Post by leonardo_gyn »

mikaelf wrote:
I need an opinion on this:

In my scripts:
hdInBlocks: writes to disk
hdOutBlocks: reads from disk

But in for example vmstat output:
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).

So before I "release" this FINAL TESTED version should I revert the in/out logic?

The way it is now confuses me. Mainly because I'm so used to the kernel point of view that vmstat has.

........

Would someone agree or disagree? :)

I would personally prefer the 'direct' way, not vmstat 'inverted' one. As you're graphing disk performance, data should be referent to the disks. Writes should mean disk writes, reads should mean disk reads. I think graphs should be direct, they should need the less interpretation as possible.

And man .... i love you too :) I have been looking for something like this template for a long time.

I have it running on kernel 2.6 with both SATA and SCSI disks ... dont know if it does matter ....
Attachments
sample graphic of snmpdiskio templates
sample graphic of snmpdiskio templates
graph_image-01.png (24.67 KiB) Viewed 20687 times
sample graphic of snmpdiskio templates
sample graphic of snmpdiskio templates
graph_image-02.png (34.77 KiB) Viewed 20687 times
bilsch
Posts: 1
Joined: Thu Jun 22, 2006 10:59 am

getting error from cacti when trying to add snmpdiskio

Post by bilsch »

I'm sure this is something I'm doing wrong with cacti, but I just can't seem to get cacti to poll the hosts.

I am getting the following error from cacti:

Data Query Debug Information
+ Running data query [12].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/cacti/resource/cacti_data_query_snmp_disk_statistics.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ ''
+ Found data query XML file at '/var/www/cacti/resource/cacti_data_query_snmp_disk_statistics.xml'
+ Found data query XML file at '/var/www/cacti/resource/cacti_data_query_snmp_disk_statistics.xml'
+ Found data query XML file at '/var/www/cacti/resource/cacti_data_query_snmp_disk_statistics.xml'

Any thoughts on what I could be doing wrong?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests