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, 8  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
Era_Russland



Joined: 02 Aug 2006
Posts: 10

PostPosted: Wed Aug 15, 2007 3:54 am    Post subject: ett Reply with quote

tet
Back to top
Era_Russland



Joined: 02 Aug 2006
Posts: 10

PostPosted: Wed Aug 15, 2007 3:56 am    Post subject: linux IO statistic help Reply with quote

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



Joined: 03 Sep 2007
Posts: 5

PostPosted: Mon Sep 03, 2007 8:41 am    Post subject: Reply with quote

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:
<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).
Back to top
Rael
Cacti User


Joined: 05 Apr 2007
Posts: 129

PostPosted: Fri Oct 19, 2007 12:36 pm    Post subject: Reply with quote

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



Joined: 29 Oct 2007
Posts: 1

PostPosted: Mon Oct 29, 2007 4:56 pm    Post subject: Reply with quote

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"
Back to top
adameros



Joined: 06 Nov 2007
Posts: 7
Location: Bellevue, WA, USA

PostPosted: Tue Nov 06, 2007 1:23 pm    Post subject: Works great, but I have a request... Reply with quote

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


Thanks!
Back to top
mhoogenbosch



Joined: 17 Jan 2008
Posts: 4

PostPosted: Thu Jan 17, 2008 10:18 am    Post subject: Reply with quote

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



Joined: 01 Feb 2008
Posts: 1

PostPosted: Fri Feb 01, 2008 9:14 am    Post subject: Reply with quote

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

#!/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
Back to top
mikaelf



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

PostPosted: Thu Feb 07, 2008 8:39 am    Post subject: Reply with quote

I'm very glad to see this baby's still alive . Nice job guys!
Back to top
infestdead



Joined: 19 Nov 2007
Posts: 7

PostPosted: Tue Feb 12, 2008 8:48 am    Post subject: Reply with quote

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:

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:

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



Joined: 28 Mar 2007
Posts: 22

PostPosted: Tue Feb 19, 2008 6:08 pm    Post subject: Reply with quote

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



Joined: 21 Feb 2008
Posts: 1

PostPosted: Thu Feb 21, 2008 9:53 am    Post subject: Reply with quote

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



Joined: 27 Dec 2007
Posts: 31

PostPosted: Tue Mar 18, 2008 1:15 am    Post subject: Reply with quote

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



Joined: 27 Dec 2007
Posts: 31

PostPosted: Tue Mar 18, 2008 5:28 am    Post subject: Reply with quote

problem has been solved?
thank everybody here???
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 33
Location: St. Pete, FL

PostPosted: Tue Mar 18, 2008 8:43 am    Post subject: Reply with quote

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:

pandora:/usr/local/bin # ./snmpdiskio
bash: ./snmpdiskio: /bin/bash^M: bad interpreter: No such file or directory
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, 8  Next
Page 5 of 8

 



Powered by phpBB © 2001, 2005 phpBB Group