Cacti: traffic analysis and monitoring network: Difference between revisions

From Alpine Linux
m (minor layout changes, Cmd doesn't work in all cases, Needs fix)
No edit summary
Line 12: Line 12:
{{Cmd|mysql_secure_installation}}
{{Cmd|mysql_secure_installation}}
Create the cacti database and populate it
Create the cacti database and populate it
{{Cmd|echo "create database cacti;" | mysql --user=root -p}}
{{Cmd| mysql -u root -p}}
{{Cmd| mysql> create database cacti;}}
Grant Cacti MySQL user access (give it a more secure password):
Grant Cacti MySQL user access (give it a more secure password):
{{Cmd|echo "grant all on cacti.* to 'cactiuser'@'localhost' identified by 'MostSecurePassword'; flush privileges;" | mysql --user=root -p}}
{{Cmd| mysql> grant all on cacti.* to 'cactiuser'@'localhost' identified by 'MostSecurePassword'; flush privileges;}}
Edit /var/www/localhost/htdocs/cacti/include/config.php and put in the password you used in the above step for the mysql user.
Quit from Mysql command prompt:
Import the initial Cacti MySQL config:
{{Cmd| mysql> \q }}
mysql --user=cacti -p cacti < /usr/share/webapps/cacti/cacti.sql
Edit /var/www/localhost/htdocs/cacti/include/config.php and put in the password you used in the above step for the mysql user. Import the initial Cacti MySQL config:
{{Cmd| 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:
{{Cmd| mv /usr/share/webapps/cacti/cacti.sql cacti.tmp && sed s/TYPE=/ENGINE=/g cacti.tmp > cacti.sql }}
Set lighttpd to autostart and start the daemon.
Set lighttpd to autostart and start the daemon.
{{Cmd|rc-update add lighttpd && rc-service lighttpd start}}
{{Cmd|rc-update add lighttpd && rc-service lighttpd start}}

Revision as of 19:08, 16 June 2011

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 /var/www/localhost/htdocs/cacti/include/config.php and put in the password you used in the above step for the mysql user. Import the initial Cacti MySQL config:

{{{1}}}

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

{{{1}}}

Set lighttpd to autostart and start the daemon.

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

Browse to http://localhost/cacti/

-> Next
-> New install, Next
-> Finish

Login using admin:admin, change password.
Add to crontab:

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

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