Install Cacti on Mac OS X Latest
Cacti is an open-source graphing solution based on rrdtool. It’s lightweight and has endless graphing capabilities on nearly every file system available today. It is extremely useful for intelligently graphing Apache Stats – such as website hits, website health, memory, bytes in/out, and much more. This guide will cover how to install Cacti on the latest version of Mac X.
Our base system will be using Mac 10.11 El Captain. The pre-requisites are below for this new Cacti installation:
*Cacti 0.8.8f is the latest version as of 2015 cacti-0.8.8f.tar
*Download and install MySQL for Mac. Latest DMG version is Mac OS X 10.10 (x86, 64-bit), DMG Archive mysql-5.7.10-osx10.10-x86_64.dmg
*Download a GUI to interface with your MySQL databases. I like SequelPro. For this guide, we will use MySQL Workbench latest version for Mac X. mysql-workbench-community-6.3.6-osx-x86_64.dmg
*Get HomeBrew needed to install RRDTool.
*Mac X 10.11 El Captain and earlier Mac releases lost GUI management for Web Sharing. Download VirtualHostX to make the Cacti configuration much simpler. It is paid, but you can use the Free Trial for this guide.
*Download and install XQuartz XQuartz-2.7.8.dmg
Installations
Install MySQL / WorkBench
Launch the DMG image file for MySQL. Click through the the prompts until the installation completes. Remember – post installation a random temporary password is generated for your “root” sql account. It is important to copy this somewhere – don’t lose it.
Ensure MySQL is started and running as a service on your host machine. To check this, go to System Preferences -> MySQL -> Start MySQL Server. Also, be sure to check automatically start MySQL Server on startup
Next, we’ll want to change the default password that was generated for the MySQL Server “root” account. This is easy to do with Workbench. Install SQL Workbench. Once installed, you may need to create a new Local Instance of MySQL. Do this:
Next to MySQL Connections at the top, click the + button
Configure like the screenshot with:
Connection Name: MAIN
Hostname: 127.0.0.1
Username: root
Password: (leave blank for now)
Port: 3306
Click Ok.
Now, double click the instance you see at your main screen “MAIN”.
You should get prompted to enter your temporary password for “root” account and to change it.
After setting the new password you should be at your main connection page with a tab at top. Now, we are going to create a new database needed for Cacti. At the top ribbon tab, click create a new schema in the connected server.
Call your new schema CACTI. Click Apply twice.
Now you should see CACTI appear under Schemas in your management column on the left!
For the purpose of this guide, we are going to allow the “root” account to access and manipulate the CACTI database. So, we won’t be creating another MySQL account. Typically, you don’t want your “root” account floating around to manipulate your production databases, but we are doing this manipulation locally – so OK for now.
Install XQuartz
Straightforward install, click the package in the DMG file and install.
Install RRDTool / Homebrew
Open Terminal and type:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
Then:
brew install rrdtool
The installation will take a few minutes but will complete with a successful message afterword’s.
Install Cacti to Folder
Download Cacti and unzip it. Drag all contents into a new folder called cacti inside a new folder called CACTI-HOME pictured below. Let’s leave the CACTI-HOME folder on your desktop.
To be clear, your structure will look like this CACTI-HOME/cacti and inside cacti will be your cacti install files.
For some reason Cacti is weird and needs this kind of folder structure in order for it to work in browsers. I can’t figure out why but if you can tell us.
Install Virtual Host X
Download and open Virtual Host X.
Create a new host. For this guide, we will create cacti123.com (cactic123.com will ONLY resolve locally within in your network. You can actually make this name whatever you want and if you will be accessing Cacti outside your network, which most do, then this should be a domain name you own and setup accordingly. That setup is outside of this guide)
Select “.www” tickbox.
IP Address: 127.0.0.1
Port: 80
Enable This Virtual Host
Local Path: /Users/YOURHOMENAME/Desktop/CACTI-HOME
Select Custom Directives and ensure you have the following:
Allow From All
AllowOverride All
Options +Indexes
Require all granted
Click “apply changes” at the top to write the new virtual host you created to your hosts file.
Next, we need to setup the Cacti config.php file with some info so it can connect to your Cacti database we created earlier. Open the config.php file with TextEdit in /CACTI-HOME/include/config.php
Set the following lines in config.php with the information below:
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "CACTI";
$database_hostname = "127.0.0.1";
$database_username = "root";
$database_password = "PASSWORD YOU MADE";
$database_port = "3306";
$database_ssl = false;
**Sometimes, for unknown reasons, TextEdit changes the formatting of lines inside files. ENSURE you are using " and NOT “ to close all your values above. Double and triple check this before saving. If you fail to do this, you will get stuck. **
At this point, Cacti is ready to be configured.
Installing Cacti
Follow the steps for the initial install per below:
Open a browser and render to: cacti123.com/cacti-home/cacti you should see the initial login page to Cacti.
Open a browser and render to: cacti123.com/cacti-home/cacti you should see the initial login page to Cacti. The default accounts are:
Username: Admin
Password: Admin
You should get prompted to change that password. Now, you’re in!
Do a few things now:
Set cacti log file to actually filename path.
Go to Settings -> Paths and put this in for Cacti Log File Path /Users/YOURHOMEPATH/Desktop/CACTI/cacti/cacti.log. This log file will be critical for your new install and understanding any early issues.
Ensure all Cacti Settings Path’s are green. Go to Settings -> Paths
Set your poller to collect data every 5 minutes in Settings -> Poller
Finally, check System Utilities -> Technical Support for any odd errors. A common error might by RRDTool Version not correctly set. Go through the list of choices offered until it’s correctly set (it will say OK)
QuickStart to Graphing:
We used Cacti to primarily graph our webserver stats including hits, bytes in/out, bandwidth and more. You will need to download ApacheStats and follow that guide in the link. You also need to make sure you have enabled mod_status on your Apache server.
There is also a Apache Host Webserver template you can download from the Cacti forums to get you started.
Common Issues:
No Graphs Showing Up
First, check to make sure you’re not getting any PHP errors for Cacti. Mac’s PHP error log is located at (USERNAME)/private/var/log/apache2. Skim through it and ensure it’s clean of any errors regarding Cacti. Remember to set your timezone in php.ini configuration as well.
Ensure Permissions are set correctly – everywhere!
Make sure all of Cacti’s files have correct permissions. A common error is saving the configuration file and it looses its permissions. You can set the correct permissions in this manner:
In Terminal, type the following lines
/Users/YOURHOMEPATH/Desktop/CACTI/cacti/
sudo chown -R _www:_www rra/ log/
sudo chmod -R 777 log rra
Also See: Unix (Mac) quickstart Cacti guide
* Please use the comment form below. Comments are moderated.*
Comments 4
Mine is not working. I can't choose Select “.www” tickbox on my VirtualHostX as I don't have that option. My installed version is 7.2.0. I'm using El Capitan.
That's ok. You don't need to use "www" to render. Just access it by cacti123/ or cacti123.com this way.
This is not working for me. My browser says that the host unexpectedly dropped the connection. I am using El Capitan.
Hi, are you using VirtualHost for Cacti? If so ensure you defined 127.0.0.1 as a local host address in the field. Also ensure Apache is started..