Pejman Moghadam / Slackware

Slackware 12.2 - Cacti / pmacct

Public domain


/etc/snmp/snmpd.conf

rocommunity  public localhost
syslocation  Iran-Zanjan
syscontact  "Pejman Moghadam"
view systemview included .1.3.6.1.2.1
view systemview included .1.3.6.1.2.1.25.1.1

RRDTool

cd /usr/src
wget -c "http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.2.tar.gz"
tar zxf rrdtool-1.4.2.tar.gz
cd rrdtool-1.4.2
./configure --prefix=/usr/local/rrdtool

make && make install


Cacti Installation

cd /usr/src
wget -c "http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz"
tar zxf cacti-0.8.7e.tar.gz
cd cacti-0.8.7e
mkdir -p /var/www/htdocs/cacti
cp -r * /var/www/htdocs/cacti
chown -R apache.apache /var/www/htdocs/cacti/rra
chown -R apache.apache /var/www/htdocs/cacti/log

mysql -uroot -p

create database cacti;
use cacti;
source /var/www/htdocs/cacti/cacti.sql;
use mysql;
grant all on cacti.* to cacti@localhost identified by "cacti-database-password";
flush privileges;
exit;

/var/www/htdocs/cacti/include/config.php

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti-database-password";
$database_port = "3306";

crontab -e

*/5 * * * * /usr/bin/php /var/www/htdocs/cacti/poller.php > /dev/null 2>&1

Cacti - Panel

http://CactiBox/cacti/


pmacct

cd /usr/src
wget -c http://www.pmacct.net/pmacct-0.12.0rc4.tar.gz
tar zxf pmacct-0.12.0rc4.tar.gz
cd pmacct-0.12.0rc4
./configure --prefix=/usr/local/pmacct && make && make install
mkdir -p /usr/local/pmacct/etc

/usr/local/pmacct/etc/pmacctd.conf

debug: false
daemonize: true
interface: eth1
plugin_buffer_size: 2048
plugin_pipe_size: 2048000
networks_file: /usr/local/pmacct/etc/networks.def
plugins: memory[in], memory[out]
aggregate[in]: dst_host
aggregate[out]: src_host
imt_path[in]: /tmp/in.pipe
imt_path[out]: /tmp/out.pipe

/usr/local/pmacct/etc/networks.def

172.16.20.1
172.16.20.3

Launch

/usr/local/pmacct/sbin/pmacctd -f /usr/local/pmacct/etc/pmacctd.conf

check pmacct

/usr/local/pmacct/bin/pmacct -s -p /tmp/out.pipe
/usr/local/pmacct/bin/pmacct -s -p /tmp/in.pipe

Cacti Console menu

Data Input Methods, Add :
  Name: Get pmacct data
  Input Type: Script/Command
  Input String: /usr/local/pmacct/bin/pmacct -c <aggregation> -N <adata> -p <pipe> -r

  Input Fields, Add :
    Field [input]: aggregation
    Friendly Name: Aggregation string (Required)
    Create

  Input Fields, Add :
    Field [input]: adata
    Friendly Name: Actual Data (Required)
    Create

  Input Fields, Add :
    Field [input]: pipe
    Friendly Name: Pipe file (Required)
    Create

  Output Fields, Add :
    Field [output]: bytes
    Friendly Name: Bytes Transferred
    Update RRD File: yes
    Create

Data Templates, Add:
  Data Templates, Name: pmacct Data Template
  Data Source, Name: check "Use Per-Data Source Value"
  Data Input Method: Get pmacct data
  Step: 300
  Data Source Active: check
  Internal Data Source Name: bytes
  Data Source Type: ABSOLUTE
  Create
  # Output Field: bytes - Bytes Transferred

  Custom Data [data input: Get pmacct data]
  Check "Use Per-Data Source Value" for all fields
  Save

Graph Templates, Add:
  Name: pmacct Graph
  Title: check "Use Per-Graph Value"
  Image Format: PNG
  Auto Scale: check
  Rigid Boundaries Mode: check
  Vertical Label: bits/s
  Create

  Graph Template Items, Add :
    Data Source: pmacct Data Template - (bytes)
    Color: FF3932
    Graph Item Type: AREA
    Consolidation Function: AVERAGE
    CDEF Function: Turn Bytes into Bits
    Text Format: Out Traffic
    Create

  Graph Template Items, Add :
    Data Source: pmacct Data Template - (bytes)
    Color: None
    Graph Item Type: LEGEND
    CDEF Function: Turn Bytes into Bits
    Create

  Graph Template Items, Add :
    Data Source: pmacct Data Template - (bytes)
    Color: FFAB00
    Graph Item Type: STACK
    Consolidation Function: AVERAGE
    CDEF Function: Turn Bytes into Bits
    Text Format: In Traffic
    Create

  Graph Template Items, Add :
    Data Source: pmacct Data Template - (bytes)
    Color: None
    Graph Item Type: LEGEND
    CDEF Function: Turn Bytes into Bits
    Create

  Graph Item Inputs, Add:
    Name: In [bits/s]
    Field Type: Data Source
    Associated Graph Items: check Item #5, #6, #7, #8
    Create

  Graph Item Inputs, Add:
    Name: Out [bits/s]
    Field Type: Data Source
    Associated Graph Items: check Item #1, #2, #3, #4
    Create

Data Sources, Add:
  Selected Data Template: pmacct Data Template
  Host: localhost
  Create

  Name: pmacct: Destination Network
  Aggregation string (Required): dst_host
  Actual Data (Required): 172.16.20.3
  Pipe file (Required): /tmp/in.pipe
  Save

Data Sources, Add:
  Selected Data Template: pmacct Data Template
  Host: localhost
  Create

  Name: pmacct: Source Network
  Aggregation string (Required): src_host
  Actual Data (Required): 172.16.20.3
  Pipe file (Required): /tmp/out.pipe
  Save

Graph Management, Add:
  Selected Graph Template: pmacct Graph
  Host: localhost
  Create

  Title: pmacct, host: 172.16.20.3
  In [bits/s]: pmacct: Destination host
  Out [bits/s]: pmacct Source host
  Save

Bookmarks

http://cacti.net/ http://www.pmacct.net/


BY: Pejman Moghadam
TAG: cacti, pmacct, rrdtool
DATE: 2010-01-06 17:43:14


Pejman Moghadam / Slackware [ TXT ]