There seems to be a lot for Cacti on linux forums but none or very few on FreeBSD, so here you go,Comments are welcome.
About Cacti
Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
Assuming that freebsd has been installed on a machine,Installation instructions can be found at the FreeBSD Website: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html.If you have not updated the ports tree, do this now by :
#portsnap fetch update
#portaudit -F
#portmaster -a
- Now you have the latest snapshot of the ports tree
Install Apache + PHP
Since Cacti needs a web server to serve its php based pages, we need to install Apache + PHP5
#cd /usr/ports/www/apache22
# make config
- make sure Mysql Support is enbaled as Cacti will use this its backend db.
# make install clean
Now install PHP 5
#cd /usr/ports/lang/php5
#make config
- make sure apache module is selected here or else PHP will not work
#make install clean
Now lets configure apache to work with PHP:
There will need to be some lines to /usr/local/etc/apache22/httpd.conf so that the php modules will work, and load php pages. At the end of the LoadModules section of httpd.conf:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Append this to the line for DirectoryIndex:
index.php
Add this to /etc/rc.conf to autostart Apache at boot:
apache22_enable="YES"
Now test if apache is working by starting it using :
# /usr/local/etc/rc.d/apache22 start
System Graphing, powered by MySQL & Cacti
Compile MySQL 5.0 Server
# cd /usr/ports/databases/mysql50-server; make install clean
- Configure MySQL server to load at boot, add this to /etc/rc.conf:
mysql_enable="YES"
and then start MySQL server by :
# /usr/local/etc/rc.d/mysql-server start
Install net-snmp
# cd /usr/ports/net-mgmt/net-snmp; make install clean
Cacti is a powerful network graphing utility that front ends Rrdtool. This process will compile Rrdtool and all of its dependencies for you.
# cd /usr/ports/net-mgmt/cacti; make install clean
By Now we have are almost there,check that we have installed all the dependencies and requirements:
- Apache
- PHP
- Cacti (this included its dependencies, rrd's etc)
- MySql
- Net-snmp
In order to access the Cacti web directory, we have to add a directory listing to our apache httpd-local.conf file . Edit the file /usr/local/etc/apache22/Includes/httpd-local.conf, and add these lines:
<Directory /usr/local/share/cacti>
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
Alias /graphs /usr/local/share/cacti/
The following needs to be added to your /etc/crontab, to poll your system information every 5 minutes.
*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
Setup The Database
#mysqladmin --user=root create cacti
Set the passwd for the cacti user.
# passwd cacti
Changing local password for cacti
New Password: [cactipasswd]
Retype New Password: [cactipasswd]
note that you may need to add a user with nologin
Edit the /usr/local/share/cacti/include/db-settings.php file for the proper database permissions:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipasswd";
$database_port = "3306";
Set the Cacti database's permissions.
#echo "GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipasswd'; FLUSH PRIVILEGES;" | mysql
Import the default tables.
#mysql cacti < /usr/local/share/cacti/cacti.sql
Finally, restart apache and mysql
, then log into the page, using the /graphs alias that was set up earlier. The default login and password is admin:admin, and you will be prompted to change it on your first successful login.
http://yourserver.yourdomain.com/graphs
About Cacti
Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
Assuming that freebsd has been installed on a machine,Installation instructions can be found at the FreeBSD Website: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html.If you have not updated the ports tree, do this now by :
#portsnap fetch update
#portaudit -F
#portmaster -a
- Now you have the latest snapshot of the ports tree
Install Apache + PHP
Since Cacti needs a web server to serve its php based pages, we need to install Apache + PHP5
#cd /usr/ports/www/apache22
# make config
- make sure Mysql Support is enbaled as Cacti will use this its backend db.
# make install clean
Now install PHP 5
#cd /usr/ports/lang/php5
#make config
- make sure apache module is selected here or else PHP will not work
#make install clean
Now lets configure apache to work with PHP:
There will need to be some lines to /usr/local/etc/apache22/httpd.conf so that the php modules will work, and load php pages. At the end of the LoadModules section of httpd.conf:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Append this to the line for DirectoryIndex:
index.php
Add this to /etc/rc.conf to autostart Apache at boot:
apache22_enable="YES"
Now test if apache is working by starting it using :
# /usr/local/etc/rc.d/apache22 start
System Graphing, powered by MySQL & Cacti
Compile MySQL 5.0 Server
# cd /usr/ports/databases/mysql50-server; make install clean
- Configure MySQL server to load at boot, add this to /etc/rc.conf:
mysql_enable="YES"
and then start MySQL server by :
# /usr/local/etc/rc.d/mysql-server start
Install net-snmp
# cd /usr/ports/net-mgmt/net-snmp; make install clean
Cacti is a powerful network graphing utility that front ends Rrdtool. This process will compile Rrdtool and all of its dependencies for you.
# cd /usr/ports/net-mgmt/cacti; make install clean
By Now we have are almost there,check that we have installed all the dependencies and requirements:
- Apache
- PHP
- Cacti (this included its dependencies, rrd's etc)
- MySql
- Net-snmp
In order to access the Cacti web directory, we have to add a directory listing to our apache httpd-local.conf file . Edit the file /usr/local/etc/apache22/Includes/httpd-local.conf, and add these lines:
<Directory /usr/local/share/cacti>
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
Alias /graphs /usr/local/share/cacti/
The following needs to be added to your /etc/crontab, to poll your system information every 5 minutes.
*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
Setup The Database
#mysqladmin --user=root create cacti
Set the passwd for the cacti user.
# passwd cacti
Changing local password for cacti
New Password: [cactipasswd]
Retype New Password: [cactipasswd]
note that you may need to add a user with nologin
Edit the /usr/local/share/cacti/include/db-settings.php file for the proper database permissions:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipasswd";
$database_port = "3306";
Set the Cacti database's permissions.
#echo "GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipasswd'; FLUSH PRIVILEGES;" | mysql
Import the default tables.
#mysql cacti < /usr/local/share/cacti/cacti.sql
Finally, restart apache and mysql

http://yourserver.yourdomain.com/graphs