Install cacti on debian with custom script to chart proc/net/dev

-----------------------------
20050609 jstile: 
1.  install cacti on debian 3.1.
2.  setup/configure monitor network traffic

   aptitude install cacti cacti-cactid   

     The following NEW packages will be automatically installed:
       libct1 libdbd-mysql-perl libdbi-perl libltdl3 libmysqlclient12
       libmysqlclient14 libmysqlclient14-dev libnet-daemon-perl libphp-adodb
       libplrpc-perl libpq3 librrd0 libsensors3 libsnmp-base libsnmp5
       mysql-client mysql-common mysql-server odbcinst1 php4 php4-cli php4-mysql
       php4-odbc php4-pgsql php4-snmp php4-sybase rrdtool snmp unixodbc
       zlib1g-dev
     The following NEW packages will be installed:
       cacti cacti-cactid libct1 libdbd-mysql-perl libdbi-perl libltdl3
       libmysqlclient12 libmysqlclient14 libmysqlclient14-dev libnet-daemon-perl
       libphp-adodb libplrpc-perl libpq3 librrd0 libsensors3 libsnmp-base
       libsnmp5 mysql-client mysql-common mysql-server odbcinst1 php4 php4-cli
       php4-mysql php4-odbc php4-pgsql php4-snmp php4-sybase rrdtool snmp
       unixodbc zlib1g-dev
     0 packages upgraded, 32 newly installed, 0 to remove and 0 not upgraded.
     Need to get 20.9MB of archives. After unpacking 51.4MB will be used.

  Do you want to register FreeTDS as an odbc driver?  Yes
  Include path for php now: /usr/share/adodb. update php.ini.
  A new mysql user "debian-sys-maint" will be created.
  MySQL server host name : localhost
  Database for cacti:	   cacti
  Cacti database user:     cacti
  Password for user:       cacti
  Which type of web server should beused by cacti? Apache2
  Cacti must be configured to use cactid! 
    to use the cactid poller, cacti must be configured via its web based interface.
    read /usr/share/doc/cacti-cactid/README.Debian.

  Creating config file /etc/cacti/cactid.conf 



mysqladmin create cacti  -u root -p
echo "GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti'; flush privileges;"| mysql -uroot -p 
cd /usr/share/cacti/site#
dpkg-reconfigure cacti
	mysql server: localhost
	database name: cacti
	user name: cacti
	pass word: cacti
	server type: apache2

cd /usr/share/doc/cacti
tar -xzvpf cacti.sql.gz        
gunzip -d cacti.sql.gz

mysql -u cacti -p cacti < cacti.sql
Enter password: cacti

http://192.168.60.26/cacti/install/
click next
New install
click next
RRDTool Binary Path: 		/usr/bin/rrdtool
 PHP Binary Path: 		/usr/bin/php
 snmpwalk Binary Path:		/usr/bin/snmpwalk
 snmpget Binary Path: 		/usr/bin/snmpget
 Cacti Log File Path: 		/usr/share/cacti/site/log/cacti.log
 SNMP Utility Version: 		NET-SNMP 5.x
 RRDTool Utility Version:   	1.0.x
click next
 Login: admin/admin
 Change password forced
 Login: admin/not24get

Create a script that can measrue rx/tx on eth0 or eth1
Script to chart /proc/net/dev
  pushd /usr/local/share/cacti/
  wget http://stilen.com/scripts/perl/stilen_network_traffic.pl
  popd
Followd steps on Simplest Method of Going from Script to Graph (Walkthrough)
Creating a Data Input Method
	select the Data Input Methods option under the Management heading.
	select Add
		Name: 		iptables_CHAIN
		Input Type:	Script/Command
		Input String:   /usr/local/share/cacti/scripts/iptables.pl 
	

	select Add
		Name: 		nic
		Input Type:	Script/Command
		Input String:   /usr/local/share/cacti/scripts/stilen_network_traffic.pl  
		Click Save
		Click Add input 
			Input Fields
				Field:		NIC
				Friently Name	netwrok interface card
				click Create
		Click Add input 
			Input Fields
				Field [Input]	DIRECTION
				Friendly Name	in-or-out
				Click create
		Ckick Add output
			Output Fields
				Field [Output] net_bytes
				Friendly Name  Bytes of network traffic
				Update RRD File     checkecd
				Click create
				
Create a Data Source
	select Data Soucre under Management
		Click Add
		 Selected Data Template: None
		 Host:   		 Localhost
		 Click create
		 Data Source:
	 		Name:			|host_description| - eth0_in
			Data Source Path:	/localhost_eth0_in.rrd
			Data Input Method	nic
			Assocated RRA's		Dayly (5 Minute Average)
						Monthly (2 hour average)
						Weekley (20 min ave)
						Yearly (1 day average)
			Step			300
			Data Source Active	check data source active
		Data Source Item:
			Internal Data Source Name	eth0_in
			Minimum Value			0
			Maximum Value			0
			Data Source Type		Counter
			Heartbeat			600
		Click Save
		Custom Data
			in-or-out			in
			network interface card		eth0
	Duplicate this for eth0_in, eth0_out, eth1_in, eth1_out.

Create a Graph	
	select Graph Management under Management
		Click Add
			Graph Template: None
			Host: Localhost
			Click Create
			Graph Config:
				Title:		eth0_in
				Image Format	PNG
				Height		120
				Width		500
				Auto Scale:	checked
				Auto Scale Options	 Use --alt-autoscale-max 
				Logarithmic Auto Scaling: unchecked
				Rigid Boundaries: unchecked
				Auto Padding: checked
				Allow Graph Export: checked
				Upper Limit: 100
				Lower Limit: 0
				Base Value: 1000
				Unit Value: blank
				Unit Exponent Value: 0
				Vertical Label: eth0 out ( bytes )
			Click Save
			Trun on debug
				Error: cant make graph without contents
			Graph Items
				Click Add
				Graph Items	
					Data Source: Localhost - eth0_in
				Color:			None
				Graph Item Type:	GPRINT
				Consolidation Function:	LAST
				CDEF Function:		None
				Value:			blank
				GPRINT Type:		Normal
				Text Format:		eth0_in ( bytes )
				Insert Hard Return:	unchecked
			Click Create
			Click Save at bottom of the page
			
		Add graph to view
		

		View the graph
-----------------------------
  |host_description| - eth0_in