Adding Cacti to Groundwork.
Cacti is a handy trend & performance history graphing app. Here are some instructions on how to integrate it with the groundwork system. For simplicity sake, I've opted not to use the single sign on (SSO) option on my system, as it's not really worth the effort. I did play around with it and include instructions on using SSO, it seems to work, but I'm not 100% sure it works right. (At least on my test VM, doesn't seem to destory the session upon logout of groundwork). Just skip the SSO stuff if you don't want to use it, the rest of the process doesn't change.
1) Download Cacti
Code:
cd /tmp
wget http://www.cacti.net/downloads/cacti-0.8.6j.tar.gz
tar -xzvf cacti-0.8.6j.tar.gz
mv cacti-0.8.6j cacti
mv cacti /usr/local/groundwork/apache2/htdocs/
###
2) Create the MySQL database:
Code:
mysqladmin --user=root create cacti
# Import the default cacti database:
Code:
mysql cacti < cacti.sql
# Optional: Create a MySQL username and password for Cacti. If you've added a mysql passwd, you'll need to login with that.
Code:
mysql --user=root mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
flush privileges;
###
3) Edit Cacti Config in /usr/local/groundwork/apache2/htdocs/cacti/include/config.php and specify the MySQL user, password and database for your Cacti configuration.
Code:
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
###
4) Add the cacti poller to your /etc/crontab file (I run the poller as root, due to some of the scripts I use in cacti):
Code:
*/5 * * * * root /usr/local/groundwork/bin/php /usr/local/groundwork/apache2/htdocs/cacti/poller.php > /dev/null 2>&1
###
5) Add cacti directory to the /usr/local/groundwork/apache2/conf/httpd.conf file for SSO
Code:
<Directory "/usr/local/groundwork/apache2/htdocs/cacti">
AuthType Basic
require valid-user
TKTAuthLoginURL http://<server>/monitor/index.php
TKTAuthCookieName cacti_auth_tkt
TKTAuthTimeout 0
</Directory>
# Restart Apache
Code:
/usr/local/groundwork/apache2/bin/apachectl graceful
###
6) Go to cacti admin site:
Code:
http://<server>/cacti/install
Select New Install
# Modify Paths:
Code:
/usr/local/groundwork/bin/snmpwalk
/usr/local/groundwork/bin/snmpget
/usr/local/groundwork/bin/snmpbulkwalk
/usr/local/groundwork/bin/snmpgetnext
/usr/local/groundwork/bin/rrdtool
/usr/local/groundwork/bin/php
FINISH
# Edit Cacti Config (part 2)
#Settings -> General Tab:
Code:
Select RRDTool Version: 1.2
#Settings -> Paths:
Code:
Verify paths are correct for your binaries
#Add fonts path:
Code:
/usr/local/groundwork/share/rrdtool/fonts
#Settings -> Visual (you can play with the fonts & sizes, these are what I use, just because it's the included font in rrdtool)
Code:
Title Font: 8
/usr/local/groundwork/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
Legend Font: 8
/usr/local/groundwork/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
Axis Font: 7
/usr/local/groundwork/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
Unit Font: 7
/usr/local/groundwork/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
#Settings -> Authentication (since we are using SSO. If you don't want SSO, leave this checked.)
Code:
Uncheck 'Use Cacti's Builtin Auth'
###
7) Wrappit
#General Tab:
Code:
Name: Cacti
Desc: Cacti
Base URL: /cacti
Welcome:
#Menu: (no sub menu's needed)
Code:
N/A
#SSO
Code:
Enable SSO
#Export
Code:
Install Package
###
8) Add view to admin
# Administration -> Roles -> Administrators
Code:
Add cacti view
Logout & Login
# Cacti should be one of the options in the drop-down menu now.
END.
Notes: The PHP that's included in groundwork does not have the '--enable-sockets' option compiled in. This might mean that a few of the scripts available in cacti don't work quite right. I didn't seem to notice any problems when I used it initially for a few weeks, however I've recompiled PHP to add that support on my system now. I'll try to add instructions on that down the road. It's also possible to display RRD's that are generated by Nagios in Cacti (to avoid duplicating the same type checks that Nagios already performs, such as CPU load, disk space etc). I'll document that later also.