Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Upgraded: snmpdiskio 0.9.6 (Disk I/O statistics on Linux)
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
mikaelf



Joined: 19 Mar 2006
Posts: 14
Location: Uppsala, Sweden

PostPosted: Mon Apr 03, 2006 8:28 am    Post subject: Reply with quote

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?
Back to top
lnxflocki



Joined: 13 Mar 2006
Posts: 5

PostPosted: Mon Apr 03, 2006 12:03 pm    Post subject: Reply with quote

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?
Back to top
Suicidal



Joined: 23 Jan 2006
Posts: 6

PostPosted: Wed Apr 05, 2006 3:14 pm    Post subject: Reply with quote

lnxflocki wrote:
Let me be the first to say: I love you!

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.
Back to top
suse



Joined: 13 Nov 2005
Posts: 23

PostPosted: Thu Apr 06, 2006 8:23 am    Post subject: Reply with quote

can not work with 0,8,6h?
Back to top
mikaelf



Joined: 19 Mar 2006
Posts: 14
Location: Uppsala, Sweden

PostPosted: Thu Apr 06, 2006 8:57 am    Post subject: Reply with quote

suse wrote:
can not work with 0,8,6h?


It works on 0.8.6h too. Forgot to mention that in the README.
Back to top
tadavis



Joined: 06 Apr 2006
Posts: 16

PostPosted: Thu Apr 06, 2006 2:46 pm    Post subject: Reply with quote

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:

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
}
Back to top
mikaelf



Joined: 19 Mar 2006
Posts: 14
Location: Uppsala, Sweden

PostPosted: Fri Apr 07, 2006 5:33 am    Post subject: Reply with quote

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:

# 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?
Back to top
indee



Joined: 27 Feb 2006
Posts: 6

PostPosted: Sat Apr 08, 2006 11:18 am    Post subject: Reply with quote

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
Back to top
indee



Joined: 27 Feb 2006
Posts: 6

PostPosted: Sun Apr 09, 2006 7:51 am    Post subject: Reply with quote

Hi ,

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

Indee
Back to top
tadavis



Joined: 06 Apr 2006
Posts: 16

PostPosted: Tue Apr 11, 2006 4:03 pm    Post subject: Reply with quote

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.
Back to top
sum



Joined: 13 Apr 2006
Posts: 1

PostPosted: Thu Apr 13, 2006 3:19 am    Post subject: Reply with quote

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
Back to top
user57



Joined: 12 Oct 2005
Posts: 3
Location: SF, CA

PostPosted: Mon Apr 24, 2006 10:19 pm    Post subject: Reply with quote

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
Back to top
tirexx



Joined: 04 Apr 2006
Posts: 5

PostPosted: Fri Apr 28, 2006 3:59 am    Post subject: Reply with quote

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/Documentation/iostats.txt?v=linux-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:

*** ./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:
*** ./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 */
Back to top
leonardo_gyn
Cacti User


Joined: 22 Jan 2005
Posts: 65

PostPosted: Sat Jun 03, 2006 3:42 pm    Post subject: Reply with quote

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 ....



graph_image-02.png
 Description:
sample graphic of snmpdiskio templates
 Filesize:  34.77 KB
 Viewed:  8927 Time(s)

graph_image-02.png



graph_image-01.png
 Description:
sample graphic of snmpdiskio templates
 Filesize:  24.67 KB
 Viewed:  8927 Time(s)

graph_image-01.png


Back to top
bilsch



Joined: 22 Jun 2006
Posts: 1

PostPosted: Thu Jun 22, 2006 11:02 am    Post subject: getting error from cacti when trying to add snmpdiskio Reply with quote

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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 



Powered by phpBB © 2001, 2005 phpBB Group