Cacti: traffic analysis and monitoring network

From Alpine Linux
Revision as of 17:18, 17 June 2011 by Epi (talk | contribs) (some command layout)

Install needed packages:

apk add lighttpd php cacti net-snmp-tools fcgi

Add php support to lighttpd (uncomment this line in /etc/lighttpd/lighttpd.conf):

include "mod_fastcgi.conf"

Save and exit editor. Create a softlink for the cacti web files:

ln -s /usr/share/webapps/cacti /var/www/localhost/htdocs/cacti

If it hasn't already been done, setup MySQL:

apk add mysql-client

mysql_install_db --user=mysql

/etc/init.d/mysql start

mysql_secure_installation

Create the cacti database and populate it

mysql -u root -p

mysql> create database cacti;

Grant Cacti MySQL user access (give it a more secure password):

mysql> grant all on cacti.* to 'cactiuser'@'localhost' identified by 'MostSecurePassword'; flush privileges;

Quit from Mysql command prompt:

mysql> \q

Edit and put in the password you used in the above step for the mysql user.

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

Import the initial Cacti MySQL config:

mysql --user=cacti -p cacti < /usr/share/webapps/cacti/cacti.sql

If you are using most recent Mysql version from Alpine 2.2.2, have to fix cacti.sql syntax then import:

cd /usr/share/webapps/cacti/
mv cacti.sql cacti.tmp && sed s/TYPE=/ENGINE=/g cacti.tmp > cacti.sql
mysql --user=cacti -p cacti < /usr/share/webapps/cacti/cacti.sql

Set lighttpd to autostart and start the daemon.

rc-update add lighttpd && rc-service lighttpd start

Browse to http://localhost/cacti/
In the web page clic:

-> Next

Then select new install in case is not selected:

-> New install, Next

Then finish

-> Finish

Login using:

Password= admin user= admin

Next wil be prompted to change password:

change password.

Add to crontab:

cd /etc/crontabs
vi root

copy to the end of the file:

*/5 * * * * php /var/www/localhost/cacti/poller.php > /dev/null 2>&1

Add your devices and you're ready to start monitoring!