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

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

Moderators: Moderators, Developers

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

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

#1 Post by mikaelf » Wed Mar 29, 2006 7:50 am

Update: v0.9.6

Get snmpdiskio v0.9.6 from this post: http://forums.cacti.net/viewtopic.php?p=124793#124793

Thanks to Pablo & Dieter!

Get the tarball below w/ README but replace the snmpdiskio shellscript with the one from the above post.

Description:
This tarball contains instructions, templates and a small shellscript which will give you disk i/o statistics (Read/Write bytes) in Cacti!
Reason for this is the lack of disk i/o support in NET-SNMP on linux.
It works for me, let me know if it does for you!
Tested on Redhat Enterprise 3 w/ Linux 2.4.
It requires that you have disk statistics in /proc/partitions

Update: v0.9.4
  • New version which should support both 2.4 and 2.6.
    Renamed to the more appropriate name snmpdiskio
Upgrade 0.9.1 to 0.9.2:
  • Change all "hdsnmp.sh" to "snmpdiskio" in snmpd.conf
    Copy snmpdiskio to /usr/local/bin/
    No changes have been made in Cacti templates! The only thing changed since 0.9.1 is v2.4/v2.6 auto-detection in the script snmpdiskio (formerly hdsnmp.sh)
Sorry I broke 0.9.2 on 2.4 kernels, I'll get back with a fixed one soon.

Upgrade 0.9.2 to 0.9.4:
  • Copy snmpdiskio to /usr/local/bin/
    No changes have been made in Cacti templates! The only thing changed since 0.9.2 is v2.4/v2.6 auto-detection in the script snmpdiskio

Code: Select all

# $Id: README,v 1.2 2006/03/31 15:57:44 mikaelf Exp $
# snmpdiskio 0.9.4 (c) 2006 Mikael Fridh <[email protected]>
# Disk I/O statistics for Cacti created due to
# the flaky disk i/o support in net-snmp

1. ABOUT
2. INSTALLATION
2a. INSTALLATION: SNMP
2b. INSTALLATION: Cacti
3. USAGE
4. BLURB

1. ABOUT
========
This set of simple scripts and Cacti templates gives you disk I/O support.
Currently net-snmp has flaky or no support for disk I/O at all.
This version: 0.9.4, gives you only one thing: Disk I/O (bytes/sec).

snmpdiskio 0.9.4 has been tested on:
* Linux 2.4 with /proc/partitions iostats patch (included by default in Redhat, possibly other distributions as well)
* Linux 2.6 (/proc/diskstats)
* Net-snmp 5.0.9
* Cacti 0.8.6g
* Cacti 0.8.6h
Report any problems or feedback: what works/doesn't work etc in this thread.

2. INSTALLATION
===============
The installation is in two parts. One for the SNMP configuration on the
monitored host. The other is for the addition to Cacti. The addition to Cacti
need only be done once.

2a. INSTALLATION: SNMP
======================
* Put the following lines in snmpd.conf:
exec .1.3.6.1.4.1.2021.54 hdNum /usr/local/bin/snmpdiskio hdNum
exec .1.3.6.1.4.1.2021.55 hdIndex /usr/local/bin/snmpdiskio hdIndex
exec .1.3.6.1.4.1.2021.56 hdDescr /usr/local/bin/snmpdiskio hdDescr
exec .1.3.6.1.4.1.2021.57 hdInBlocks /usr/local/bin/snmpdiskio hdInBlocks
exec .1.3.6.1.4.1.2021.58 hdOutBlocks /usr/local/bin/snmpdiskio hdOutBlocks

* Install the script snmpdiskio on the machine to be monitored:
install -m 0755 -o root -g root -p -v snmpdiskio /usr/local/bin/

2b. INSTALLATION: Cacti
=======================
* Import the XML templates from `cacti_graph_template_disk_io_bytessec.xml`.
* Import the data query template from `cacti_data_query_snmp_disk_statistics.xml`.
* Copy the `partition.xml` file to cacti/resource/snmp_queries/partition.xml.

3. USAGE
========
In Cacti: Add the Data Query to your Host Templates.
For any Device already configured in Cacti you need to add the Data Query
manually.

After that you just click "New Graph", choose your Device, select the
partitions you want graphs created for and click Create.
Attachments
snmpdiskio-0.9.4.tar.gz
(6.06 KiB) Downloaded 14943 times
Last edited by mikaelf on Thu Feb 07, 2008 9:03 am, edited 18 times in total.

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#2 Post by gandalf » Wed Mar 29, 2006 1:22 pm

Thanks for your addon. Would it be possible for you to post the tar.gz as an attachment to your topic? So the contents would not rely on external links
cheers
Reinhard

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

#3 Post by mikaelf » Wed Mar 29, 2006 3:48 pm

of course! edited post, dependency workaround activated

lnxflocki
Posts: 5
Joined: Mon Mar 13, 2006 9:32 am

#4 Post by lnxflocki » Thu Mar 30, 2006 4:42 pm

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

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

#5 Post by mikaelf » Fri Mar 31, 2006 1:22 am

Did it work as expected or is there something else I should know about? :oops:

eyechart
Posts: 49
Joined: Thu Apr 25, 2002 11:48 pm

sample graphs?

#6 Post by eyechart » Fri Mar 31, 2006 1:31 am

can someone post some sample graphs? thanks.


-ec

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

#7 Post by mikaelf » Fri Mar 31, 2006 2:27 am

Sample graphs.

As you can see sdb and sdc's I/O are similar, that's because they're Physical Volumes in the same Volume Group in LVM.
Attachments
sdb.png
sdb.png (30.5 KiB) Viewed 110610 times
sdc.png
sdc.png (29.11 KiB) Viewed 110610 times

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

#8 Post by mikaelf » Fri Mar 31, 2006 2:35 am

Here's an extra one I like to have. An aggregate graph of all data sources (sdb, sdc in this case) on that host.

Is there a way to automatically create this sort of graph???
I did this one manually and with my Cacti skills if I have another host with 3 physical devices I would have to create a new graph template with 6 data sources...
Attachments
aggregated.png
aggregated.png (32.51 KiB) Viewed 110607 times

lnxflocki
Posts: 5
Joined: Mon Mar 13, 2006 9:32 am

#9 Post by lnxflocki » Fri Mar 31, 2006 2:51 am

mikaelf wrote:Did it work as expected or is there something else I should know about? :oops:
It works perfectly :lol:

Image

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#10 Post by fmangeant » Fri Mar 31, 2006 7:03 am

Many thanks for this template :D

I've tested it on :
- RedHat AS 2.1 with kernel 2.4.9-e.27smp : works
- RedHat 7.2 with kernel 2.4.20-24.7smp : works
- CentOS 4.3 with kernel 2.6.9-34.EL : doesn't work

Do you know if the "/proc/partitions iostats patch" has been ported to the 2.6 kernel ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

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

#11 Post by mikaelf » Fri Mar 31, 2006 7:33 am

fmangeant wrote: - CentOS 4.3 with kernel 2.6.9-34.EL : doesn't work

Do you know if the "/proc/partitions iostats patch" has been ported to the 2.6 kernel ?
Yeah things have changed in 2.6 as it's now using /proc/diskstats.
And in that file it has different fields for disks and partitions.

http://www.linux-m32r.org/lxr/http/sour ... ostats.txt

I was meaning to make this thing support 2.6 and create a ./configure && make install procedure which determines what version you're on but I haven't yet :)

Here's a patch for your 2.6 machines which I just created after reading your post. Thanks for the feedback!
Apply with

Code: Select all

patch /usr/local/bin/hdsnmp.sh hdsnmp-0.9.1-kernel26.patch
Attachments
hdsnmp-0.9.1-kernel26.patch
(1.08 KiB) Downloaded 1964 times

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#12 Post by fmangeant » Fri Mar 31, 2006 8:23 am

mikaelf wrote:I was meaning to make this thing support 2.6 and create a ./configure && make install procedure which determines what version you're on but I haven't yet :)
Maybe the data source could include a parameter which value would be "2.4" or "2.6" ? So this template can be used to graph 2.4 and 2.6 servers.

What do you think about it ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

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

#13 Post by mikaelf » Fri Mar 31, 2006 9:31 am

fmangeant wrote: Maybe the data source could include a parameter which value would be "2.4" or "2.6" ? So this template can be used to graph 2.4 and 2.6 servers.
There's no difference in the Cacti-side graph templates. The templates works on both 2.4 and 2.6 hosts.
All that's needed is the patch for hdsnmp 0.9.1 on 2.6 hosts to make it output the same things as it does on 2.4 hosts!

Can you get it to work?

try executing hdsnmp.sh on your 2.6 host and see if it gives you ok output...

Note that with the kernel26 patch it ONLY works on 2.6
Without the patch (0.9.1) it ONLY works on 2.4!
Maybe I'll make it portable later.. or maybe someone else beats me to it?

Code: Select all

[[email protected] hdsnmp-0.9.1]$ uname -r
2.6.8-1.528.2.10smp
[[email protected] hdsnmp-0.9.1]$ ./hdsnmp.sh hdNum
24
[[email protected] hdsnmp-0.9.1]$ ./hdsnmp.sh hdDescr
ram0
ram1
ram2
ram3
ram4
ram5
ram6
ram7
ram8
ram9
ram10
ram11
ram12
ram13
ram14
ram15
hda
sda
sda1
sda2
dm-0
dm-1
fd0
md0
[[email protected] hdsnmp-0.9.1]$ ./hdsnmp.sh hdInBlocks
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2076695548928
2084864
1898603652096
0
0
0
0
[[email protected] hdsnmp-0.9.1]$ ./hdsnmp.sh hdOutBlocks
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20789522944
3712000
2076630708224
0
0
0
0

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

#14 Post by mikaelf » Fri Mar 31, 2006 11:16 am

I made a version which should support both 2.4 and 2.6.

Renamed to the more appropriate name: snmpdiskio

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#15 Post by fmangeant » Mon Apr 03, 2006 7:48 am

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.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

Post Reply