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
Era_Russland
Posts: 10
Joined: Wed Aug 02, 2006 4:41 am
Contact:

ett

Post by Era_Russland »

tet
Era_Russland
Posts: 10
Joined: Wed Aug 02, 2006 4:41 am
Contact:

linux IO statistic help

Post by Era_Russland »

Hello,
I want to setup I/O statistic for our corporate linux servers.
I have already traffic/cpu load statistic from this servers but i/o stat is very important for me also.
I found some templates for this kind of stats but don't have luck to use it.
I step though install manual but still don't have graphs.

I tried Upgraded: snmpdiskio 0.9.4 (Disk I/O statistics on Linux) template.
Is this template up2date?

ERROR: opening '/var/www/html/cacti/rra/server_15min_loadavg_122.rrd': No such file or directory

Could someone help me to setup cacti with I/O stats.

Thanks a lot
elgoretto
Posts: 5
Joined: Mon Sep 03, 2007 8:34 am

Post by elgoretto »

I don't know if this is really useful, but I made a version of the partition.xml file which is "net-snmp diskio enabled" compliant. I just corrected the OIDs.
It seems to work with my Cacti 0.8.6j on Gentoo.

Code: Select all

<interface>
        <name>Get SNMP Partitions</name>
        <description>Queries a host for a list of monitorable partitions</description>
        <oid_index>.1.3.6.1.4.1.2021.13.15</oid_index>
        <index_order>hdDescr:hdName:hdIndex</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <hdIndex>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2021.13.15.1.1.1</oid>
                </hdIndex>
                <hdDescr>
                        <name>Description</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2021.13.15.1.1.2</oid>
                </hdDescr>
                <hdInBlocks>
                        <name>Bytes Written</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2021.13.15.1.1.3</oid>
                </hdInBlocks>
                <hdOutBlocks>
                        <name>Bytes Read</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2021.13.15.1.1.4</oid>
                </hdOutBlocks>
        </fields>
</interface>
I tried to keep a pure net-snmp setup, because at first I didn't manage to get the snmpdiskio shellscript working (maybe some wrong execute rights after all).
Rael
Cacti User
Posts: 129
Joined: Thu Apr 05, 2007 9:28 am

Post by Rael »

Seeing this error on Suse 9

eccws531:/usr/local/bin # bash -x snmpdiskio hdNum
+ $'\r'
: command not found
+ PROCFILE=/proc/partitions
+ MODE=linux24
+ $'\r'
: command not found
'nmpdiskio: line 16: syntax error near unexpected token `
'nmpdiskio: line 16: `function hdNum()



Any clues?
raid900
Posts: 1
Joined: Mon Oct 29, 2007 4:48 pm

Post by raid900 »

Can someone point me in the right direction. /usr/local/bin/snmpdiskio exist and has permissions.


Results below with snmpwalk
host bin # snmpwalk -v 2c fwdr-vmhost2 -c MRTG .1.3.6.1.4.1.2021.55
UCD-SNMP-MIB::ucdavis.55.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.2.7.104.100.73.110.100.101.120 = STRING: "/usr/local/bin/snmpdiskio"
UCD-SNMP-MIB::ucdavis.55.2.1.3.7.104.100.73.110.100.101.120 = STRING: "hdIndex"
UCD-SNMP-MIB::ucdavis.55.2.1.4.7.104.100.73.110.100.101.120 = ""
UCD-SNMP-MIB::ucdavis.55.2.1.5.7.104.100.73.110.100.101.120 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.55.2.1.6.7.104.100.73.110.100.101.120 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.7.7.104.100.73.110.100.101.120 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.20.7.104.100.73.110.100.101.120 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.55.2.1.21.7.104.100.73.110.100.101.120 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.3.1.1.7.104.100.73.110.100.101.120 = STRING: "/usr/local/bin/snmpdiskio: No such file or directory"
UCD-SNMP-MIB::ucdavis.55.3.1.2.7.104.100.73.110.100.101.120 = STRING: "/usr/local/bin/snmpdiskio: No such file or directory"
UCD-SNMP-MIB::ucdavis.55.3.1.3.7.104.100.73.110.100.101.120 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.3.1.4.7.104.100.73.110.100.101.120 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.4.1.2.7.104.100.73.110.100.101.120.1 = STRING: "/usr/local/bin/snmpdiskio: No such file or directory"
adameros
Posts: 7
Joined: Tue Nov 06, 2007 1:19 pm
Location: Bellevue, WA, USA

Works great, but I have a request...

Post by adameros »

How hard would it be to get extended diskio stats, like avgqu-sz, await, or %util?


Thanks!
:D
mhoogenbosch
Posts: 4
Joined: Thu Jan 17, 2008 8:21 am

Post by mhoogenbosch »

i am getting nothing.. i've did everything wich is in the README file, but when i'm snmpwalking there is no output, it just stays blank... in cacti i'm getting the following:

+ Running data query [19].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/localhost/htdocs/cacti/resource/snmp_queries/partition.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.55.101'
+ No SNMP data returned
+ Found data query XML file at '/var/www/localhost/htdocs/cacti/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/var/www/localhost/htdocs/cacti/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/var/www/localhost/htdocs/cacti/resource/snmp_queries/partition.xml'

wich makes sense while i'm getting no output from snmp
dverlaeckt
Posts: 1
Joined: Fri Feb 01, 2008 8:56 am

Post by dverlaeckt »

pdestefanis wrote:Sorry for all these consecutive postings... I took a look at /proc/diskstats in 2.6 and /proc/partitions in 2.4 and came with a modified version of the script. I've tested it in both kernels and it's working fine.

I've commented the code a bit, at the beginning, to specify fields, etc. If someone can take a look and provide some feedback, that will be great.

Enjoy!

Pablo

Code: Select all

see original post for code
Thanks for your script Pablo, it was working fine except for md devices (software raid) and device mapper devices (LVM). These devices on my systems contain digits (/dev/md0, /dev/dm-0, ..) and your script assumes that anything containing digits in it's name is a partition. So I have changed your script so that the selection between disks and partitions is now based on the number of fields a line has, so this should be correct in all cases.

I have tested it on 10+ Debian based machines with 2.4 and 2.6 kernels and it is working fine.

Code: Select all

#!/bin/bash
# $Id: snmpdiskio,v 1.5 2008/01/31 21:19:50 dverlaeckt Exp $
# snmpdiskio v0.9.6 (c) 2008 Dieter Verlaeckt <dieter.verlaeckt@gmail.com>
# snmpdiskio v0.9.5 (c) 2007 Pablo Destefanis <pdestefanis@gmail.com>
# snmpdiskio v0.9.4 (c) 2006 Mikael Fridh <mikael@meanstreak.se>

# Fields in /proc/partitions (kernel 2.4)
# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

# Fields in /proc/diskstats (kernel 2.6) for disks (i.e. hda)
# major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

# Fields in /proc/diskstats (kernel 2.6) for partitions (i.e. hda1)
# major minor name rio rsect wio wsect

# InBlocks = sectors written to disk
# OutBlocks = sectors read from disk

# Set default procfile for kernel 2.4
PROCFILE="/proc/partitions"
MODE="linux24"

# Probably kernel 2.6:
if [ -f /proc/diskstats ]; then
    PROCFILE=/proc/diskstats
    MODE="linux26"
fi


function hdNum()
{
        awk ' BEGIN { num=0 } $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ { num++ } END { print num } ' $PROCFILE
}

function hdIndex()
{
        awk ' BEGIN { num=0 } $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ { num++; print num } ' $PROCFILE
}

function hdDescr()
{
        if [ "$MODE" = "linux26" ]; then
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ { printf "%s\n", $3 }' $PROCFILE
        else
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ { printf "%s\n", $4 }' $PROCFILE
        fi
}

function hdInBlocks()
{
        if [ "$MODE" = "linux26" ]; then
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $7 * 512 }
                      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $10 * 512 } ' $PROCFILE
        else
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $11 * 512 } ' $PROCFILE
        fi
}

function hdOutBlocks()
{
        if [ "$MODE" = "linux26" ]; then
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $5 * 512 }
                      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $6 * 512 } ' $PROCFILE
        else
                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $7 * 512 } ' $PROCFILE
        fi
}

function usage()
{
        cat <<-EOUSAGE
Usage: $0 <hdNum|hdIndex|hdDescr|hdInBlocks|hdOutBlocks>
EOUSAGE
}

if [ 1 -ne $# ]; then
        usage
        exit 1
fi

case $1 in
        hdNum|hdIndex|hdDescr|hdInBlocks|hdOutBlocks)
                $1
        ;;
        'hdNum')
                hdNum
        ;;
        'hdIndex')
                hdIndex
        ;;
        'hdDescr')
                hdDescr
        ;;
        'hdInBlocks')
                hdInBlocks
        ;;
        'hdOutBlocks')
                hdOutBlocks
        ;;
        *)
                usage
                exit 1
        ;;
esac

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

Post by mikaelf »

I'm very glad to see this baby's still alive :D. Nice job guys!
infestdead
Posts: 8
Joined: Mon Nov 19, 2007 3:19 am

Post by infestdead »

I have this weird problem. I'm managing around 20 servers. Today I started adding to them Disk IO stats, using the above template (just the net-snmp stats without the script). Everything was fine for the first 10, when suddenly, after adding a data query for the host ( SNMP - Disk Statistics ), getting Success [24 Items, 12 Rows], and clicking at the Create Graphs For This Host I get:

Code: Select all

Data Query [SNMP - Disk Statistics]  	 Reload Associated Query
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
Clicking the verbose query I get:

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/localhost/htdocs/cacti_new/resource/snmp_queries/partition.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.13.15'
+ Located input field 'hdIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.13.15.1.1.1'
+ Found item [hdIndex='1'] index: 1 [from value]
+ Found item [hdIndex='2'] index: 2 [from value]
+ Found item [hdIndex='3'] index: 3 [from value]
+ Found item [hdIndex='4'] index: 4 [from value]
+ Found item [hdIndex='5'] index: 5 [from value]
+ Found item [hdIndex='6'] index: 6 [from value]
+ Found item [hdIndex='7'] index: 7 [from value]
+ Found item [hdIndex='8'] index: 8 [from value]
+ Found item [hdIndex='9'] index: 9 [from value]
+ Found item [hdIndex='10'] index: 10 [from value]
+ Found item [hdIndex='11'] index: 11 [from value]
+ Found item [hdIndex='12'] index: 12 [from value]
+ Located input field 'hdDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.13.15.1.1.2'
+ Found item [hdDescr='loop0'] index: 1 [from value]
+ Found item [hdDescr='loop1'] index: 2 [from value]
+ Found item [hdDescr='loop2'] index: 3 [from value]
+ Found item [hdDescr='loop3'] index: 4 [from value]
+ Found item [hdDescr='loop4'] index: 5 [from value]
+ Found item [hdDescr='loop5'] index: 6 [from value]
+ Found item [hdDescr='loop6'] index: 7 [from value]
+ Found item [hdDescr='loop7'] index: 8 [from value]
+ Found item [hdDescr='sda'] index: 9 [from value]
+ Found item [hdDescr='sda1'] index: 10 [from value]
+ Found item [hdDescr='sda2'] index: 11 [from value]
+ Found item [hdDescr='sda3'] index: 12 [from value]
+ Found data query XML file at '/var/www/localhost/htdocs/cacti_new/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/var/www/localhost/htdocs/cacti_new/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/var/www/localhost/htdocs/cacti_new/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/var/www/localhost/htdocs/cacti_new/resource/snmp_queries/partition.xml'

So what's going on!? The already added servers keep on graphing. If I try to edit the graphs for a working host, I get the same error, and clicking the verbose debuge I get the same info.

So in general - getting the info is working, the debug says everything is ok, but I'm not able to add a graph..
gpetme
Posts: 22
Joined: Wed Mar 28, 2007 5:48 pm

Post by gpetme »

I'd like to port this to use under FreeBSD. They don't use /proc so the stats aren't readily available there. But, I'm wondering if anyone has some ideas where I could get the same statistics from (besides iostat)? If so, I should be able to figure out how to make it fit into this framework.
ukstin
Posts: 1
Joined: Thu Feb 21, 2008 9:49 am

Post by ukstin »

Hi guys,

I'm trying to put some servers on this graph, but when I insert this one the form ask me to put these informations:

Output Type ID
Index Value
Index Type

what are the values that I should insert?

Regards
Eduardo Ukstin
tracky2007
Posts: 34
Joined: Thu Dec 27, 2007 3:07 am

Post by tracky2007 »

i got these error,can somebody help me ?

+ Running data query [18].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/usr/local/apache/htdocs/cacti/resource/snmp_queries/partition.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.55.4'
+ Located input field 'hdIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.55.4'
+ Found item [hdIndex='/usr/local/bin/snmpdiskio: line 107: syntax error: unexpected end of file'] index: 1 [from value]
+ Located input field 'hdDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2021.56.4'
+ Found item [hdDescr='/usr/local/bin/snmpdiskio: line 107: syntax error: unexpected end of file'] index: 1 [from value]
+ Found data query XML file at '/usr/local/apache/htdocs/cacti/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/usr/local/apache/htdocs/cacti/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/usr/local/apache/htdocs/cacti/resource/snmp_queries/partition.xml'
+ Found data query XML file at '/usr/local/apache/htdocs/cacti/resource/snmp_queries/partition.xml'

use suse9 2.6.5-7.244-default cacti0.86j snmp5.4.1
tracky2007
Posts: 34
Joined: Thu Dec 27, 2007 3:07 am

Post by tracky2007 »

problem has been solved!
thank everybody here~~~
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

Getting an error on this as installed by the current directions in the first post.
Everything works without error except for the snmpdiskio script:

Code: Select all

pandora:/usr/local/bin # ./snmpdiskio
bash: ./snmpdiskio: /bin/bash^M: bad interpreter: No such file or directory
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest