IOG HowTo

Author:  Sean Kelly <sean@inabiaf.com>
Contributor:
  sme-iog-howto
Release supported: SME 5.x
License: GPL
Last updated: Wednesday, April 16, 2003 5:57 PM




Problem:  You want to install IOG on SME 5.x to monitor the bandwidth consumed by your SME server.
Solution:
  Follow this HowTo




STEP 1: Download IOG

Go to http://www.dynw.com/iog and download iog-1.01.tgz . Copy it up to your SME server by whatever means you are comfortable.




STEP 2: Download and install net-snmp and net-snmp-utils

SME does not come with SNMPd installed out of the box. You will need snmp-tools as well, especially if you want to get the metrics from other SME servers (and do other things, more on that later).

For SME 5.x, grab the appropriate version of ucd-snmp and ucd-snmp-utils from Sassous Efoe Boris's howto on installing Cacti on SME (http://www.speedfactor.ath.cx/howto/) and follow that portion of his howto to install them (as plagiarised below ;-)


Fetch them:

For E-SMITH/SME 5.x
shell>
wget ftp://speedfactor.ath.cx/cacti/RPMS/ucd-snmp-4.2.3-1.7.0.4.i386.rpm
shell> wget ftp://speedfactor.ath.cx/cacti/RPMS/ucd-snmp-utils-4.2.3-1.7.0.4.i386.rpm

Only For SME 5.6
shell>
wget ftp://speedfactor.ath.cx/cacti/RPMS/ucd-snmp-4.2.1-7.i386.rpm
shell> wget ftp://speedfactor.ath.cx/cacti/RPMS/ucd-snmp-utils-4.2.1-7.i386.rpm

Or if the first site is unavalaible try this:
shell> wget ftp://ftp.e-smith.org/pub/e-smith/contrib/SassouEfoeBoris/RPMS/i386/ucd-snmp-4.2.3-1.7.0.4.i386.rpm
shell> wget ftp://ftp.e-smith.org/pub/e-smith/contrib/SassouEfoeBoris/RPMS/i386/ucd-snmp-utils-4.2.3-1.7.0.4.i386.rpm



Now install them:

For E-SMITH/SME 5.X
shell>
rpm -ivh --nodeps ucd-snmp-4.2.3-1.7.0.4.i386.rpm
shell> rpm -ivh --nodeps ucd-snmp-utils-4.2.3-1.7.0.4.i386.rpm

Only for SME 5.6
shell>
rpm -ivh --nodeps --force ucd-snmp-4.2.1-7.i386.rpm
shell> rpm -ivh --nodeps --force ucd-snmp-utils-4.2.1-7.i386.rpm

Configure Ucd-snmp for e-smith

shell> mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old
shell> echo > /etc/snmp/snmpd.conf
shell> ln -s /lib/libcrypto.so.0.9.6b /lib/libcrypto.so.1
shell> service snmpd restart
shell> ln -s /etc/init.d/snmpd /etc/rc7.d/S92snmpd
shell> ln -s /etc/init.d/snmpd /etc/rc0.d/K92snmpd
shell> ln -s /etc/init.d/snmpd /etc/rc6.d/K92snmpd


WARNING:
The "mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old" command is to force net-snmp to start in such a way that it only listens to requests from 127.0.0.1, or localhost. SNMP has known security holes, so it is important that this command is run - your machine may be left vulnerable if you don't do this.


STEP 3: Untar IOG to a safe place

shell> mkdir /opt/iog
shell> cp ./iog-1.01.tgz /opt/iog
shell> cd /opt/iog
shell> tar -xvzf iog-1.01.tgz
shell> cp iog-1.01/* .




STEP 4:  Create an ibay for IOG to live in

Create an ibay (called "iog" or whatever) for the web page and the iog data to live in. No special CGI or other permissions are required for this ibay.

Copy the .gif files from your /opt/iog directory into your ibay/html directory (nominally /home/e-smith/files/ibays/iog/html).


shell> cp ./iog-1.01/*.gif /home/e-smith/files/ibays/iog/html





STEP 5: Edit iog.cfg to reflect your system

First off, let's look at the guts of iog.cfg:

# ex.:
# [switch1:192.168.0.10:public:sysUpTime.0:/www/snmp]
# sw1-port1:192.168.0.10:public:ifInOctets.1:ifOutOctets.1:/www/snmp/
# sw1-port2:192.168.0.10:public:ifInOctets.2:ifOutOctets.2:/www/snmp/
#
# [switch2:192.168.0.11:public:sysUpTime:/www/snmp]
# sw2-port20:192.168.0.11:public:ifHCInOctets.20:ifHCOutOctets.20:/www/snmp/
#


If for example we wanted to monitor the internal and external ports of our gateway we would make an entry like:

my_gateway_name:127.0.0.1:public:sysUpTime.0:/home/e-smith/files/ibays/iog/html]
Gateway-external-ethernet:127.0.0.1:public:ifInOctets.1:ifOutOctets.1:/home/e-smith/files/ibays/iog/html
Gateway-internal-ethernet:127.0.0.1:public:ifInOctets.2:ifOutOctets.2:/home/e-smith/files/ibays/iog/html


Here is where the snmp-utils comes in. The ifInOctets.1 part in the above entries is the OID (Object Identifier) in the MIB (Management Information Base) for the counter (in octets or bytes) of the first interface reported by your machine's SNMPd. The only way to be sure of what the actual interface index is is to use SNMPWALK to walk the OIDs on your machine and view the results.

For example:

shell> snmpwalk 127.0.0.1 public | grep ifDescr
interfaces.ifTable.ifEntry.ifDescr.1 = lo
interfaces.ifTable.ifEntry.ifDescr.2 = eth0
interfaces.ifTable.ifEntry.ifDescr.3 = eth1
host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunParameters.6658 = "ifDescr"


I know (or I should know;-) which interface is inside (eth0,) and which interface is outside (eth1). As the ifDescr values correspond to ifInOctets and ifOutOctets values, I would change the lines in iog.cfg to read:

[my_gateway_name:127.0.0.1:public:sysUpTime.0:/home/e-smith/files/ibays/iog/html]
Gateway-external-ethernet:127.0.0.1:public:ifInOctets.3:ifOutOctets.3:/home/e-smith/files/ibays/iog/html
Gateway-internal-ethernet:127.0.0.1:public:ifInOctets.2:ifOutOctets.2:/home/e-smith/files/ibays/iog/html


... as ifInOctets.3 corresponds to ifDescr.3, which is the interface number for eth1, which is my server's external interface.

If your entry is index:127.0.0.1:public:ifInOctets.3:ifOutOctets.3:/home/e-smith/files/ibays/iog/html then this will create index.html, replacing the default "Under Construction" page in the ibay. This is useful if you only want to monitor one interface, like your server's external ethernet.


Now, while you have the chance, you can remove snmp-utils as the snmp_session.PM file in iog looks after that stuff for you. To do this, run...


shell> rpm -e ucd-snmp-utils





 STEP 6:  Create the crontab entries to run IOG

You now need to run iog every hour. Assuming you put the iog files in /opt/iog, do this:

shell> mkdir -p /etc/e-smith/templates-custom/etc/crontab/
shell> echo "0 * * * * root /opt/iog/iog" > /etc/e-smith/templates-custom/etc/crontab/iog
shell> /sbin/e-smith/expand-template /etc/crontab



Do not run iog every five minutes (as per mrtg and cacti etc) as this will give you very weird statistics for your traffic!



STEP 7: Wait for a few hours...

You should, after a few hours, be able to go to http://mysmeserver/iog/Gateway-external-ethernet.html and http://mysmeserver/iog/Gateway-internal-ethernet.html to see the results. There should be nice graphs there, with drill-down levels as time goes on.

Each interface line you created in your iog.cfg will create an html page with the title being the part before the first colon, eg Gateway-internal-ethernet.html, Gateway-external-ethernet.html, etc. If you are monitoring a whole bunch of interfaces you may want to modify the default index.html to point to these individual files.





Other possibilities:

Given that IOG uses SNMP to gather the statistics, it should be possible to gather stats from any snmp-enabled device as long as you know what the appropriate ifDescr indices are. You could use it to track the i/o on any server in your network if you wished, or on the kid's PC in their room (if you enabled snmp on it).