Sunday, April 26, 2015

Installing the Cacti Flowview plugin for Debian 7 Wheezy

Preparing for plugin installation

 # According to the file, /usr/share/cacti/site/plugins/README.Plugins , the directory structure shall be moved into a new location

sudo mkdir /usr/local/share/cacti/plugins
sudo mv /usr/share/cacti/site/plugins/* /usr/local/share/cacti/plugins/

# Remove the empty /usr/share/cacti/site/plugins directory

sudo rmdir /usr/share/cacti/site/plugins


# Create the following symlinks:

sudo ln -s /usr/local/share/cacti/plugins /usr/share/cacti/site/plugins
sudo ln -s /usr/share/cacti/site/include /usr/local/share/cacti/include
sudo ln -s /usr/share/cacti/site/lib /usr/local/share/cacti/lib


Installing the Flowview plugin

# The current plugin version is fetched from this URL:
http://docs.cacti.net/plugin:flowview

cd /usr/local/share/cacti/plugins/
sudo wget http://docs.cacti.net/_media/plugin:flowview-v1.1-1.tgz
sudo mv plugin\:flowview-v1.1-1.tgz flowview-v1.1-1.tgz
sudo tar xvf flowview-v1.1-1.tgz

# Now proceed to  'Plugin Management' in the Cacti web.
Flowview should be listed among the available plugins.
Install and then enable the plugin by clicking in 'Actions' column.
A 'Flows' tab should now be available at the top of the page

Configure PHP timezone

# Set your local  timezone
 sudo nano /etc/php5/apache2/php.ini 
     date.timezone =Europe/Stockholm

sudo service apache2 restart

Install and configure flow-tools


sudo apt-get install flow-tools

# Prepare a storage directory for your different netflows. Here I will configure my WAN router.
sudo mkdir -p /var/flow/wanrouter

# In Cacti->Console->Settings->Tab:Misc
# Set 'Flows Directory' to /var/flow
# Add your local DNS caching server or Googles 8.8.8.8

# Replace the native flow-capture init script with the Flowview specific replacement
sudo service flow-capture stop
sudo cp /etc/init.d/flow-capture /etc/init.d/flow-capture.org
sudo cp /usr/local/share/cacti/plugins/flowview/flow-capture /etc/init.d/flow-capture

Add a flow-capture listener

# Edit flow-capture configuration. Comment out the existing examples
# flow-capture is not configured by this file. It is configured in the Cacti Listener Tab.

sudo nano /etc/flow-tools/flow-capture.conf
 

# In Cacti add the a listener for the wanrouter
Tab:Flows ->Tab: Listeners -> Add

# Restart flow-view service when a new listener has been added
sudo service flow-capture start

# NOTE, deleteing listeners does not work in flowview 1.1-1
# For a solution apply the patch here:
# http://bugs.cacti.net/view.php?id=2463



Configure your device to send netflow information

# My router is an Ubiquity Edgerouter POE with the WAN interface connected to eth0

configure
set system flow-accounting interface eth0

# Needs version 9 or 10;  set system flow-accounting netflow enable-egress

set system flow-accounting netflow server 192.168.1.56 port 2055
set system flow-accounting netflow version 5
commit

# The commit messages says that egress accounting is registered, even though I did not configure the enable-egress command above. Maybe some kind of misunderstanding from by side.


Verify netflow sent from the router

Verfify that netflow is sent from your device by sending the file contents to the flow-print command
flow-print < /var/flow/wanrouter/<Date>/<filename>

Additional Netflow software

Here is an extensive list of open source and closed source software



Saturday, April 25, 2015

Installing Cacti on Debian

# Here are some notes taken during installation of Cacti on Debian 7, on a Cubieboard 2.

#  Install PHP, apache2 and mysql-server first and then install Cacti.

sudo apt-get update
sudo apt-get install apache2
sudo apt-get install mysql-server

# Configure mysql server with root password. For the rest of the questions answer Yes.
sudo mysql_secure_installation

# PHP installation (Before Debian 7 Wheezy add php5-suhosin )
 sudo apt-get install php5 php-pear php5-mysql

# Configure PHP installation info from the server by adding the following lines into info.php:

sudo nano /var/www/info.php

<?php
phpinfo();
?>

# Restart Apache to apply the new configuration

sudo service apache2 restart

# Verify that Apache and PHP was installed successfully by entering the following URL
# http://<Ip address of your server>/info.php
# Information regarding the PHP installation is shown in the browser.

# Now it is  time  to install Cacti

sudo apt-get install cacti


# Remove comment ('//') before $url_path and $cacti_session_name last in debian.php file

sudo vi /etc/cacti/debian.php

# Link Cacti Web server configuration to the apache2 config directory. My Apache version is 2.2

sudo ln -s /etc/cacti/apache.conf /etc/apache2/conf.d/cacti.conf

# Restart Apache to apply the new configuration

sudo service apache2 restart

# Enter the following URL in your browser  http://<Ip address of your server>/cacti
# Follow the instructions. The user /password is admin/admin
# After having logged in, the web console is ready for configuration of devices and graphs for your devices.