----------------------------------------------------------------- CACTI LAB EXERCISES ----------------------------------------------------------------- The purpose of this lab is to do a complete install of Cacti, and then to see how easy it is to add devices to monitor. The install is fairly complex, but involves some of the most common and important tools. This will show a typical use of: MySQL, PHP, and Apache. At the end, you should add a device to graph. Since you installed an snmpd in an earlier exercise, you can use your host as the target device. You can also add one of your neighbors to graph as well. ----------------------------------------------------------------- NOTE: The generic instructions for installing CACTI on UNIX are located at this URL. We have customized these instructions for installing on FreeBSD. http://www.cacti.net/downloads/docs/html/install_unix.html NOTE: like Linux/Apache/MySQL/PPH (LAMP), there is also the same concept for FreeBSD. Here's is a generic set of instructions about FAMP. http://sage.bt/article/freebsd-apache-mysql-php-famp.html -------------------------------------------------------- PART#1 Install MySQL, Apache, and PHP -------------------------------------------------------- We have a file "dist.tar" file in /usr/ports/distfiles. It contains most of the tars that would be downloaded over the internet. Please extract the tar. -- Extract the sources % sudo -s # cd /usr/ports/distfiles # tar xpf dist.tar -- Install Apache 22 NOTE: select mysql option if asked % cd /usr/ports/www/apache22 % sudo -s # make # make install -- Add apache to the startup # vi /etc/rc.conf apache22_enable="YES" -- Install mysqld # cd /usr/ports/databases/mysql55-server # sudo # make # make install -- Add mysqld to the startup # vi /etc/rc.conf mysql_enable="YES" -- Start mysqld # /usr/local/etc/rc.d/mysql-server start -- Install php52 NOTE: select mysql options if asked # cd /usr/ports/lang/php52 # make # make install --- Install cacti NOTE: add the php module for apache during the php settings # cd /usr/ports/net-mgmt/cacti # make # make install -------------------------------------------------------- PART#2 Configure the Database -------------------------------------------------------- -- Password for the cacti user # passwd cacti afnog -- Passwords for MySQL # mysqladmin --user=root password afnog # mysqladmin --user=root --password reload -- Create the Cacti Database # mysqladmin --user=root create cacti -- Define the Cacti Database using the Default Template NOTE: first change "TYPE=MyISAM" to "ENGINE=MyISAM" # vi /usr/local/share/cacti/cacti.sql 1,$s/TYPE=MyISAM/ENGINE=MyISAM/ # mysql cacti < /usr/local/share/cacti/cacti.sql -- Create a mysql user/password for cacti: # mysql --user=root mysql > echo "GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'afnog'; > FLUSH PRIVILEGES; ------------------------------------------------------------------ --- Part #3 Configure PHP, CACTI, and Apache --- ------------------------------------------------------------------ -- Set username and password for php: # vi /usr/local/share/cacti/include/config.php $database_username = "cacti"; $database_password = "afnog"; -- Configure Apache # vi /usr/local/etc/apache/httpd.conf AddHandler php5-script .php AddType text/html .php Alias /cacti /usr/local/share/cacti Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from 196.200.208.0/20 -- Start Apache # /usr/local/etc/rc.d/apache22 restart -- Test your PHP installation # vi /usr/local/www/data/test.php -- Now Veriy a good PHP install http://localhost/test.php NOTE: You should see formatted PHP status information -- Now Try to see if Cacti is Installed Correctly http://localhost/cacti/ NOTE: You should see a Cacti login, username/password is admin/admin -- Enable the automated updating for the graphs # crontab -u cacti -e */5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php --- HOORAY! Go to Add Devices Add a Device for your machine, localhost Create Graphs for the device Go to Add Devices Add a "ucd/snmp" type device for your neighbor's machine, pcXX Create Graphs for the device --- END