Cacti
Cacti is a web-based system monitoring and graphing solution.
Installation
To use cacti, you need a working web server (e.g. Nginx or Apache HTTP Server) setup, that forwards requests to an application server (e.g. uWSGI or php-fpm).
Next, install cacti and configure MariaDB, if a local MySQL server will be used.
Configuration
To serve cacti top level instead of under /cacti/
(i.e. https://example.tld/ instead of https://example.tld/cacti/) use the $url_path
configuration option:
/etc/webapps/cacti/config.php
$url_path = '/';
PHP
/etc/php/php.ini
.Cacti requires the following PHP extensions to be enabled:
/etc/php/php.ini
extension=gd extension=gettext extension=gmp extension=ldap extension=mysqli extension=pdo_mysql extension=snmp extension=sockets
Cacti needs certain directories and executables in PHP's open_basedir
to function properly:
/tmp/:/usr/share/webapps/cacti:/etc/webapps/cacti:/var/cache/cacti:/var/lib/cacti:/var/log/cacti:/proc/meminfo:/usr/bin/rrdtool:/usr/bin/snmpget:/usr/bin/snmpwalk:/usr/bin/snmpbulkwalk:/usr/bin/snmpgetnext:/usr/bin/snmptrap:/usr/bin/sendmail:/usr/bin/php:/usr/bin/spine:/usr/share/fonts/TTF/
Cacti requires date.timezone
to be set in . Check upstream documentation and time zone for reference.
SNMP
If it is necessary for cacti to monitor the machine that it is running on, configure snmpd.
MySQL
Cacti needs its own database in which to store its data, and a database user account to access the database.
Run the following commands as root:
Alternatively, use PhpMyAdmin to achieve the same results:
- Create an empty database called .
- Import the file into the database.
- Create a user , and grant this user privileges to access the database.
Add the database details:
/etc/webapps/cacti/config.php
$database_type = "mysql"; $database_default = "cactidb"; $database_username = "cactiuser"; $database_password = "some_password";
Hosting
cacti
). It is using /etc/webapps/cacti
, /var/lib/cacti
, /var/log/cacti
and /run/cacti
for configurations, caches, logs and (potentially) sockets (respectively)!Apache
The apache web server can serve dynamic web applications with the help of modules, such as mod_proxy_fcgi or mod_proxy_uwsgi.
php-fpm
Install and configure Apache HTTP Server with php-fpm. Use a pool run as user and group . The socket file should be accessible by the user and/or group, but needs to be located below .
Include the following configuration in your Apache HTTP Server configuration (i.e. ) and restart the web server:
/etc/httpd/conf/cacti.conf
Alias /cacti "/usr/share/webapps/cacti" <Directory "/usr/share/webapps/cacti"> DirectoryIndex index.html index.php <FilesMatch \.php__SUB_LEVEL_SECTION_7__gt; SetHandler "proxy:unix:/run/cacti/cacti.sock|fcgi://localhost/" </FilesMatch> AllowOverride All Options FollowSymlinks Require all granted </Directory>
The file also controls access. Configure or remove it.
Nginx
Nginx can proxy application servers such as and uWSGI, that run a dynamic web application. The following examples describe a folder based setup over a non-default port (for simplicity).
php-fpm
Install php-fpm. Setup nginx with php-fpm and use a pool run as user and group . The socket file should be accessible by the user and/or group, but needs to be located below . This can be achieved by adding the following lines to the php-fpm configuration and restarting it.
/etc/php/php-fpm.d/www.conf
[cacti] user = cacti group = cacti listen = /run/cacti/cacti.sock listen.owner = http listen.group = http pm = ondemand pm.max_children = 4
Setup
Open a browser and go to http://your_server/cacti/. You should be welcomed with the cacti installer.
- Login with username "admin" and password "admin".
- Change the password as requested, click Save.
- Follow the remaining install steps and recommendations.
- (Optional) If you chose to install spine, follow these instructions to set it up.
- Click on Settings, on the left panel of the Console tab.
- Select the Poller tab.
- Change Poller Type to spine.
- Adjust any other settings on the page as desired, then click Save.
- Select the Paths tab.
- Set Spine Poller File Path to and click Save.
Tips and tricks
Spine
Optionally, install , a faster poller for cacti, from the AUR. configure it with database access details:
Systemd
Cacti uses a poller to collect data, so create a Systemd service to run poller.php
, and a timer to run the service every 5 minutes:
cacti_poller.service
. Instead, start/enable cacti_poller.timer
only, which calls the service every 5 minutes.