Cacti on Freebsd

cacti is a very useful tool for monitoring your devices on network.

While there are many tutorials on installation and use of cacti this tutorial aims on providing just enough information to make installation work and graphing possible.

Cacti requires that the following software is installed on your system.

* RRDTool 1.0.49 or 1.2.x or greater
* MySQL 3.23 or greater, 4.1.x or 5.x or greater
* PHP 4.3.6 or greater, 5.x greater highly recommended for
advanced features
* A Web Server e.g. Apache

On you freebsd box
# cd /usr/ports/net/cacti
# make config
enable plugins
# make && make install

This will take care of all the packages it requires like

* apache
* rrdtool
* net-snmp
* php5-extensions
* php5 (With MySQL and SNMP Support)
* mysql server

To start snmp, apache and mysql in every reboot type
# echo 'snmpd_enable="YES"' >>/etc/rc.conf

# echo '/usr/local/libexec/mysqld --user=mysql &' >> /etc/rc.conf
# echo '/usr/local/sbin/apachectl start' >>/etc/rc.conf


To configure your snmp run the following command
# snmpconf

If you are installing mysql for the first time then
# chown -R mysql:mysql /var/db/mysql

For Apache 2.x
You should make sure that the following line is present in your httpd.conf file.

LoadModule php5_module libexec/apache/libphp5.so


In httpd.conf itself

<IfModule mod_dir.c>
<IfModule mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.php3 index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.php3 index.html
</IfModule>
</IfModule>
<IfModule !mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.html index.htm
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.html
</IfModule>
</IfModule>
</IfModule>


Or you can simply have

DirectoryIndex index.php index.html index.htm


Finally add these two lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


Add an alias for your cacti.

For eg: if you have your cacti setup on /usr/local/share/cacti then add an alias with

Alias /cacti /usr/local/share/cacti

Alternatively you can configure symbolic link too.

Now configure Mysql
First set root password
# mysqladmin --user=root password newpassword
# mysqladmin --user=root --password reload

Create a database for cacti
# mysqladmin --user=root --password create cacti

Import the default cacti database
# mysql cacti
Create a mysql username and password for cacti
# mysql --user=root --password mysql
mysql> Grant all on cacti.* to 'cactiuser'@'localhost' identified by 'password';

Edit the file include/config.php to reflect the current database changes.

Edit your crontab
# crontab -e
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&
1

Open your browser and access http://thewebser/cacti

This completes the instllation.

Creating graph, graph template, host template and other useful stuffs will be covered in next part of the tutorial.
I have data template and graph template for
Proxim wireless device like Tsunami showing SNR, signal and noise.
Deliberant wirelss device showing RSSI and channel.

Comments

Popular posts from this blog

Perm Root HTC Desire Gingerbread 2.3.3

Adobe Stand Alone Flash Player for Linux

Increase Free Space On HTC Desire Android Phones