This tutorial will show you how to install and configure Cacti network monitoring tool from source to ensure that you get the latest version on Debian 9, codename Stretch.
![]() On this page
Cacti is a web-based network monitoring tool, completely open source, designed to display network and system graphics via RRDtool. It uses the SNMP (Simple Network Management Protocol) protocol to gather and monitor network traffic from network devices, such as switches, routers, Linux, Unix and Windows servers or other types of network-based devices that support SNMP.
Requirements
Installing CACTI on Windows 7 Step 1: Installing XAMPP. The best way to install 1.3 is to use the XAMPP 1.7.7 package. Step 2: Installing CACTI. You can obtain a copy of the CACTI from: Step 3: Useful Utilities. Step 4: Starting CACTI. Now you are ready to start CACTI. This guide will show you how you can easily Dual Boot CentOS 7 with Windows 10. This should also work for dual booting CentOS 7 with Windows 7 & Windows 8. By default, CentOS anaconda installer won’t configure grub to handle NTFS filesystem or partitions. So manual intervention is required for dual booting CentOS 7.
Initial Configuration
Before we start to install Cacti from source, first assure that your system meets all the software requirements for compiling and installing Cacti. In the first step, open the Debian sources list file for editing with root privileges and append the contrib and non-free repositories as shown in the below file excerpt.
sources.list file sample:
After finished editing the file, save and close the file and update your system repositories and software packages to incorporate the new packages, by issuing the below commands.
Next, fire up a new command in order to install some necessary utilities that will be used to further manage your system from command line.
Cacti is a web-based monitoring tool mostly written in PHP server-side programming language. In order to run the Cacti php file scripts, a web server, such as Apache HTTP server, and a PHP interpreter must be installed and functional in the system. In order to install Apache web server and the PHP interpreter alongside with all required PHP modules needed by Cacti to run properly, issue the following command in your server console.
After Apache and PHP have been installed, test if the web server is up and running and listening for network connections on port 80 by issuing the following command with root privileges.
In case netstat network utility is not installed by default on your Debian system, execute the below command to install it.
By inspecting the netstat command output you can see that apache daemon is listening for incoming network connections on port 80.
In case you have a firewall enabled on your system, such as UFW firewall application, you should add a new rule to allow HTTP traffic to pass through the firewall by issuing the following command.
or
Finally, test if the Apache web server default web page can be displayed in your client's browser by visiting your Debian machine IP address via HTTP protocol, as shown in the below image. If you don’t know your machine IP address, execute 'ifconfig' or 'ip a' commands. My IP in this setup is: http://192.168.1.14
In the next step, we need to make some further changes to PHP default configuration file in order to assure that the file_uploads variable is enabled and the PHP timezone setting is correctly configured and matches your system physical location. Open /etc/php/7.0/apache2/php.ini file for editing and assure that the following lines are set up as follows.
Replace the timezone variable accordingly to your physical time zone by consulting the list of timezones provided by PHP docs at the following link http://php.net/manual/en/timezones.php
After you’ve made the required changes, create a php info file and restart apache daemon to apply changes by issuing the following commands.
Check if the PHP timezone has been correctly configured by visiting the php info script from a browser at the following URL (as illustrated in the below image). Scroll down to date setting to check php timezone setting.
Cacti monitoring tool stores configurations and collected data in an RDBMS database. In this tutorial, we’ll configure Cacti with MariaDB database backend. Issue the below command to install MariaDB database and the PHP module needed to access mysql database.
After you’ve installed MariaDB, verify that the daemon is running and listens for network connections on localhost, port 3306, by running netstat command.
Then log into MySQL console and secure MariaDB root account by issuing the following commands.
In the next step, secure MariaDB by executing the script mysql_secure_installation provided by the installation package from Debian Stretch repository. While running, the script will ask a series of questions to secure the MariaDB database, such as: to change MySQL root password, to remove anonymous users, to disable remote root logins and to delete the test database. Execute the script by issuing the below command and assure you type yes to all questions asked in order to fully secure MySQL daemon. Use the below script output except as a guide.
In order to test MariaDB security, try to login to the database from console with no root password. The access to the database should be denied if no password is provided for the root account. If the password is supplied, the login process should be granted to MySQL console, as shown in the below screenshot.
While logged in to MariaDB database, go ahead and create a database for Cacti installation and create the user that will be used to manage cacti database, by issuing the following commands. Replace the cacti database user and password accordingly.
Also, grant select permissions to the cacti database user for MySQL time zone by issuing the below commands. This is a new requirement in order to install and run the latest release of Cacti.
In the next step, open MySQL server default configuration file and append the following lines as shown in the below sample.
Add the following lines at the bottom of the 50-server.cnf file:
In order to apply all changes we made so far, restart MySQL and Apache daemons and verify that the daemons are running by issuing the following commands.
Configure SNMP Service
Cacti web monitoring service uses the SNMP protocol in order to collect device data and statistics. In order to install the SNMP program, SNMP daemon service and SNMP MIBS in your local Debian 9 system, issue the following command with root privileges.
Also, install the industry-standard data logging tool RRDtool, which is used by Cacti to display the graphing functionality.
Next, edit the SNMP configuration file /etc/snmp/snmp.conf and comment the “mibs” line by adding a hashtag (#) in front of the line as described in the below image.
Also configure SNMP daemon remote and localhost access, by opening the snmpd.conf filefor editing and search and update the below lines as follows:
Uncomment the line to listen for connections on all interfaces
Add the following lines to allow SNMP query for your local network via the snmp_string password. Replace the snmp community string snmp_string password and your network CIDR address accordingly.
Optionally, you can also modify the contact and location variable in order to provide information about your server. This information is displayed in Cacti notification area when you check your server details. Also, your system hostname, kernel version and system uptime are displayed in Cacti notification area.
In order to modify this information, edit the sysLocation and sysContact lines under the system information section and add your own values. By default, the following values are configured for sysLocation and sysContact.
After you’ve made the proper changes to snmpd.conf file, save and close the file and restart snmp daemon to reflect changes by issuing the below commands. Then check the snmpd daemon status and the owned ports in listening state.
Open firewall port for SNMP:
In order to verify that the SNMP daemon is working as expected and retrieves all the SNMP values under memory tree for localhost, run the below command.
![]() Install Cacti-Spine
Cacti-Spine is a replacement for the default cmd.php poller, written in C for faster execution time. In order to compile and install Cacti-Spine pooler from sources in Debian 9, first, execute the following command in order to install all the required dependencies into the system.
Next, download the latest version of Cacti-Spine tar compressed archive with wget utility, extract the tarball archive and enter cacti-spine extracted directory by issuing the following commands.
Now, compile and install Cacti-Spine utility from sources by issuing the below commands.
Cacti-Spine will be installed in /usr/local/spine/ system path. Spine recommends that you set the SUID bit for the spine binary in order to support ICMP ping requests.
You must also connect Spine to the cacti database by editing the configuration file with as shown in the below file excerpt.
spine.conf file sample. Replace the credentials accordingly. Use the same database credentials as configured for Cacti.
Install Cacti
In order to install Cacti from sources in Debian 9, first, download and extract the latest version of Cacti tarball compressed archive, then copy all the extracted files to apache web root path, by issuing the following commands.
In the next step, open cacti configuration file and update the following lines to reflect MySQL cacti database username, password, host and URL path accordingly, as illustrated in the below example.
Cacti config.php file sample:
Scroll down and change the path variable from “/cacti” to “/”
Next, you need to populate cacti database by loading the cacti.sql script located in your web server document root location and verify cacti mysql tables by issuing the below commands.
Finally, before starting to install Cacti from web interface, execute the below commands in order to remove the default index.html file installed by Apache web server, create the log file for Cacti and allow Apache runtime user with full write permissions to cacti installation path.
Start installing Cacti via the web interface by visiting your system IP address or domain name from a browser and opening the following URL.
At the first screen check Accept GPL License Agreement and hit on the Next button to continue as shown in the below screenshot.
On the next screen, scroll down and verify if all system requirements are passed by the installer and hit Next button to move forward with the installation process.
Next, choose New Primary Server as the installation type and click on Next button to continue.
Now verify if all critical binary locations and versions are correctly detected by cacti installer. Also, you should update Spine binary path to /usr/local/spine/bin/spine. You can choose the Classical theme and hit Next button to continue.
On the next screen, the installer will verify Apache web root directory permissions in order to check if the web server is allowed to perform writes to cacti installation path. If all the required paths are writable, hit on Next button to continue.
Select all the templates from the provided list and hit on Finish button in order to complete the installation.
After you’ve finished the installation process, log in to Cacti web interface with the following default credentials and replace the admin default password with a new strong password, as illustrated in the following screenshots.
Username: admin
Password: admin
After you log in to Cacti web interface, navigate to Console -> Configuration -> Settings -> Poller and change the poller type from cmd.php to spine binary, as shown in the below image. Scroll down and hit the Save button to apply changes.
Then navigate to Console -> Configuration -> Settings -> Paths and update Cacti-Spine and set the configuration file path to the following path /usr/local/spine/etc/spine.conf and hit on Save button to apply configuration, as illustrated in the below image.
In order to add a new device to be monitored via SNMP, go to Console -> Management -> Devices and hit on + icon, as illustrated in the below image. For demonstration purposes, we’ll add the localhost machine to be monitored by Cacti via SNMP protocol.
For the newly added Linux device that will be monitored via SNMP, add a description for the device, the hostname, FQDN or the IP address of the monitored device and select Local Linux Machine as device template. In SNMP options, select the proper SNMP Version (in this case we’ll use the version 2) and write your device SNMP community string, as described in the below images. In case the SNMP port hasn’t been changed, leave the port value as default and, when you finish, scroll down and hit on Create button to add the device to Cacti database in order to be monitored.
After the device has been added to Cacti database, an SNMP summary will be displayed on top of the device page in case the device was properly detected and queried. In order to create RRDTool SNMP graphs for this device, click on Create Graphs for this device link, check the graph templates you want to further examine and hit on Create button to move to the next screen, then, hit on Create button again to finish, as illustrated in the following images.
In order to visualize the graphs, navigate to Console -> Management -> Devices, check the device you want to further perform an action and select Place on a Tree (Default Tree) from action menu.
On the new screen, leave the Destination Branch as default and hit on Continue button to finish the process, as described in the below image.
Finally, in order for Cacti poller to start collecting data about monitored devices, you need to add a new cron job that will query the devices via SNMP every 5 minutes. Add the scheduled job to be owned and executed by Apache runtime user by issuing the below command.
Crontab job line:
After you have added the pooler cronjob, wait about a half hour to give Cacti time to gather data and then navigate to the Graphs tab in the Cacti web interface. Expand the default tree and the graphs collected from your monitored machine should be displayed as illustrated in the below screenshot.
For now, Cacti interface can be accessed from client’s browsers in an unsecured way via HTTP protocol. All sensitive information about your devices, as well as cacti login credentials, are sent in plain text. In order to encrypt the traffic between client’s browsers and Cacti web interface, issue the following commands with root privileges in order to enable Apache SSL configuration.
Afterwards, navigate to Cacti web interface via HTTPS protocol. Because Apache web server uses a self-signed certificate to encrypt the connection, an error message should be displayed in your browser. Accept the error and you can now securely access Cacti web interface as shown in the following screenshot.
That’s all! You have successfully installed and configured Cacti from sources in Debian 9. For other custom settings regarding Cacti, visit the documentation pages at the following link https://docs.cacti.net/manual:100
Learning has never been so easy!
May 15, 2019 - Unfortunately, the CactiEZ project has been discontinued by the developer. I'll leave this HOW-TO here and perhaps someone else will be inspired to create the ISO or OVF of a new CactiEZ.
'The effort of maintaining it becomes too much in the end. Exactly why I stopped creating the CactiEZ CD.'
-----------------------
There are numerous Spicehead requests asking how to monitor and trend bandwidth utilization, and the free Cacti software can do that for you if you have a SNMP capable device, like a switch, router, or server. However, for many Spiceheads who are Windows-centric types, installing Cacti on a Linux server can be daunting.
Created by Jimmy Conner, the free CactiEZ is a great way to quickly begin using Cacti without the usual installation challenges.
I'm going to cover how to install CactiEZ and configure a Cisco router interface for monitoring.
8 Steps totalStep 1: Downloading
Download the CD image from http://cactiez.cactiusers.org/download/
The download is via a torrent link located in the upper right part of the web page. Some browser plugins block the torrent link. If that's the case, then try http://cactiez.cactiusers.org/torrents/CactiEZ-v0.7.torrent (I can't promise that this link will remain valid, always go to the sites download page)
Save this to a place that has at least 1GB of space. The compressed file and extracted ISO image are each around 350MB.
Step 2: Extract and Burn the CD Image
1. The ISO image must be extracted from the tar.gz file that you downloaded. Windows-centric types can use the free IZArc program from www.izarc.org
2. IZArc will ask to decompress the tar archive, select Yes. Step 3: Install
To install CactiEZ on a hardware, like a spare computer, you need to Burn the extracted ISO using your favorite utility.
To install CactiEZ into a Virtual Machine (VM), just use the ISO directly in your virtualization software. (e.g. VMware ESX, Workstation or Virtualbox). The CactiEZ version 0.7 ISO is based on CentOS 6 x64 (there is no 32bit version). In VMware Workstation I selected the Typical configuration and chose the option to install the operating system later. Additionally, I used an IDE drive type for the new VM.
Step 4: Installation
1. Boot from the CD and you will be prompted to press 'ENTER' to install.
WARNING: the installation will wipe the hard drive in order to install CactiEZ.
2. The installation will start. After it is done you will be prompted to remove the CD from the drive and restart the system.
3. After the system restarts, you should be able to access Cacti Step 5: Login to Cacti
You will see the servers IP address listed above the console login. Open your web browser to http://serverip
To login to Cacti (it prompts you to change this)
user: admin password: admin
You can access the webmin graphical management interface at https://serverip:10000
(requires the root user and password)
To login to the operating system (you should really change this)
user: root password: CactiEZ Step 6: Configure a Cisco Router for SNMP
There's more to the process, such as security concerns, but this will get you access to the router's SNMP information.
1. Login to the router and enter the global configuration mode
cisco# conf t
2. Configure the SNMP community string
cisco(config)# snmp-server community CactiMonitoring ro 3. Save your router configuration cisco# copy running-config startup-config
4. Document the community string, an option is to use KeePass to securely document passwords and such.
Step 7: Configure Cacti to Collect SNMP Statistics
1. Start your CactiEZ server
2. Log in to the Cacti web console on you web browser 3. Enter your Cacti admin user and password, then click Login. 4. From the Console Tab, click on Create Devices for network 5. On the right side select Add across from Devices. 6. Under General Host Options type a Description and the fully qualified Hostname or IP address. Do not click Create. 7. Under SNMP Options, choose SNMP version 2 from the dropdown list. While SNMP version 3 is more secure, and should be used whenever it is supported on the device, it is also more difficult to configure. I'm going to keep it simple for the sake of this HOWTO. 8. Verify that Downed Device Detection changes from Ping to SNMP. For the SNMP community type enter the string that you configured on your router. 9. Now you can click Create. Cacti will retrieve the SNMP information from the router: device uptime, location, and contact info (if you configured that information). 10. Click “Create Graphs for this Host”. 11. Under Data Query there is a list of interfaces with statistics picked up by the SNMP poll. Identify the interface that goes to the internet (or WAN), such as FastEthernet0/0, then check the box located to the right of that interface, and click Create. 12. Click Default Tree in the center under Graph Trees. 13. Click Add, located on the far right from Tree Items. 14. Under the Tree Items heading for Tree Item Type select Host in the dropdown list. For the Host item below that select the descriptive name you entered for your router. The Graphic Template should already be Graph Grouping Style. Click Create. 15. If the router was saved successfully, then it should be displayed in the list of tree items. 16. Select Devices, under Management on the left side. 17. The router should now be displayed in the list of devices monitored by Cacti. The router may initially have a status of Unknown. Wait a few minutes and check again. 18. After several minutes the router status should be displayed as Up. 19. Click the Graphs tab at the top left. 20. Under the Default Tree, click on the host name of your router. 21. It may take some time for the graph to start showing statistics, especially if there isn't much traffic going through the router interface. 22. Click on the graph, which will take you to the trended information.
I also like to graph the router CPU, memory, and interface error's.
Step 8: More Information
1. Definitely visit the CactiEZ support thread over at cacti.net: http://forums.cacti.net/viewtopic.php?f=5&t=48682 as there are some fixes that you will want to apply.
2. Read some of the Cacti User Manual, particularly the section on How to Graph your Network at http://www.cacti.net/downloads/docs/html/graph_howto.html
3. Discover how much more you can monitor and trend with Cacti in the forums at http://forums.cacti.net/
4. Visit the CactiEZ Tips page at http://cactiez.cactiusers.org/docs/tips.html
CactiEZ provides a easy way to get the Cacti program running so that you are quickly evaluating Cacti to see if it will fit your needs. CactiEZ version 0.7 was released in October 2012. Make sure you get the latest version.
VMware Workstation tip: CactiEZ version 0.7 ISO is based on CentOS 6 x64 (there is no 32bit version) operating system and VMware workstation will use an IDE drive type.
Please send Jimmy Connor some appreciation if CactiEZ works for you. Consider giving up the cost of your next fancy coffee or brew to Jimmy. There is a lot of hard work that goes into a project like this, so look for the Donations link on the CactiEZ page.
Published: Sep 10, 2011 · Last Updated: May 15, 2019
References
17 Comments
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |