mirror of
https://github.com/Cacti/documentation.git
synced 2026-12-06 15:13:53 +09:00
docs: correct platform and remote poller setup for Cacti 1.2.31 (#242)
* docs: correct platform installation examples for Cacti 1.2.31 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: correct remote connections and setup prerequisites Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: clarify collector connections and recovery limits Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
This commit is contained in:
1 parent
6cfc8a3971
commit
51f9deb545
6 files changed
+891
-952
No files matched your search
+37
-60
@@ -21,37 +21,28 @@ unavailable due to a WAN outage for example, the data for the **Devices**
|
||||
it manages will be cached locally until such time as the
|
||||
**Main Data Collector** is reachable again.
|
||||
|
||||
Once the **Main Data Collector** becomes reachable, the **Remote Data Collector**
|
||||
will flush it cache back to the **Main Data Collector** and the system
|
||||
will normalize. Therefore, this is generally considered to be a more
|
||||
Highly Available (HA) design.
|
||||
Once the **Main Data Collector** becomes reachable, recovery can transfer
|
||||
cached results back to it. Recovery depends on the remote collector retaining
|
||||
its local data and on a working connection to the primary database. Monitor
|
||||
outages, local capacity and recovery errors; buffering does not guarantee
|
||||
lossless collection through every failure.
|
||||
|
||||
A good Enterprise Architecture for Cacti would include three **Main Data Collectors**
|
||||
which cactid systemd service was managed by keepalived, using GlusterFS as
|
||||
fully replicated File system for the Web Server, the logs, and the RRDfiles
|
||||
using MariaDB Galera as the fully fault tolerant database server.
|
||||
Remote collection is not automatic failover of the primary server. A highly
|
||||
available primary deployment needs separately designed and tested database,
|
||||
RRD storage and scheduler coordination. Do not run multiple primary pollers
|
||||
against shared data on the assumption that installing cactid provides
|
||||
cross-server fencing.
|
||||
|
||||
Then, either using keepalived to a load balancer, you could load balance
|
||||
the connections across all three **Main Data Collectors**, using the
|
||||
MariaDB Galera database to maintain login session data. There are many
|
||||
good articles on setting up and using MariaDB Galera along with HAProxy
|
||||
or load balancers from Citrix and others to direct read and write traffic
|
||||
to the correct Galera instance server. The bottom line is that Cacti
|
||||
provides the opportunity to have a Highly Available (HA) setup today.
|
||||
Multiple **Data Collectors** use the built-in **Boost** module for buffered
|
||||
RRD updates. Cacti 1.2.31 enables Boost when multiple collectors are configured.
|
||||
|
||||
That HA setup will not be covered in this chapter, but may be included
|
||||
at a later date.
|
||||
|
||||
When using multiple **Data Collectors**, Cacti requires the use of the
|
||||
`boost` module, which is now included in the main Cacti package. Therefore if
|
||||
you are planning on deploying multiple **Data Collectors**, you should become
|
||||
familiar with its use and why it is critical to a HA design.
|
||||
|
||||
In order for a **Remote Data Collector** to work with a **Main Data Collector**
|
||||
the **Remote Data Collector** must be able to talk to the **Main Data Collector**
|
||||
over both https and the MySQL protocol in a bidirectional fashion. Therefore,
|
||||
there are only two ports that are required to be open in order to fully
|
||||
leverage the multiple **Data Collector** architecture in Cacti.
|
||||
Remote collectors connect to the primary database, and the primary connects
|
||||
to each remote database for synchronization. Collector operations also use
|
||||
web requests to the configured collector hostnames. Configure reachable
|
||||
addresses, the actual database and web ports, and restricted firewall rules
|
||||
for these flows. Use HTTPS with a valid certificate and database TLS or a
|
||||
protected network connection. Device polling protocols require their own
|
||||
network access; there is no universal two-port firewall rule for a deployment.
|
||||
|
||||
## Data Collector User Interface
|
||||
|
||||
@@ -84,48 +75,34 @@ by the **Remote Data Collectors**.
|
||||
When editing the **Remote Data Collector** in the images below, you can see that
|
||||
it shares many of the settings of the **Main Data Collector** with the addition
|
||||
of a `TimeZone` setting and MySQL/MariaDB credentials and a `Test Connection`
|
||||
button. Generally, these setting are only use during the initial setup
|
||||
of Cacti, and afterwards for diagnostics only.
|
||||
button. These saved credentials are used for ongoing synchronization from the
|
||||
primary to the remote database as well as for the connection test.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Setup Main Data Collector to accept connections Remotes
|
||||
## Set up remote collector connections
|
||||
|
||||
We will need to make some config changes to the MySQL configuration to allow
|
||||
the **Remote Data Collector** to talk to the **Main Data Collector**.
|
||||
Follow [Remote Poller Setup](How-To-Setup-Remote-Pollers.md) for database
|
||||
accounts, connection directions, Cacti and Spine configuration, and the
|
||||
installer-assigned poller ID. Keep each collector's local database credentials
|
||||
separate from its connection to the primary and the primary's reverse
|
||||
synchronization credentials. Use matching account names and unique secrets;
|
||||
do not copy a commented configuration block as an active setup.
|
||||
|
||||
```console
|
||||
mysql -u root mysql -e "GRANT ALL ON cacti.* TO cactidb@<ip of remote poller host> IDENTIFIED BY 'password';"
|
||||
mysql -u root mysql -e "GRANT SELECT ON mysql.time_zone_name TO cacti@<ip of remote poller host> IDENTIFIED BY 'password';"
|
||||
```
|
||||
|
||||
Next setup the **Remote Data Collectors** config.php located in
|
||||
`<path_cacti>/include/config.php` with the remote database details and credentials.
|
||||
Generally, you will not have to do this as part of the direct maintenance of the
|
||||
**Remote Data Collector**, the **Remote Data Collector** install process will force
|
||||
you to take these steps to complete the install. However, it's provided here for
|
||||
reference so that you understand the process.
|
||||
|
||||
```console
|
||||
#$rdatabase_type = 'mysql';
|
||||
#$rdatabase_default = 'cacti';
|
||||
#$rdatabase_hostname = 'localhost'; <<< IP/Hostname of main server
|
||||
#$rdatabase_username = 'cactiuser';
|
||||
#$rdatabase_password = 'cactiuser';
|
||||
#$rdatabase_port = '3306';
|
||||
#$rdatabase_retries = 5;
|
||||
#$rdatabase_ssl = false;
|
||||
#$rdatabase_ssl_key = '';
|
||||
#$rdatabase_ssl_cert = '';
|
||||
#$rdatabase_ssl_ca = '';
|
||||
```
|
||||
|
||||
You will now need to install Cacti on the remote server selecting the
|
||||
Install the same Cacti version on the remote server, selecting the
|
||||
**New Remote Poller** install option as shown below.
|
||||
|
||||

|
||||
|
||||
Source: Cacti 1.2.31 [remote database synchronization][sync-source],
|
||||
[recovery processing][recovery-source] and [poller startup][poller-source].
|
||||
|
||||
[sync-source]:<https://github.com/Cacti/cacti/blob/1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1/lib/poller.php>
|
||||
[recovery-source]:<https://github.com/Cacti/cacti/blob/1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1/poller_recovery.php>
|
||||
[poller-source]:<https://github.com/Cacti/cacti/blob/1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1/poller.php>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
+107
-28
@@ -12,8 +12,8 @@ in Toronto in this case will help with that issue.
|
||||
## Setup Instructions
|
||||
|
||||
The process of remote poller installation is similar to cacti installation.
|
||||
In the wizard, select the installation type for Remote poller. For the remote poller
|
||||
you must use the same version of cacti as the main poller installation.
|
||||
In the wizard, select **New Remote Poller**. Use the same version of Cacti
|
||||
as the primary installation.
|
||||
|
||||
With this setup the following layout is assumed
|
||||
|
||||
@@ -25,43 +25,72 @@ With this setup the following layout is assumed
|
||||
|
||||
## Database Configuration
|
||||
|
||||
Each server will have its own local database however the remote pollers will
|
||||
need to talk back to the main poller so we must allow the remote servers user
|
||||
account to connect back to the main pollers database via the network
|
||||
Each server needs its own local Cacti database, initialized as described in
|
||||
[Installing Cacti](General-Installing-Instructions.md). The examples below
|
||||
assume that each database is named `cacti`. Remote pollers connect to the
|
||||
primary database, and
|
||||
the primary connects to each remote database for synchronization. These are
|
||||
two separate connection directions with separate credentials.
|
||||
|
||||
Main server database config
|
||||
Run the following SQL as a database administrator on the specified server.
|
||||
Replace every example password with a unique secret before running it. The
|
||||
host portion of each account must match the source address seen by that
|
||||
database server, which may differ from the addresses below when using NAT.
|
||||
Use separate `CREATE USER` and `GRANT` statements; do not rely on `GRANT` to
|
||||
create an account. If an account already exists, review its authentication
|
||||
and grants instead of recreating it.
|
||||
|
||||
On the primary database server (`192.168.1.5`), create accounts for connections
|
||||
from the two remote pollers:
|
||||
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.10' IDENTIFIED BY 'cacti';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.20' IDENTIFIED BY 'cacti';
|
||||
CREATE USER 'cacti_remote1'@'192.168.1.10' IDENTIFIED BY 'replace-with-remote1-secret';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti_remote1'@'192.168.1.10';
|
||||
CREATE USER 'cacti_remote2'@'192.168.1.20' IDENTIFIED BY 'replace-with-remote2-secret';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti_remote2'@'192.168.1.20';
|
||||
```
|
||||
|
||||
Remote poller 1 database configuration
|
||||
On remote poller 1's database server (`192.168.1.10`), create an account for
|
||||
connections from the primary:
|
||||
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.5' IDENTIFIED BY 'cacti';
|
||||
CREATE USER 'cacti_sync'@'192.168.1.5' IDENTIFIED BY 'replace-with-sync1-secret';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti_sync'@'192.168.1.5';
|
||||
```
|
||||
|
||||
Remote poller 2 database configuration
|
||||
On remote poller 2's database server (`192.168.1.20`):
|
||||
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.5' IDENTIFIED BY 'cacti';
|
||||
CREATE USER 'cacti_sync'@'192.168.1.5' IDENTIFIED BY 'replace-with-sync2-secret';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti_sync'@'192.168.1.5';
|
||||
```
|
||||
|
||||
We have also let the main poller talk to the remote pollers to keep in sync
|
||||
These network accounts do not replace the local database account configured
|
||||
in each server's `$database_*` settings. Keep the local account's grants and
|
||||
credentials consistent with the local installation instructions.
|
||||
|
||||
Database listeners and firewalls must permit these connections only between
|
||||
the required servers. Use database TLS or a protected network connection;
|
||||
do not expose the database port publicly. Configure matching TLS options in
|
||||
Cacti and Spine when using database TLS.
|
||||
|
||||
## Spine configuration
|
||||
|
||||
When you have setup multiple pollers while using spine you will need to also
|
||||
configure the spine.conf file to connect to the remote database as well.
|
||||
If a remote poller uses Spine, configure its `spine.conf` with both database
|
||||
connections. `DB_*` points to that poller's local database and must match its
|
||||
`$database_*` settings. `RDB_*` points to the primary database and must match
|
||||
its `$rdatabase_*` settings. Use a Spine release compatible with Cacti 1.2.
|
||||
Protect this file because it contains database credentials.
|
||||
|
||||
Be sure to remove the # next to the below entries
|
||||
For remote poller 1, uncomment and set the following primary-connection
|
||||
entries. Replace the password with the same secret used in its primary
|
||||
server account. Remote poller 2 uses `cacti_remote2` and its own secret.
|
||||
|
||||
```console
|
||||
RDB_Host 192.168.1.5
|
||||
RDB_Database cacti
|
||||
RDB_User cacti
|
||||
RDB_Pass cacti
|
||||
RDB_User cacti_remote1
|
||||
RDB_Pass replace-with-remote1-secret
|
||||
RDB_Port 3306
|
||||
#RDB_UseSSL 0
|
||||
#RDB_SSL_Key
|
||||
@@ -80,19 +109,21 @@ connections = spine-processes x ( 1 + threads-per-process + PHP servers )
|
||||
|
||||
## Remote poller config.php setup
|
||||
|
||||
Now that we have set up the database connections we need to set up the cacti
|
||||
config.php file on the remote pollers to give them the database info they need
|
||||
to connect to the main poller we won’t have to edit the main servers config.php
|
||||
file aside from the normal install procedure to give it access to its local
|
||||
database. Below is the portion of the config.php that we need to edit to allow
|
||||
the remote poller to talk to the main server be sure to remove the hash sign (#)
|
||||
On each remote poller, copy `include/config.php.dist` to `include/config.php`
|
||||
if the configuration file does not already exist. Do not overwrite an
|
||||
existing configuration. Keep `$database_*` pointing to that poller's local
|
||||
database with its local database credentials.
|
||||
|
||||
```console
|
||||
Uncomment the `$rdatabase_*` settings and point them to the primary database.
|
||||
For remote poller 1, use the account created on the primary for
|
||||
`192.168.1.10`:
|
||||
|
||||
```php
|
||||
$rdatabase_type = 'mysql';
|
||||
$rdatabase_default = 'cacti';
|
||||
$rdatabase_hostname = '192.168.1.5;
|
||||
$rdatabase_username = 'cacti';
|
||||
$rdatabase_password = 'cacti';
|
||||
$rdatabase_hostname = '192.168.1.5';
|
||||
$rdatabase_username = 'cacti_remote1';
|
||||
$rdatabase_password = 'replace-with-remote1-secret';
|
||||
$rdatabase_port = '3306';
|
||||
$rdatabase_retries = 5;
|
||||
$rdatabase_ssl = false;
|
||||
@@ -101,5 +132,53 @@ $rdatabase_ssl_cert = '';
|
||||
$rdatabase_ssl_ca = '';
|
||||
```
|
||||
|
||||
For remote poller 2, use `cacti_remote2` and its corresponding password. The
|
||||
TLS options shown are disabled; enable and configure them when using database
|
||||
TLS. Leave `$rdatabase_*` commented out on the primary server.
|
||||
|
||||
Restrict access to the installer and use HTTPS or a protected local connection
|
||||
before entering credentials. Select **New Remote Poller** in the web installer
|
||||
and use **Test Connection** to check the primary database connection. Cacti
|
||||
1.2.31 requires `include/config.php` to be writable by the web server during
|
||||
remote installation so it can save the assigned `$poller_id`. Afterwards,
|
||||
remove web-server write access while retaining read access. Do not assign
|
||||
poller IDs from the example numbering above: the primary uses ID `1`, and the
|
||||
installer obtains the remote poller's ID from the primary database.
|
||||
|
||||
After installation, edit each remote Data Collector on the primary server.
|
||||
Under **Remote Database Connection**, set its reachable database hostname,
|
||||
database name, port and synchronization credentials. For remote poller 1,
|
||||
use hostname `192.168.1.10`, database `cacti`, user `cacti_sync` and the
|
||||
`replace-with-sync1-secret` value you replaced earlier. For remote poller 2,
|
||||
use `192.168.1.20` and its own synchronization password. Do not use `localhost`
|
||||
here: the primary must connect to the remote database. Use **Test Connection**
|
||||
to verify this reverse connection as well.
|
||||
|
||||
## Scheduled polling
|
||||
|
||||
Complete installation and both connection checks before starting scheduled
|
||||
polling on a remote poller. Configure one scheduler per server, either cron
|
||||
or `cactid.service`, using that server's installation path and poller account.
|
||||
Do not run both. Match the **Cron/Daemon Interval** in Settings > Poller;
|
||||
this is separate from the data-source polling interval, which can be shorter.
|
||||
See the scheduler examples in the
|
||||
[Ubuntu/Debian guide](Installing-Under-Ubuntu-Debian.md#schedule-polling)
|
||||
or the relevant platform installation guide.
|
||||
|
||||
## References
|
||||
|
||||
- [Cacti 1.2.31 configuration example][cacti-config]
|
||||
- [Cacti 1.2.31 remote installation checks][cacti-installer]
|
||||
- [Spine 1.2.31 database configuration example][spine-config]
|
||||
- [MySQL CREATE USER][mysql-create-user]
|
||||
- [MariaDB CREATE USER][mariadb-create-user]
|
||||
|
||||
[cacti-config]:<https://github.com/Cacti/cacti/blob/release/1.2.31/include/config.php.dist>
|
||||
[cacti-installer]:<https://github.com/Cacti/cacti/blob/release/1.2.31/lib/installer.php#L2173-L2207>
|
||||
[spine-config]:<https://github.com/Cacti/spine/blob/release/1.2.31/spine.conf.dist>
|
||||
[mysql-create-user]:<https://dev.mysql.com/doc/refman/8.0/en/create-user.html>
|
||||
[mariadb-create-user]:<https://mariadb.com/docs/server/reference/sql-statements/account-management-sql-statements/create-user>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
+136
-148
@@ -1,5 +1,15 @@
|
||||
# Installing on CentOS/RHEL/ROCKY
|
||||
|
||||
This page retains examples from the CentOS 7/8 era. CentOS Linux 7 reached
|
||||
end of life on June 30, 2024, and CentOS Linux 8 on December 31, 2021; see the
|
||||
[CentOS lifecycle notice](https://www.centos.org/cl-vs-cs/). These examples are
|
||||
not a tested compatibility matrix for current RHEL or Rocky Linux releases.
|
||||
Use a maintained operating system and a PHP version meeting
|
||||
[Requirements](Requirements.md), with repositories appropriate to that system.
|
||||
Run administrative commands as root and adapt paths and service accounts to
|
||||
the actual installation. Do not use the legacy PHP streams below as a new
|
||||
server recommendation.
|
||||
|
||||
## LAMP (Linux, Apache, MySQL/MariaDB, PHP) Required packages
|
||||
|
||||
### Web Server (Apache)
|
||||
@@ -7,7 +17,7 @@
|
||||
1. Enable Epel repo to enable PHP 7.2 package download ( 7.x and Below)
|
||||
|
||||
```console
|
||||
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
|
||||
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
|
||||
yum install yum-utils -y
|
||||
yum-config-manager --enable remi-php72
|
||||
```
|
||||
@@ -31,7 +41,7 @@ Daemon to rebuild the Cache or you may receive a HTTP 500 Error
|
||||
2.Install Apache
|
||||
|
||||
```console
|
||||
yum install -y httpd
|
||||
yum install -y httpd mod_ssl
|
||||
```
|
||||
|
||||
3.Enable and start the service to ensure it starts when the system reboots
|
||||
@@ -54,12 +64,9 @@ files holding your certificate (`.crt`) and private key (`.key`).
|
||||
# Cacti: An RRDtool based graphing web application
|
||||
#
|
||||
|
||||
# For security reasons, the Cacti web interface is accessible only to
|
||||
# localhost in the default configuration. If you want to allow other clients
|
||||
# to access your Cacti installation, change the httpd ACLs below.
|
||||
# For example:
|
||||
# On httpd 2.4, change "Require host localhost" to "Require all granted".
|
||||
# On httpd 2.2, change "Allow from localhost" to "Allow from all".
|
||||
# This example allows clients to reach the configured HTTPS site. Restrict
|
||||
# access to the administrator during installation using server ACLs or a
|
||||
# firewall, then review the permitted clients before normal operation.
|
||||
|
||||
<VirtualHost *:443>
|
||||
LogLevel warn
|
||||
@@ -149,10 +156,11 @@ bridged.
|
||||
|
||||
#### MariaDB
|
||||
|
||||
1. Install MariaDB server
|
||||
1. Install the distribution MariaDB packages (package names differ when using
|
||||
the MariaDB vendor repository).
|
||||
|
||||
```console
|
||||
yum install -y MariaDB-server MariaDB-client
|
||||
yum install -y mariadb-server mariadb
|
||||
```
|
||||
|
||||
2. Enable and start the service to ensure it starts when the system reboots
|
||||
@@ -180,56 +188,28 @@ during the installation.
|
||||
vim /etc/my.cnf.d/server.cnf
|
||||
```
|
||||
|
||||
The following `[mysqld]` section is a base configuration. The installer
|
||||
will provide recommendations based on the actual system which will be more
|
||||
tailored to your environment.
|
||||
Keep the database vendor's configuration defaults unless the installer and
|
||||
workload justify a change. A minimal character-set example is:
|
||||
|
||||
If using MariaDB less than version 11.1 or MySQL use the settings below.
|
||||
Note that you should revise up or down your settings depending on
|
||||
the Cacti recommendation that you see once you start the installer.
|
||||
|
||||
```shell
|
||||
```ini
|
||||
[mysqld]
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
innodb_file_format = Barracuda
|
||||
max_allowed_packet = 16777777
|
||||
join_buffer_size = 32M
|
||||
innodb_file_per_table = ON
|
||||
innodb_large_prefix = 1
|
||||
innodb_buffer_pool_size = 250M
|
||||
innodb_additional_mem_pool_size = 90M
|
||||
innodb_flush_log_at_trx_commit = 2
|
||||
log-error = /var/log/mysql/mysql-error.log
|
||||
log-queries-not-using-indexes = 1
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /var/log/mysql/mysql-slow.log
|
||||
```
|
||||
|
||||
If using MariaDB 11.0 or higher, use the settings below:
|
||||
Buffer sizes depend on available memory and workload. Do not copy obsolete
|
||||
InnoDB options or disable doublewrite protection as a general tuning step;
|
||||
consult the [MariaDB InnoDB variable reference][innodb-variables] for the
|
||||
installed version.
|
||||
|
||||
```shell
|
||||
[mariadb]
|
||||
max_heap_table_size=500M
|
||||
character_set_client=utf8mb4
|
||||
character_set_server=utf8mb4
|
||||
collation_server=utf8mb4_unicode_ci
|
||||
innodb_buffer_pool_size=8G
|
||||
innodb_doublewrite=OFF
|
||||
tmp_table_size=500M
|
||||
log-error = /var/log/mysql/mysql-error.log
|
||||
log-queries-not-using-indexes = 1
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /var/log/mysql/mysql-slow.log
|
||||
```
|
||||
|
||||
3. Restart MySQL/MariaDB service to pick up the changes
|
||||
2. Restart the service actually installed (`mariadb` for the MariaDB example,
|
||||
or `mysqld` for the MySQL example):
|
||||
|
||||
```console
|
||||
systemctl restart mysql
|
||||
systemctl restart mariadb
|
||||
```
|
||||
|
||||
4. Populate timezone table with available timezones
|
||||
3. Populate timezone table with available timezones
|
||||
|
||||
```console
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
|
||||
@@ -237,48 +217,25 @@ during the installation.
|
||||
|
||||
#### Setup Cacti database
|
||||
|
||||
1. Login to MySQL/MariaDB as root to create Cacti database
|
||||
Connect using the database administrator's authentication method:
|
||||
|
||||
```console
|
||||
# mysql -u root -p
|
||||
MariaDB [(none)]> create database if not exists cacti;
|
||||
Query OK, 1 row affected (0.00 sec)
|
||||
```
|
||||
```console
|
||||
mysql -u root -p
|
||||
```
|
||||
|
||||
2. Import Cacti database from SQL file
|
||||
Create a new database and account. Replace the username and password below,
|
||||
and use those same values in Cacti's configuration. Do not apply this
|
||||
fresh-install procedure to an existing Cacti database.
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> use cacti;
|
||||
Database changed
|
||||
MariaDB [(cacti)]> source /var/www/html/cacti/cacti.sql
|
||||
```
|
||||
```sql
|
||||
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'your_cacti_username'@'localhost' IDENTIFIED BY 'your_cacti_password';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'your_cacti_username'@'localhost';
|
||||
GRANT SELECT ON mysql.time_zone_name TO 'your_cacti_username'@'localhost';
|
||||
EXIT;
|
||||
```
|
||||
|
||||
3. Grant Cacti username access to Cacti database. Replace `your_cacti_username`
|
||||
and `your_cacti_password` with your own details.
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> CREATE USER 'your_cacti_username'@'localhost'
|
||||
IDENTIFIED BY 'your_cacti_password';
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cacti.* TO 'your_cacti_username'@'localhost';
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
```
|
||||
|
||||
4. Grant cacti username to MySQL timezone table
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO 'your_cacti_username'@'localhost';
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
```
|
||||
|
||||
5. Save the Database Charset and Collation
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
The schema import occurs below, after the Cacti archive has been extracted.
|
||||
|
||||
### Common packages
|
||||
|
||||
@@ -331,15 +288,22 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
cd /tmp
|
||||
wget https://www.cacti.net/downloads/cacti-1.y.z.tar.gz
|
||||
tar -zxvf cacti-1.y.z.tar.gz
|
||||
mv -v cacti-1.y.z /var/www/html/cacti
|
||||
wget https://www.cacti.net/downloads/cacti-1.2.31.tar.gz
|
||||
tar -zxvf cacti-1.2.31.tar.gz
|
||||
mv -v cacti-1.2.31 /var/www/html/cacti
|
||||
```
|
||||
|
||||
Import the schema into the new `cacti` database created above. Do not run
|
||||
this fresh-install import against an existing Cacti database.
|
||||
|
||||
```console
|
||||
mysql -u root -p cacti < /var/www/html/cacti/cacti.sql
|
||||
```
|
||||
|
||||
2. Edit the config.php file
|
||||
|
||||
```console
|
||||
mv -v /var/www/html/cacti/include/config.php-dist /var/www/html/cacti/include/config.php
|
||||
cp /var/www/html/cacti/include/config.php.dist /var/www/html/cacti/include/config.php
|
||||
```
|
||||
|
||||
3. Update `database_` fields with your own details. This section only applies
|
||||
@@ -347,7 +311,7 @@ configure the basics for Cacti.
|
||||
|
||||
```php
|
||||
$database_type = 'mysql';
|
||||
$database_default = 'your_cacti_database';
|
||||
$database_default = 'cacti';
|
||||
$database_hostname = 'localhost';
|
||||
$database_username = 'your_cacti_username';
|
||||
$database_password = 'your_cacti_password';
|
||||
@@ -358,19 +322,46 @@ configure the basics for Cacti.
|
||||
$database_ssl_ca = '';
|
||||
```
|
||||
|
||||
Keep code owned by the administrator. Allow the web/poller account to read
|
||||
the configuration and write only the runtime directories:
|
||||
|
||||
```console
|
||||
chown root:apache /var/www/html/cacti/include/config.php
|
||||
chmod 640 /var/www/html/cacti/include/config.php
|
||||
chown -R apache:apache /var/www/html/cacti/rra /var/www/html/cacti/log /var/www/html/cacti/cache
|
||||
chmod -R u+rwX,go-rwx /var/www/html/cacti/rra /var/www/html/cacti/log /var/www/html/cacti/cache
|
||||
```
|
||||
|
||||
The installer can additionally request temporary write access to its
|
||||
`resource` query directories, `scripts`, and the CSRF-secret location.
|
||||
Grant only the requested access during installation/package import and
|
||||
remove it afterwards. Keep SELinux permissions in mind as well.
|
||||
Restrict installer access to the administrator and use HTTPS or a protected
|
||||
local connection before entering credentials. For a freshly imported
|
||||
1.2.31 schema, sign in with application username `admin` and initial
|
||||
password `admin`, then choose a unique administrator password when
|
||||
prompted. These are separate from the database credentials. Complete the
|
||||
web installer before starting scheduled polling or allowing general access.
|
||||
|
||||
4. Create your cron task file or systemd units file
|
||||
|
||||
Starting with Cacti 1.2.16, you have the option to use either the
|
||||
legacy Crontab entry, or an optional cactid units file and server
|
||||
to run your Cacti pollers.
|
||||
Before using the supplied `Type=forking` systemd unit, confirm that the PHP
|
||||
CLI used by the unit provides `pcntl_fork`. For example,
|
||||
`/usr/bin/php -r 'var_dump(function_exists("pcntl_fork"));'` should report
|
||||
`bool(true)`. Otherwise use cron or install the appropriate PCNTL support.
|
||||
|
||||
Choose either cron or the daemon, not both. Cacti 1.2.16 and later include
|
||||
an optional `cactid.service` for running the polling daemon. Match the
|
||||
schedule to the configured **Cron/Daemon Interval** in Settings > Poller;
|
||||
this can differ from the shorter data-source polling interval.
|
||||
|
||||
For Crontab use, follow the instructions below:
|
||||
|
||||
Create and edit `/etc/cron.d/cacti` file.
|
||||
Create `/etc/cron.d/cacti` as root with mode `644`.
|
||||
Make sure to setup the correct path to poller.php
|
||||
|
||||
```console
|
||||
*/5 * * * * apache php /var/www/html/cacti/poller.php &>/dev/null
|
||||
*/5 * * * * apache /usr/bin/php /var/www/html/cacti/poller.php >/dev/null 2>&1
|
||||
```
|
||||
|
||||
For systemd unit's file install, you will need to modify the
|
||||
@@ -378,30 +369,36 @@ configure the basics for Cacti.
|
||||
and desired user and group's to run the Cacti poller as.
|
||||
To complete the task, follow the procedure below:
|
||||
|
||||
```console
|
||||
vim /var/www/html/cacti/service/cactid.service (edit the path)
|
||||
touch /etc/sysconfig/cactid
|
||||
cp -p /var/www/html/cacti/service/cactid.service /etc/systemd/system
|
||||
systemctl enable cactid
|
||||
systemctl start cactid
|
||||
systemctl status cactid
|
||||
```
|
||||
In that service, use `User=apache`, `Group=apache` and
|
||||
`ExecStart=/usr/bin/php /var/www/html/cacti/cactid.php`. The
|
||||
supplied service defaults to the Apache account and `/var/www/html/cacti`;
|
||||
Nginx installations must change both. The daemon manages local polling;
|
||||
it does not by itself provide high availability.
|
||||
|
||||
The systemd units file makes managing a highly available Cacti
|
||||
setup a bit more convenient.
|
||||
```console
|
||||
cp /var/www/html/cacti/service/cactid.service /etc/systemd/system/cactid.service
|
||||
vi /etc/systemd/system/cactid.service
|
||||
install -d -m 755 /etc/sysconfig
|
||||
touch /etc/sysconfig/cactid
|
||||
systemctl daemon-reload
|
||||
systemctl enable cactid.service
|
||||
systemctl start cactid.service
|
||||
systemctl status cactid.service
|
||||
```
|
||||
|
||||
#### Spine
|
||||
|
||||
1. Install the necessary packages to compile and install spine
|
||||
|
||||
For RHEL/CENTOS/ROCKY 8+, you must enable the powertools repo first before
|
||||
downloading the below packages
|
||||
On the legacy Rocky Linux 8 repository layout, build dependencies may
|
||||
require PowerTools. Repository names differ on other distributions; do not
|
||||
apply this command to every RHEL-compatible release.
|
||||
|
||||
```console
|
||||
yum config-manager --set-enabled powertools
|
||||
```
|
||||
|
||||
For RHEL/CENTOS/ROCKY 7.x and below
|
||||
Then install the build dependencies for your selected repository set:
|
||||
|
||||
```console
|
||||
yum install -y autoconf automake libtool dos2unix help2man \
|
||||
@@ -415,23 +412,19 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
cd /tmp
|
||||
wget https://www.cacti.net/downloads/spine/cacti-spine-1.y.z.tar.gz
|
||||
tar -zxvf cacti-spine-1.y.z.tar.gz
|
||||
cd cacti-spine-1.y.z
|
||||
wget https://www.cacti.net/downloads/spine/cacti-spine-1.2.31.tar.gz
|
||||
tar -zxvf cacti-spine-1.2.31.tar.gz
|
||||
cd cacti-spine-1.2.31
|
||||
```
|
||||
|
||||
3. Run the configure script and compile spine.
|
||||
3. This example uses the corresponding Spine 1.2.31 release. Prepare its
|
||||
build configuration, then configure and compile it.
|
||||
|
||||
```console
|
||||
# ./configure
|
||||
# make & make install
|
||||
config/install-sh -c -d '/usr/local/spine/bin'
|
||||
/bin/sh ./libtool --mode=install /usr/bin/install -c spine '/usr/local/spine/bin'
|
||||
libtool: install: /usr/bin/install -c spine /usr/local/spine/bin/spine
|
||||
config/install-sh -c -d '/usr/local/spine/etc'
|
||||
/usr/bin/install -c -m 644 spine.conf.dist '/usr/local/spine/etc'
|
||||
config/install-sh -c -d '/usr/local/spine/share/man/man1'
|
||||
/usr/bin/install -c -m 644 spine.1 '/usr/local/spine/share/man/man1'
|
||||
./bootstrap
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
4. Edit spine.conf
|
||||
@@ -447,7 +440,7 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
DB_Host localhost
|
||||
DB_Database your_cacti_database
|
||||
DB_Database cacti
|
||||
DB_User your_cacti_username
|
||||
DB_Pass your_cacti_password
|
||||
DB_Port 3306
|
||||
@@ -459,35 +452,27 @@ configure the basics for Cacti.
|
||||
|
||||
### Security Enhanced Linux (SELinux)
|
||||
|
||||
If you are having issues to access the web page, disable SELinux temporarily to
|
||||
prove that the issues come from the SELinux policy. It is NOT recommended to
|
||||
disable SELinux permanently.
|
||||
Keep SELinux enforcing. Inspect denials and file contexts rather than
|
||||
assuming a Unix ownership change is sufficient:
|
||||
|
||||
[CentOS](https:////wiki.centos.org/es/HowTos/SELinux) has a lot of
|
||||
documentation on how to make your SELinux policy right.
|
||||
```console
|
||||
getenforce
|
||||
ls -Zd /var/www/html/cacti /var/www/html/cacti/rra
|
||||
ausearch -m AVC -ts recent
|
||||
```
|
||||
|
||||
1. Check SELinux status
|
||||
|
||||
```console
|
||||
getenforce
|
||||
```
|
||||
|
||||
2. Disable SELinux temporarily
|
||||
|
||||
```console
|
||||
setenforce 0
|
||||
```
|
||||
|
||||
3. Enable SELinux back
|
||||
|
||||
```console
|
||||
setenforce 1
|
||||
```
|
||||
Apply the file labels and narrowly scoped policy settings required by your
|
||||
web server, writable directories and database connection. Consult the
|
||||
[Red Hat SELinux documentation][selinux-guide]; disabling SELinux is not a
|
||||
required installation step.
|
||||
|
||||
### Considerations when using Proxies in front of Cacti (Cacti 1.2.23+)
|
||||
|
||||
For optimal security, only specify the HTTP headers that are set by your proxy
|
||||
software to prevent unauthorized access.
|
||||
A header allowlist does not authenticate the proxy. Enable forwarded client-IP
|
||||
headers only when requests pass through a trusted proxy that replaces those
|
||||
headers and untrusted clients cannot bypass it to access Cacti directly.
|
||||
Otherwise, leave forwarded-header processing disabled. Select only the headers
|
||||
that the trusted proxy actually supplies.
|
||||
These can be set by editing the following section of config.php
|
||||
|
||||
```ini
|
||||
@@ -520,5 +505,8 @@ $proxy_headers = null;
|
||||
**Note:** If you installed Cacti out of `/var/www/html` make sure you fix up
|
||||
all SELinux context and permissions.
|
||||
|
||||
[innodb-variables]:<https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables>
|
||||
[selinux-guide]:<https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/using_selinux/index>
|
||||
|
||||
---
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
+166
-230
@@ -1,5 +1,15 @@
|
||||
# Installing on CentOS 7
|
||||
|
||||
This page retains examples from the CentOS 7/8 era. CentOS Linux 7 reached
|
||||
end of life on June 30, 2024, and CentOS Linux 8 on December 31, 2021; see the
|
||||
[CentOS lifecycle notice](https://www.centos.org/cl-vs-cs/). These examples are
|
||||
not a tested compatibility matrix for current RHEL or Rocky Linux releases.
|
||||
Use a maintained operating system and a PHP version meeting
|
||||
[Requirements](Requirements.md), with repositories appropriate to that system.
|
||||
Run administrative commands as root and adapt paths and service accounts to
|
||||
the actual installation. Do not use the legacy PHP streams below as a new
|
||||
server recommendation.
|
||||
|
||||
## LEMP (Linux, Nginx, MySQL, PHP) Required packages
|
||||
|
||||
### Web Server
|
||||
@@ -30,116 +40,67 @@ files holding your certificate (`.crt`) and private key (`.key`).
|
||||
```
|
||||
|
||||
```console
|
||||
# Advanced config for NGINX
|
||||
#server_tokens off;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
|
||||
# Redirect all HTTP traffic to HTTPS
|
||||
# Serve Cacti at https://cacti.yourdomain.com/cacti/.
|
||||
server {
|
||||
listen 80;
|
||||
server_name cacti.yourdomain.com; #No one likes unencrypted web servers
|
||||
#return 301 https://$host$request_uri; # some nginx do not support 'return';
|
||||
server_name cacti.yourdomain.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
# SSL configuration
|
||||
server {
|
||||
listen 443 ssl default deferred;
|
||||
listen 443 ssl;
|
||||
server_name cacti.yourdomain.com;
|
||||
root /usr/share/nginx/html/cacti;
|
||||
index index.php index.html index.htm;
|
||||
root /usr/share/nginx/html;
|
||||
index index.php index.html;
|
||||
|
||||
# Compression increases performance0
|
||||
gzip on;
|
||||
gzip_types text/plain text/html text/xml text/css application/xml application/javascript application/x-javascript application/rss+xml application/xhtml+xml;
|
||||
gzip_proxied no-cache no-store private expired auth;
|
||||
gzip_min_length 1000;
|
||||
ssl_certificate /etc/ssl/certs/YourOwnCertFile.crt;
|
||||
ssl_certificate_key /etc/ssl/private/YourOwnCertKey.key;
|
||||
ssl_protocols TLSv1.2;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$query_string;
|
||||
location = / {
|
||||
return 302 /cacti/;
|
||||
}
|
||||
location = /cacti {
|
||||
return 301 /cacti/;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html/;
|
||||
# Nginx does not process Apache .htaccess files.
|
||||
location ~ (^|/)\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
alias /usr/share/nginx/html/cacti;
|
||||
index index.php
|
||||
try_files $uri $uri/ =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
||||
# you may have to change the path here for your OS
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
location ~ ^/cacti/(cli|contrib|log|mibs|rra|scripts|service)/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /cacti {
|
||||
root /usr/share/nginx/html/;
|
||||
index index.php index.html index.htm;
|
||||
location ~ ^/cacti/(.+\.php)$ {
|
||||
try_files $uri =404;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# you may have to change the path here for your OS
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
}
|
||||
|
||||
location ~* ^/cacti/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
|
||||
expires max;
|
||||
log_not_found off;
|
||||
}
|
||||
location ~ ^/cacti/cache/(boost|mibcache|realtime|spikekill)/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /doc/ {
|
||||
alias /usr/share/nginx/html/cacti/doc/;
|
||||
location ~* ^/docs/(.+\.(html|md|txt))$ {
|
||||
root /usr/share/nginx/html/cacti/;
|
||||
autoindex on;
|
||||
allow 127.0.0.1; # Change this to allow your local networks
|
||||
allow ::1;
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
location /cacti/rra/ {
|
||||
location ~ ^/cacti/include/(config(_local)?\.php|vendor/.*\.php) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
## Access and error logs.
|
||||
location ~ ^/cacti/(.+\.php)$ {
|
||||
try_files $uri =404;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
}
|
||||
location /cacti/ {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
access_log /var/log/nginx/cacti_access.log;
|
||||
error_log /var/log/nginx/cacti_error.log info;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/YourOwnCertFile.crt;
|
||||
ssl_certificate_key /etc/ssl/private/YourOwnCertKey.key;
|
||||
|
||||
# Improve HTTPS performance with session resumption
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
# Enable server-side protection against BEAST attacks
|
||||
#ssl_prefer_server_ciphers on;
|
||||
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
|
||||
|
||||
# Disable SSLv3
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
|
||||
# Diffie-Hellman parameter for DHE cipher suites
|
||||
# $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
|
||||
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
||||
|
||||
# Enable HSTS (https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security)
|
||||
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
|
||||
error_log /var/log/nginx/cacti_error.log;
|
||||
}
|
||||
```
|
||||
|
||||
The socket must match the PHP-FPM pool configured below. Adjust the TLS
|
||||
configuration for the maintained OS and web-server versions you actually use;
|
||||
this legacy example is not a current TLS compatibility matrix. Validate the
|
||||
configuration with `nginx -t` before reloading Nginx. Keep the private-path
|
||||
rules before the PHP handler; static files such as the CSRF JavaScript and
|
||||
flag icons under `include/vendor` must remain accessible.
|
||||
|
||||
### Database Server
|
||||
|
||||
The choice between MySQL server and MariaDB is normally down to the OS
|
||||
@@ -169,10 +130,11 @@ a drop-in alternative until there is a major divergence that can not be bridged.
|
||||
|
||||
#### MariaDB
|
||||
|
||||
1. Install MariaDB server
|
||||
1. Install the distribution MariaDB packages (package names differ when using
|
||||
the MariaDB vendor repository).
|
||||
|
||||
```console
|
||||
yum install -y MariaDB-server MariaDB-client
|
||||
yum install -y mariadb-server mariadb
|
||||
```
|
||||
|
||||
2. Enable and start the service to ensure it starts when the system reboots
|
||||
@@ -200,56 +162,25 @@ during the installation.
|
||||
vim /etc/my.cnf.d/server.cnf
|
||||
```
|
||||
|
||||
The following `[mysqld]` section is a base configuration. The installer will
|
||||
provide recommendations based on the actual system which will be more
|
||||
tailored to your environment.
|
||||
Keep the database vendor's configuration defaults unless the installer and
|
||||
workload justify a change. A minimal character-set example is:
|
||||
|
||||
If using MariaDB less than version 11.1 or MySQL use the settings below.
|
||||
Note that you should revise up or down your settings depending on
|
||||
the Cacti recommendation that you see once you start the installer.
|
||||
|
||||
```shell
|
||||
```ini
|
||||
[mysqld]
|
||||
character_set_client = utf8mb4
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
innodb_file_format = Barracuda
|
||||
max_allowed_packet = 16777777
|
||||
max_heap_table_size = 500M
|
||||
join_buffer_size = 32M
|
||||
innodb_file_per_table = ON
|
||||
innodb_large_prefix = 1
|
||||
innodb_buffer_pool_size = 500M
|
||||
innodb_additional_mem_pool_size = 90M
|
||||
innodb_flush_log_at_trx_commit = 2
|
||||
log-error = /var/log/mysql/mysql-error.log
|
||||
log-queries-not-using-indexes = 1
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /var/log/mysql/mysql-slow.log
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
```
|
||||
|
||||
If using MariaDB 11.0 or higher, use the settings below:
|
||||
Buffer sizes depend on available memory and workload. Do not copy obsolete
|
||||
InnoDB options or disable doublewrite protection as a general tuning step;
|
||||
consult the [MariaDB InnoDB variable reference][innodb-variables] for the
|
||||
installed version.
|
||||
|
||||
```shell
|
||||
[mariadb]
|
||||
character_set_client = utf8mb4
|
||||
character_set_server = utf8mb4
|
||||
collation_server = utf8mb4_unicode_ci
|
||||
max_heap_table_size = 500M
|
||||
join_buffer_size = 32M
|
||||
innodb_buffer_pool_size = 8G
|
||||
innodb_doublewrite = OFF
|
||||
tmp_table_size = 500M
|
||||
log-error = /var/log/mysql/mysql-error.log
|
||||
log-queries-not-using-indexes = 1
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /var/log/mysql/mysql-slow.log
|
||||
```
|
||||
|
||||
2. Restart MySQL/MariaDB service to pick up the changes
|
||||
2. Restart the service actually installed (`mariadb` for the MariaDB example,
|
||||
or `mysqld` for the MySQL example):
|
||||
|
||||
```console
|
||||
systemctl restart mysql
|
||||
systemctl restart mariadb
|
||||
```
|
||||
|
||||
3. Populate timezone table with available timezones
|
||||
@@ -260,45 +191,25 @@ during the installation.
|
||||
|
||||
#### Setup Cacti database
|
||||
|
||||
1. Login to MySQL/MariaDB as root to create Cacti database
|
||||
Connect using the database administrator's authentication method:
|
||||
|
||||
```console
|
||||
# mysql -u root -p
|
||||
MariaDB [(none)]> create database if not exists cacti;
|
||||
Query OK, 1 row affected (0.00 sec)
|
||||
```
|
||||
```console
|
||||
mysql -u root -p
|
||||
```
|
||||
|
||||
2. Import Cacti database from SQL file
|
||||
Create a new database and account. Replace the username and password below,
|
||||
and use those same values in Cacti's configuration. Do not apply this
|
||||
fresh-install procedure to an existing Cacti database.
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> use cacti;
|
||||
Database changed
|
||||
MariaDB [(cacti)]> source /var/www/html/cacti/cacti.sql
|
||||
```
|
||||
```sql
|
||||
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'your_cacti_username'@'localhost' IDENTIFIED BY 'your_cacti_password';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'your_cacti_username'@'localhost';
|
||||
GRANT SELECT ON mysql.time_zone_name TO 'your_cacti_username'@'localhost';
|
||||
EXIT;
|
||||
```
|
||||
|
||||
3. Grant Cacti username access to Cacti database. Replace `your_cacti_username`
|
||||
and `your_cacti_password` with your own details.
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cacti.* TO 'your_cacti_username'@'localhost' IDENTIFIED BY 'your_cacti_password';
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
```
|
||||
|
||||
4. Grant cacti username to MySQL timezone table
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO 'cacti'@'localhost';
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
```
|
||||
|
||||
5. Save the Database Charset and Collation
|
||||
|
||||
```sql
|
||||
MariaDB [(none)]> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
The schema import occurs below, after the Cacti archive has been extracted.
|
||||
|
||||
### Common PHP packages
|
||||
|
||||
@@ -345,7 +256,7 @@ Note: **php-fpm** is only required if your Web Server is Nginx
|
||||
|
||||
2. Edit `/etc/php-fpm.d/www.conf`
|
||||
|
||||
Find `listen = 127.0.0.1:9000` and add the following line below
|
||||
Replace the existing `listen` setting; do not leave two active settings:
|
||||
|
||||
```console
|
||||
listen = /var/run/php-fpm/php-fpm.sock
|
||||
@@ -386,11 +297,12 @@ SNMP is used to query most devices for information.
|
||||
|
||||
```console
|
||||
yum install -y net-snmp net-snmp-utils
|
||||
echo "rocommunity public" > /etc/snmp/snmpd.conf
|
||||
systemctl enable snmpd
|
||||
systemctl start snmpd
|
||||
```
|
||||
|
||||
Install and enable `snmpd` only if this host also needs to expose an SNMP
|
||||
agent. Configure credentials and an appropriate access view before starting
|
||||
it; polling remote devices does not require a local SNMP agent.
|
||||
|
||||
### Cacti
|
||||
|
||||
The following steps will show you how to manually download, install and
|
||||
@@ -401,15 +313,22 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
cd /tmp
|
||||
wget https://www.cacti.net/downloads/cacti-1.y.z.tar.gz
|
||||
tar -zxvf cacti-1.y.z.tar.gz
|
||||
mv -v cacti-1.y.z /usr/share/nginx/html/cacti
|
||||
wget https://www.cacti.net/downloads/cacti-1.2.31.tar.gz
|
||||
tar -zxvf cacti-1.2.31.tar.gz
|
||||
mv -v cacti-1.2.31 /usr/share/nginx/html/cacti
|
||||
```
|
||||
|
||||
Import the schema into the new `cacti` database created above. Do not run
|
||||
this fresh-install import against an existing Cacti database.
|
||||
|
||||
```console
|
||||
mysql -u root -p cacti < /usr/share/nginx/html/cacti/cacti.sql
|
||||
```
|
||||
|
||||
2. Edit the config.php file
|
||||
|
||||
```console
|
||||
mv -v /usr/share/nginx/html/cacti/include/config.php-dist /usr/share/nginx/html/cacti/include/config.php
|
||||
cp /usr/share/nginx/html/cacti/include/config.php.dist /usr/share/nginx/html/cacti/include/config.php
|
||||
```
|
||||
|
||||
3. Update database\_ fields with your own details. This section only applies to
|
||||
@@ -417,7 +336,7 @@ configure the basics for Cacti.
|
||||
|
||||
```php
|
||||
$database_type = 'mysql';
|
||||
$database_default = 'your_cacti_database';
|
||||
$database_default = 'cacti';
|
||||
$database_hostname = 'localhost';
|
||||
$database_username = 'your_cacti_username';
|
||||
$database_password = 'your_cacti_password';
|
||||
@@ -428,42 +347,74 @@ configure the basics for Cacti.
|
||||
$database_ssl_ca = '';
|
||||
```
|
||||
|
||||
4. Set your cookie domain to match your web site domain name
|
||||
4. Keep the URL path consistent with the Nginx `/cacti/` location:
|
||||
|
||||
```php
|
||||
$url_path = '/cacti/';
|
||||
```
|
||||
|
||||
Keep code owned by the administrator. Allow the web/poller account to read
|
||||
the configuration and write only the runtime directories:
|
||||
|
||||
```console
|
||||
$cacti_cookie_domain = 'cacti.yourdomain.com';
|
||||
chown root:nginx /usr/share/nginx/html/cacti/include/config.php
|
||||
chmod 640 /usr/share/nginx/html/cacti/include/config.php
|
||||
chown -R nginx:nginx /usr/share/nginx/html/cacti/rra /usr/share/nginx/html/cacti/log /usr/share/nginx/html/cacti/cache
|
||||
chmod -R u+rwX,go-rwx /usr/share/nginx/html/cacti/rra /usr/share/nginx/html/cacti/log /usr/share/nginx/html/cacti/cache
|
||||
```
|
||||
|
||||
The installer can additionally request temporary write access to its
|
||||
`resource` query directories, `scripts`, and the CSRF-secret location.
|
||||
Grant only the requested access during installation/package import and
|
||||
remove it afterwards. Keep SELinux permissions in mind as well.
|
||||
Restrict installer access to the administrator and use HTTPS or a protected
|
||||
local connection before entering credentials. For a freshly imported
|
||||
1.2.31 schema, sign in with application username `admin` and initial
|
||||
password `admin`, then choose a unique administrator password when
|
||||
prompted. These are separate from the database credentials. Complete the
|
||||
web installer before starting scheduled polling or allowing general access.
|
||||
|
||||
5. Create your cron task file or systemd units file
|
||||
|
||||
Starting with Cacti 1.2.16, you have the option to use either the legacy
|
||||
Crontab entry, or an optional cactid units file and server to run your Cacti
|
||||
pollers.
|
||||
Before using the supplied `Type=forking` systemd unit, confirm that the PHP
|
||||
CLI used by the unit provides `pcntl_fork`. For example,
|
||||
`/usr/bin/php -r 'var_dump(function_exists("pcntl_fork"));'` should report
|
||||
`bool(true)`. Otherwise use cron or install the appropriate PCNTL support.
|
||||
|
||||
Choose either cron or the daemon, not both. Cacti 1.2.16 and later include
|
||||
an optional `cactid.service` for running the polling daemon. Match the
|
||||
schedule to the configured **Cron/Daemon Interval** in Settings > Poller;
|
||||
this can differ from the shorter data-source polling interval.
|
||||
|
||||
For Crontab use, follow the instructions below:
|
||||
|
||||
Create and edit `/etc/cron.d/cacti` file. Make sure to setup the correct path
|
||||
to poller.php
|
||||
Create `/etc/cron.d/cacti` as root with mode `644`. Use the installation
|
||||
path and PHP CLI binary appropriate to this host.
|
||||
|
||||
```console
|
||||
*/5 * * * * nginx php /var/www/html/cacti/poller.php &>/dev/null
|
||||
*/5 * * * * nginx /usr/bin/php /usr/share/nginx/html/cacti/poller.php >/dev/null 2>&1
|
||||
```
|
||||
|
||||
For systemd unit's file install, you will need to modify the included units
|
||||
file to following your install location and desired user and group's to run
|
||||
the Cacti poller as. To complete the task, follow the procedure below:
|
||||
|
||||
```console
|
||||
vim /var/www/html/cacti/service/cactid.service (edit the path)
|
||||
touch /etc/sysconfig/cactid
|
||||
cp -p /var/www/html/cacti/service/cactid.service /etc/systemd/system
|
||||
systemctl enable cactid
|
||||
systemctl start cactid
|
||||
systemctl status cactid
|
||||
```
|
||||
In that service, use `User=nginx`, `Group=nginx` and
|
||||
`ExecStart=/usr/bin/php /usr/share/nginx/html/cacti/cactid.php`. The
|
||||
supplied service defaults to the Apache account and `/var/www/html/cacti`;
|
||||
Nginx installations must change both. The daemon manages local polling;
|
||||
it does not by itself provide high availability.
|
||||
|
||||
The systemd units file makes managing a highly available Cacti setup a bit
|
||||
more convenient.
|
||||
```console
|
||||
cp /usr/share/nginx/html/cacti/service/cactid.service /etc/systemd/system/cactid.service
|
||||
vi /etc/systemd/system/cactid.service
|
||||
install -d -m 755 /etc/sysconfig
|
||||
touch /etc/sysconfig/cactid
|
||||
systemctl daemon-reload
|
||||
systemctl enable cactid.service
|
||||
systemctl start cactid.service
|
||||
systemctl status cactid.service
|
||||
```
|
||||
|
||||
#### Spine
|
||||
|
||||
@@ -481,23 +432,19 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
cd /tmp
|
||||
wget https://www.cacti.net/downloads/spine/cacti-spine-1.y.z.tar.gz
|
||||
tar -zxvf cacti-spine-1.y.z.tar.gz
|
||||
cd cacti-spine-1.y.z
|
||||
wget https://www.cacti.net/downloads/spine/cacti-spine-1.2.31.tar.gz
|
||||
tar -zxvf cacti-spine-1.2.31.tar.gz
|
||||
cd cacti-spine-1.2.31
|
||||
```
|
||||
|
||||
3. Run the configure script and compile spine.
|
||||
3. This example uses the corresponding Spine 1.2.31 release. Prepare its
|
||||
build configuration, then configure and compile it.
|
||||
|
||||
```console
|
||||
# ./configure
|
||||
# make & make install
|
||||
config/install-sh -c -d '/usr/local/spine/bin'
|
||||
/bin/sh ./libtool --mode=install /usr/bin/install -c spine '/usr/local/spine/bin'
|
||||
libtool: install: /usr/bin/install -c spine /usr/local/spine/bin/spine
|
||||
config/install-sh -c -d '/usr/local/spine/etc'
|
||||
/usr/bin/install -c -m 644 spine.conf.dist '/usr/local/spine/etc'
|
||||
config/install-sh -c -d '/usr/local/spine/share/man/man1'
|
||||
/usr/bin/install -c -m 644 spine.1 '/usr/local/spine/share/man/man1'
|
||||
./bootstrap
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
4. Edit spine.conf
|
||||
@@ -513,7 +460,7 @@ configure the basics for Cacti.
|
||||
|
||||
```console
|
||||
DB_Host localhost
|
||||
DB_Database your_cacti_database
|
||||
DB_Database cacti
|
||||
DB_User your_cacti_username
|
||||
DB_Pass your_cacti_password
|
||||
DB_Port 3306
|
||||
@@ -525,30 +472,19 @@ configure the basics for Cacti.
|
||||
|
||||
### Security Enhanced Linux (SELinux)
|
||||
|
||||
If you are having issues to access the web page, disable SELinux temporarily to
|
||||
prove that the issues come from the SELinux policy. It is NOT recommended to
|
||||
disable SELinux permanently.
|
||||
|
||||
[CentOS](https:////wiki.centos.org/es/HowTos/SELinux) has a lot of documentation
|
||||
on how to make your SELinux policy right.
|
||||
|
||||
Check SELinux status
|
||||
Keep SELinux enforcing. Inspect denials and file contexts rather than
|
||||
assuming a Unix ownership change is sufficient:
|
||||
|
||||
```console
|
||||
getenforce
|
||||
ls -Zd /usr/share/nginx/html/cacti /usr/share/nginx/html/cacti/rra
|
||||
ausearch -m AVC -ts recent
|
||||
```
|
||||
|
||||
Disable SELinux temporarily
|
||||
|
||||
```console
|
||||
setenforce 0
|
||||
```
|
||||
|
||||
Enable SELinux back
|
||||
|
||||
```console
|
||||
setenforce 1
|
||||
```
|
||||
Apply the file labels and narrowly scoped policy settings required by your
|
||||
web server, writable directories and database connection. Consult the
|
||||
[Red Hat SELinux documentation][selinux-guide]; disabling SELinux is not a
|
||||
required installation step.
|
||||
|
||||
**Note:** If you installed Cacti out of `/usr/share/nginx/html` make sure you
|
||||
fix up all SELinux context and permissions.
|
||||
|
||||
@@ -1,127 +1,174 @@
|
||||
# Installing Cacti 1.x in Ubuntu/Debian LAMP stack
|
||||
# Installing Cacti 1.2 on Ubuntu or Debian with Apache
|
||||
|
||||
## Installing the required packages needed for the LAMP stack
|
||||
This is a source-install example for Cacti 1.2.31, not a tested distribution
|
||||
matrix. Use a maintained distribution and check its PHP version against
|
||||
[Requirements](Requirements.md) before
|
||||
installing packages. Run the administrative commands below as root. The
|
||||
example uses `/var/www/html/cacti` and the default Debian/Ubuntu web account,
|
||||
`www-data`; adjust both if your web-server setup differs.
|
||||
|
||||
## Install the required packages
|
||||
|
||||
The unversioned PHP package names select the distribution's configured PHP
|
||||
version. Do not mix extensions from different PHP versions.
|
||||
|
||||
```console
|
||||
apt-get update
|
||||
apt-get install -y apache2 rrdtool mariadb-server snmp snmpd php8.0 php8.0-mysql php8.0-snmp php8.0-xml php8.0-mbstring php8.0-json php8.0-gd php8.0-gmp php8.0-zip php8.0-ldap php8.0-mbstring
|
||||
apt-get install -y apache2 libapache2-mod-php mariadb-server rrdtool snmp git cron \
|
||||
php-cli php-mysql php-snmp php-xml php-mbstring php-gd php-gmp php-zip php-ldap php-intl
|
||||
systemctl enable --now apache2 mariadb cron
|
||||
```
|
||||
|
||||
### A special note for systems using PHP-FPM
|
||||
If using PHP-FPM instead of the Apache PHP module, configure Apache's FPM
|
||||
integration and use the installed FPM pool's account. FPM service names are
|
||||
versioned on Debian/Ubuntu; inspect them with
|
||||
`systemctl list-unit-files 'php*-fpm.service'` and restart the actual unit after
|
||||
configuration changes. Do not assume a service named `php-fpm` exists.
|
||||
|
||||
Prior to starting the setup process of Cacti you should restart the PHP-FPM
|
||||
Daemon to rebuild the Cache or you may received a HTTP 500 Error
|
||||
## Download the Cacti source
|
||||
|
||||
The release tag below fixes the version used by this example. The `1.2.x` branch
|
||||
can contain changes made after the release.
|
||||
|
||||
```console
|
||||
systemctl restart php-fpm
|
||||
git clone --branch release/1.2.31 --depth 1 https://github.com/Cacti/cacti.git cacti
|
||||
mv cacti /var/www/html/cacti
|
||||
```
|
||||
|
||||
### Downloading the Cacti software
|
||||
Do not overwrite an existing installation with these fresh-install commands.
|
||||
|
||||
Once the OS packages are installed, you will need to download the Cacti files
|
||||
you can do this by using the git command
|
||||
## Create the database
|
||||
|
||||
```console
|
||||
git clone -b 1.2.x https://github.com/Cacti/cacti.git
|
||||
Cloning into 'cacti'...
|
||||
remote: Enumerating objects: 81, done.
|
||||
remote: Counting objects: 100% (81/81), done.
|
||||
remote: Compressing objects: 100% (55/55), done.
|
||||
remote: Total 59936 (delta 40), reused 51 (delta 26), pack-reused 59855&
|
||||
Receiving objects: 100% (59936/59936), 76.33 MiB | 1.81 MiB/s, done.
|
||||
Resolving deltas: 100% (43598/43598), done.
|
||||
```
|
||||
|
||||
After cloning the Cacti repository, move the files into the /var/www/html
|
||||
directory
|
||||
|
||||
```console
|
||||
mv cacti /var/www/html
|
||||
```
|
||||
|
||||
#### Database Creation
|
||||
|
||||
Next we will create a database for the cacti installation to use
|
||||
Choose a unique database password and replace the example placeholder in both
|
||||
the SQL and `include/config.php`. Connect using your database administrator's
|
||||
authentication method; the example below prompts for a password.
|
||||
|
||||
```console
|
||||
mysql -u root -p
|
||||
CREATE DATABASE cacti DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
|
||||
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';
|
||||
GRANT ALL ON cacti.* TO 'cactiuser'@'localhost';
|
||||
```
|
||||
|
||||
```sql
|
||||
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'replace-with-a-unique-password';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
|
||||
GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';
|
||||
ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
FLUSH PRIVILEGES;
|
||||
EXIT;
|
||||
```
|
||||
|
||||
You will now need to pre-populate the database used by cacti
|
||||
Load the system timezone data and the schema into this new database. A MariaDB
|
||||
installation may provide `mariadb-tzinfo-to-sql` as the timezone utility's name.
|
||||
|
||||
```console
|
||||
mysql -u root cacti < /var/www/html/cacti/cacti.sql
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
|
||||
mysql -u root -p cacti < /var/www/html/cacti/cacti.sql
|
||||
```
|
||||
|
||||
Next, you will need to create the config.php file in /var/www/html/cacti/include
|
||||
## Configure Cacti and filesystem permissions
|
||||
|
||||
Copy the distributed configuration example; do not rename or delete it.
|
||||
|
||||
```console
|
||||
cd /var/www/html/cacti/include
|
||||
cp config.php.dist config.php
|
||||
cp /var/www/html/cacti/include/config.php.dist /var/www/html/cacti/include/config.php
|
||||
```
|
||||
|
||||
Now, edit the config.php file and make sure to change the database settings as
|
||||
needed to match the below entries (though it is highly recommended to use a
|
||||
customised username/password combination for security)
|
||||
Edit the database fields to match the account and database created above:
|
||||
|
||||
```console
|
||||
```php
|
||||
$database_type = 'mysql';
|
||||
$database_default = 'cacti';
|
||||
$database_hostname = 'localhost';
|
||||
$database_username = 'cactiuser';
|
||||
$database_password = 'cactiuser';
|
||||
$database_password = 'replace-with-a-unique-password';
|
||||
$database_port = '3306';
|
||||
$database_retries = 5;
|
||||
$database_ssl = false;
|
||||
$database_ssl_key = '';
|
||||
```
|
||||
|
||||
### Create your cron task file or systemd units file
|
||||
|
||||
Starting with Cacti 1.2.16, you have the option to use either the
|
||||
legacy Crontab entry, or an optional cactid units file and server
|
||||
to run your Cacti pollers.
|
||||
|
||||
For Crontab use, follow the instructions below:
|
||||
|
||||
Create and edit `/etc/cron.d/cacti` file.
|
||||
Make sure to setup the correct path to poller.php
|
||||
Keep application code owned by the administrator. The web and poller accounts
|
||||
must be able to read the configuration and write the runtime directories:
|
||||
|
||||
```console
|
||||
*/5 * * * * apache php /var/www/html/cacti/poller.php &>/dev/null
|
||||
chown root:www-data /var/www/html/cacti/include/config.php
|
||||
chmod 640 /var/www/html/cacti/include/config.php
|
||||
chown -R www-data:www-data /var/www/html/cacti/rra /var/www/html/cacti/log /var/www/html/cacti/cache
|
||||
chmod -R u+rwX,go-rwx /var/www/html/cacti/rra /var/www/html/cacti/log /var/www/html/cacti/cache
|
||||
```
|
||||
|
||||
For systemd unit's file install, you will need to modify the
|
||||
included units file to following your install location
|
||||
and desired user and group's to run the Cacti poller as.
|
||||
To complete the task, follow the procedure below:
|
||||
During installation or package import, the installer also checks write access
|
||||
to `resource/snmp_queries`, `resource/script_server`, `resource/script_queries`
|
||||
and `scripts`, and the location used to create the CSRF secret. Grant only the
|
||||
additional access requested by the installer and remove that temporary access
|
||||
afterwards. Do not make the entire application tree world-writable.
|
||||
|
||||
Restrict installer access to the administrator. Configure HTTPS or use a
|
||||
protected local connection before entering credentials, then browse to
|
||||
`/cacti/`. For a freshly imported 1.2.31 schema, sign in with application
|
||||
username `admin` and initial password `admin`, then choose a unique
|
||||
administrator password when prompted. These are separate from the database
|
||||
credentials. Complete the web installer before starting scheduled polling or
|
||||
allowing general access.
|
||||
|
||||
## Schedule polling
|
||||
|
||||
Choose either cron or `cactid.service`, not both. Complete the web installer
|
||||
before starting the selected scheduler. The example cron interval is five
|
||||
minutes; match the **Cron/Daemon Interval** in Settings > Poller. This is
|
||||
separate from the data-source polling interval, which can be shorter.
|
||||
|
||||
### Cron
|
||||
|
||||
Create `/etc/cron.d/cacti` as root, with mode `644`, and include this line:
|
||||
|
||||
```console
|
||||
vim /var/www/html/cacti/service/cactid.service (edit the path)
|
||||
touch /etc/sysconfig/cactid
|
||||
cp -p /var/www/html/cacti/service/cactid.service /etc/systemd/system
|
||||
systemctl enable cactid
|
||||
systemctl start cactid
|
||||
systemctl status cactid
|
||||
*/5 * * * * www-data /usr/bin/php /var/www/html/cacti/poller.php >/dev/null 2>&1
|
||||
```
|
||||
|
||||
The systemd units file makes managing a highly available Cacti
|
||||
setup a bit more convenient.
|
||||
This is a system cron file, so the username field is required. Use an absolute
|
||||
PHP CLI path and POSIX shell redirection; Debian cron uses `/bin/sh` by default.
|
||||
See [Debian crontab format][crontab-format].
|
||||
|
||||
The system is now ready to finialise the steps by browsing to
|
||||
[http://serverip/cacti](http://serverip/cacti) to start the cacti initialization
|
||||
wizard.
|
||||
### systemd
|
||||
|
||||
The supplied unit uses `Type=forking`, so the selected PHP CLI must provide
|
||||
`pcntl_fork`. Check `/usr/bin/php -r 'var_dump(function_exists("pcntl_fork"));'`
|
||||
for `bool(true)` before using this example. If fork support is unavailable,
|
||||
use cron or install the appropriate PCNTL support for that PHP CLI.
|
||||
|
||||
Copy the supplied service and edit the installed copy:
|
||||
|
||||
```console
|
||||
cp /var/www/html/cacti/service/cactid.service /etc/systemd/system/cactid.service
|
||||
```
|
||||
|
||||
Replace its existing `User`, `Group`, `EnvironmentFile` and `ExecStart` entries
|
||||
with the following, retaining the other service settings:
|
||||
|
||||
```ini
|
||||
User=www-data
|
||||
Group=www-data
|
||||
EnvironmentFile=-/etc/default/cactid
|
||||
ExecStart=/usr/bin/php /var/www/html/cacti/cactid.php
|
||||
```
|
||||
|
||||
The leading `-` makes the optional environment file unnecessary if you do not
|
||||
use one. After completing the installer, load and start the service:
|
||||
|
||||
```console
|
||||
systemctl daemon-reload
|
||||
systemctl enable cactid.service
|
||||
systemctl start cactid.service
|
||||
systemctl status cactid.service
|
||||
```
|
||||
|
||||
The service manages the local polling daemon; it does not by itself provide
|
||||
high availability. Verify the poller log and newly created graphs after
|
||||
starting the selected scheduler.
|
||||
|
||||
### Considerations when using Proxys in front of Cacti (Cacti 1.2.23+)
|
||||
|
||||
For optimal security, only specify the HTTP headers that are set by your proxy
|
||||
software to prevent unauthorized access.
|
||||
A header allowlist does not authenticate the proxy. Enable forwarded client-IP
|
||||
headers only when requests pass through a trusted proxy that replaces those
|
||||
headers and untrusted clients cannot bypass it to access Cacti directly.
|
||||
Otherwise, leave forwarded-header processing disabled. Select only the headers
|
||||
that the trusted proxy actually supplies.
|
||||
These can be set by editing the following section of config.php
|
||||
|
||||
```ini
|
||||
@@ -151,5 +198,7 @@ These can be set by editing the following section of config.php
|
||||
$proxy_headers = null;
|
||||
```
|
||||
|
||||
[crontab-format]:<https://manpages.debian.org/bookworm/cron/crontab.5.en.html>
|
||||
|
||||
---
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
+319
-409
@@ -1,437 +1,347 @@
|
||||
# Installing Under Windows
|
||||
|
||||
BSOD2600, one of the long term users of Cacti, provides an Installer on Windows.
|
||||
We recommend you use that installer for Cacti. You can obtain that installer
|
||||
under the Windows section of the Cacti forums. However, if you wish to install
|
||||
Cacti yourself, please follow the instructions below.
|
||||
|
||||
1. (Optional) Apache - This software is optional if running Windows Internet
|
||||
Information Server.
|
||||
|
||||
2. Cacti - Install from the zip distribution and install in the web root or your
|
||||
choice. Many choose to install into a `Cacti` sub folder.
|
||||
|
||||
3. Spine - Install from the zip distribution into the `c:\cacti` directory.
|
||||
Make sure your `spine.conf.dist` is located in that directory as well.
|
||||
|
||||
4. RRDtool - Install from the Cacti website. Install it into the `c:\cacti`
|
||||
directory.
|
||||
|
||||
5. PHP X - Install into the `c:\php` folder. If you choose to install into
|
||||
`c:\Program Files\php`, you will have to use 8.3 filenames to reference it's
|
||||
binaries in Cacti.
|
||||
|
||||
6. MySQL 8.x or MariaDB 10.5.x++ - Install into the default locations.
|
||||
This is typically for MySQL:
|
||||
|
||||
`c:\Program Files\MySQL\MySQL Server X.XX`.
|
||||
|
||||
For MariaDB it is normally:
|
||||
|
||||
`c:\Program Files\MariaDB`.
|
||||
|
||||
After the Database is confirmed running, follow the steps to setup the
|
||||
correct settings to InnoDB in the `my.ini` file which include the following:
|
||||
|
||||
```
|
||||
[mysqld]
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
max_heap_table_size = 770M # Adjust for your OS memory size
|
||||
max_allowed_packet = 500M # Adjust for your OS memory size
|
||||
tmp_table_size = 512M # Adjust for your OS memory size
|
||||
join_buffer_size = 256M # Adjust for your OS memory size
|
||||
sort_buffer_size = 200M # Adjust for your OS memory size
|
||||
|
||||
# important for compatibility
|
||||
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
|
||||
|
||||
innodb_flush_log_at_trx_commit = 2
|
||||
innodb_flush_log_at_timeout = 3
|
||||
innodb_file_per_table = ON
|
||||
|
||||
innodb_buffer_pool_size = 4500M # Adjust for your OS memory size
|
||||
|
||||
# for very large indexes
|
||||
innodb_file_format = Barracuda
|
||||
innodb_large_prefix = 1
|
||||
|
||||
# for SSD's on a 64 core server
|
||||
innodb_doublewrite = OFF
|
||||
innodb_read_io_threads = 32
|
||||
innodb_write_io_threads = 16
|
||||
innodb_io_capacity = 10000
|
||||
innodb_io_capacity_max = 20000
|
||||
innodb_flush_method = O_DIRECT
|
||||
```
|
||||
|
||||
Restart MariaDB/MySQL after applying these settings. Once you start the install
|
||||
Cacti will recommend better values.
|
||||
|
||||
Ensure you write down your MariaDB/MySQL root password for later use. Keep
|
||||
a backup copy of it safe.
|
||||
|
||||
7. (Optional) Cygwin - Download and execute `setup-x86_64.exe` from the Cygwin website.
|
||||
Keep the `setup-x86_64.exe` file for later use. You will need Cygwin and its
|
||||
development packages for building RRDtool and spine.
|
||||
|
||||
8. (Optional) Net-SNMP - Install to the `c:\usr` directory. If you choose to
|
||||
use `c:\Program Files\net-snmp` you will have to use 8.3 filenames to
|
||||
reference its binaries in Cacti. The default installation location for Net-SNMP
|
||||
on Windows is `c:\usr` where closely aligns with Linux and Unix install paths.
|
||||
|
||||
## Common OS Changes
|
||||
|
||||
The following changes will be required regardless of your selected Webserver.
|
||||
|
||||
1. Add the following directory to the existing Windows System `PATH` environment
|
||||
variable: `c:\php`. The Windows path can be accessed via the Control Panel at:
|
||||
System -> Advanced -> Environment Variables -> System Variables.
|
||||
|
||||
2. Add the following directory to a new Windows System environment variable
|
||||
called `PHPRC`: `c:\php`.
|
||||
|
||||
3. Add a new Windows System environment variable called `MIBDIRS` set it to
|
||||
`c:\php\extrasmibs`
|
||||
|
||||
4. Rename the file `c:\php\php.ini.dist` to `php.ini`, and make the following
|
||||
changes to it:
|
||||
|
||||
Uncomment the following lines. You will need more modules. The Cacti
|
||||
install process will guide you through this process.
|
||||
|
||||
```ini
|
||||
extension_dir = c:\php\ext
|
||||
extension=php_mysql.dll
|
||||
extension=php_snmp.dll
|
||||
extension=php_sockets.dll
|
||||
cgi.force_redirect = 0
|
||||
date.time_zone = America/Detroit
|
||||
memory_limit = 800M
|
||||
max_execution_time = 300
|
||||
```
|
||||
|
||||
5. In earlier installation guides to PHP, they recommended moving certain DLL's
|
||||
to the `c:\winnt\system32` directory. If so, you will have to remove those
|
||||
files. Please review the PHP installation documentation for instructions on
|
||||
removing those files.
|
||||
|
||||
6. If you want to allow template importing, uncomment the following line:
|
||||
|
||||
```ini
|
||||
file_uploads = On
|
||||
```
|
||||
|
||||
7. Give the user who will be running the scheduled task, modify rights to the
|
||||
`.index` file in the location pointed to by the `MIBDIRS` Windows System
|
||||
environment variable.
|
||||
|
||||
## Web Server Configuration
|
||||
|
||||
1. Make sure you have stopped any IIS web servers before you proceed with Apache
|
||||
installation, or make sure Apache is configured on an alternate port.
|
||||
|
||||
2. If using Apache 2.x and PHP 8, then add the following lines. The values will
|
||||
change depending on your version of PHP and Apache.
|
||||
|
||||
```ini
|
||||
LoadModule php_module "C:\php\php8apache2_4.dll"
|
||||
AddHandler application/x-httpd-php .php
|
||||
AddType application/x-httpd-php .php
|
||||
DirectoryIndex index.html index.htm index.php
|
||||
PHPIniDir "C:\php"
|
||||
```
|
||||
|
||||
## IIS Specific Steps
|
||||
|
||||
1. Start the Internet Information Services (IIS) Manager, right click on the
|
||||
Default Web Site (in most cases) and select Properties.
|
||||
|
||||
2. Under the Home Directory tab, select Configuration and click Add. Browse to
|
||||
the path of `php8isapi.dll`, and type in .php as the
|
||||
extension. Note: if using IIS6, Enable All Verbs and Script Engine.
|
||||
|
||||
3. Under the ISAPI Filters tab, click Add and browse to the `php8isapi.dll`
|
||||
file. Name the filter "php" and click OK.
|
||||
|
||||
5. Under the Documents tab, add `index.php` to the list.
|
||||
|
||||
6. If using IIS6, goto Web Service Extensions and add a new Web Service
|
||||
Extension. Name the extension "php", and click Add and browse to the
|
||||
`php8isapi.dll` file, enable Set Extension status to
|
||||
Enable, and click OK.
|
||||
|
||||
7. Give the IIS user read & execute permissions to the required files
|
||||
file `%windir%\system32\cmd.exe`. They will also need read permissions on
|
||||
`cacti_web_root/cacti` and it's subfolders.
|
||||
A anm example provided by one user included the following assuming the
|
||||
Cacti web root is `C:\inetpub\wwwroot\cacti`:
|
||||
|
||||
```
|
||||
icacls "C:\windows\system32\cmd.exe" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\resource\snmp_queries" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\resource\script_server" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\scripts" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\rra" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\log" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\cache" /grant "IUSR:(OI)(CI)(RX,W)"
|
||||
icacls "C:\inetpub\wwwroot\cacti\include\config.php" /grant "IUSR:(RX,W)"
|
||||
copy /b NUL "C:\inetpub\wwwroot\cacti\include\vendor\csrf\csrf-secret.php"
|
||||
icacls "C:\inetpub\wwwroot\cacti\include\vendor\csrf\csrf-secret.php" /grant "IUSR:(RX,W)"
|
||||
```
|
||||
|
||||
8. Completely stop and start the IIS service using the following commands:
|
||||
|
||||
```batchfile
|
||||
net stop iisadmin
|
||||
net start w3svc
|
||||
```
|
||||
|
||||
## Cygwin Installation Steps for spine and RRDtool
|
||||
|
||||
1. Installing a single instance of Cygwin, and using it for all applications
|
||||
that require it is recommended so you do not have different versions of the
|
||||
Cygwin dlls laying around on your system, which can cause conflicts.
|
||||
|
||||
2. Run `setup-x86_64.exe` you previously download.
|
||||
|
||||
3. Once you reach the portion of setup entitled Select Packages, install the
|
||||
following noting that the versions numbers may have changed:
|
||||
|
||||
- Base (include all items)
|
||||
- Libs
|
||||
- libcairo2
|
||||
- libcrypt0
|
||||
- libfontconfig-common
|
||||
- libfontconfig1
|
||||
- libfreetype6
|
||||
- libgcrypt20
|
||||
- libgd3
|
||||
- libglib2.0_0
|
||||
- libmariadb3
|
||||
- libssl1.0
|
||||
- libpango1.0_0
|
||||
- libpng16
|
||||
- libreadline7
|
||||
- zlib-devel
|
||||
- zlib0
|
||||
- Devel
|
||||
- autoconf
|
||||
- automake
|
||||
- binutils
|
||||
- clang
|
||||
- cygwin-devel
|
||||
- gcc-core
|
||||
- gcc-g++
|
||||
- libmariadb-devel
|
||||
- help2man
|
||||
- libargp
|
||||
- libltdl7
|
||||
- libtool
|
||||
- net-snmp-devel
|
||||
- patch
|
||||
- texinfo
|
||||
- w32api-headers
|
||||
- w32api-runtime
|
||||
- windows-default-manifest
|
||||
- Web
|
||||
- wget
|
||||
|
||||
4. Add `c:\cygwin\bin` to your Windows System PATH environment variable.
|
||||
|
||||
5. Move `setup-x86_64.exe` to `c:cygwin` for future use. This binary
|
||||
is updated from time to time, so it's recommended that you update it
|
||||
periodically.
|
||||
|
||||
## RRDtool Download and Installation Instructions
|
||||
|
||||
1. You can obtain Windows compatible versions for RRDtool at https://rrdtool.org.
|
||||
Install them into C:\rrdtool directory.
|
||||
|
||||
2. Create the MariaDB/MySQL database:
|
||||
|
||||
```sh
|
||||
shell> mysqladmin --user=root --password create cacti
|
||||
```
|
||||
|
||||
3. Import the default Cacti database:
|
||||
|
||||
```sh
|
||||
shell> mysql --user=root --password cacti < c:\apache2\htdocs\cacti\cacti.sql
|
||||
```
|
||||
|
||||
4. Create a MySQL username and password for Cacti.
|
||||
|
||||
```sh
|
||||
shell> mysql --user=root --password mysql
|
||||
```
|
||||
|
||||
```sql
|
||||
MySQL> CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';
|
||||
MySQL> GRANT ALL ON cacti.* TO 'cactiuser'@'localhost';
|
||||
MySQL> GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';
|
||||
MySQL> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
MySQL> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
## Net-SNMP Installation
|
||||
|
||||
1. If you plan to use any hosts with SNMP v2c support, and are using early
|
||||
versions of PHP, you must download and install the Net-SNMP libraries.
|
||||
Net-SNMP provides installers to install their product. However, caution must
|
||||
be taken if you choose to use long file names as Cacti does not see them as
|
||||
long file names. You will have to user 8.3 notation.
|
||||
|
||||
Type | Name
|
||||
--- | ---
|
||||
Original | `c:\Program Files\Net-SNMP\bin`
|
||||
Becomes | `c:\progra~1\net-snmp\bin`.
|
||||
|
||||
## Cacti spine Installation
|
||||
|
||||
1. Extract the Spine zip file to `c:\spine` and modify the `spine.conf.dist`
|
||||
file to include the following statements.
|
||||
|
||||
```ini
|
||||
DB_Host 127.0.0.1 or hostname (not localhost)
|
||||
DB_Database cacti
|
||||
DB_User cactiuser
|
||||
DB_Password cactiuser
|
||||
DB_Port 3306
|
||||
```
|
||||
|
||||
All other pre 0.8.6 settings are obsolete.
|
||||
|
||||
2. Spine now comes with a binary distribution. However, we strongly suggest that
|
||||
you install Cygwin and then remove all the DLL files and `sh.exe` from the
|
||||
`c:\spine` directory. If you simply downloaded all the Cygwin components and
|
||||
compiled spine from source, the only two files you will require in the
|
||||
`c:\spine` directory will be `spine.exe` itself and `spine.conf`.
|
||||
|
||||
## Finishing your Setup
|
||||
|
||||
1. Edit `cacti_web_root/cacti/include/config.php` and specify the MariaDB/MySQL user,
|
||||
password, database, and database port for your Cacti configuration.
|
||||
These instructions describe a manual installation of Cacti 1.2.31 on Windows.
|
||||
Use the [requirements](Requirements.md) for your Cacti release and supported
|
||||
Windows builds of PHP, your database server and RRDtool. Community Windows
|
||||
installers are also discussed in the [Cacti forums](https://forums.cacti.net/);
|
||||
check their included versions and maintenance status before using them.
|
||||
|
||||
The examples use `C:\inetpub\wwwroot\cacti` for Cacti, `C:\php` for PHP,
|
||||
`C:\rrdtool` for RRDtool and `C:\spine` for optional Spine. Substitute your
|
||||
actual paths throughout. Use a dedicated Windows account for the poller and a
|
||||
separate web-server identity. Install software and configure services as an
|
||||
administrator; the poller does not normally need administrator privileges.
|
||||
|
||||
## Install the software
|
||||
|
||||
1. Choose IIS or Apache and install only the web server you intend to use on
|
||||
the selected address and port.
|
||||
|
||||
2. Extract the Cacti ZIP distribution into the chosen web directory.
|
||||
|
||||
3. Install PHP and its required runtime libraries using the
|
||||
[PHP Windows installation instructions][php-windows]. Match the architecture
|
||||
and build type to your web-server integration. Use a Non-Thread-Safe build
|
||||
for IIS FastCGI; an Apache module requires a compatible Thread-Safe build.
|
||||
A path without spaces, such as `C:\php`, simplifies tool configuration.
|
||||
|
||||
4. Install a Windows build of [RRDtool](https://oss.oetiker.ch/rrdtool/) and
|
||||
verify its runtime dependencies. If using Spine, install a compatible
|
||||
[Spine release](Spine.md) and the dependencies supplied or required by that
|
||||
build. The PHP poller can be used without Spine.
|
||||
|
||||
5. Install MySQL or MariaDB. Use the server's supported Windows configuration
|
||||
and service-management instructions. Start with its documented defaults,
|
||||
then review the Cacti installer's checks for your actual server and
|
||||
workload.
|
||||
|
||||
Do not copy a tuning block from a different database version or operating
|
||||
system. MySQL 8 removed `NO_AUTO_CREATE_USER`, `innodb_file_format` and
|
||||
`innodb_large_prefix`; these settings can prevent startup. Do not disable
|
||||
InnoDB doublewrite protection or reduce commit durability as an installation
|
||||
shortcut. Size global and per-connection buffers for the available memory
|
||||
and expected concurrency.
|
||||
|
||||
6. Install Net-SNMP command-line tools if your collection configuration needs
|
||||
them, for example into `C:\usr`. Cacti 1.2.31 uses these tools for SNMPv3
|
||||
requests from the web interface and PHP poller; PHP's SNMP extension alone
|
||||
does not provide that collection path. Verify the installed executable paths
|
||||
instead of assuming a particular short filename or installation directory.
|
||||
|
||||
## Configure PHP
|
||||
|
||||
Copy `php.ini-production` from the PHP distribution to `C:\php\php.ini`.
|
||||
Set the timezone for your installation and enable the required extensions.
|
||||
For current PHP Windows builds, an example configuration is:
|
||||
|
||||
```ini
|
||||
extension_dir = "C:\php\ext"
|
||||
extension=pdo_mysql
|
||||
extension=gd
|
||||
extension=gmp
|
||||
extension=intl
|
||||
extension=ldap
|
||||
extension=mbstring
|
||||
extension=openssl
|
||||
extension=sockets
|
||||
extension=com_dotnet
|
||||
; Enable if using PHP's SNMP extension:
|
||||
extension=snmp
|
||||
|
||||
date.timezone = America/Detroit
|
||||
file_uploads = On
|
||||
```
|
||||
|
||||
Use only extensions supplied for the selected PHP build and install their
|
||||
required DLL dependencies according to PHP's instructions. Some modules are
|
||||
built in. The Cacti installer checks additional modules, including SimpleXML,
|
||||
XML and zlib, in both the web and command-line environments. `pdo_mysql` is the
|
||||
database driver Cacti uses; the removed `php_mysql.dll` is not a substitute.
|
||||
Set memory and execution limits using the installer recommendations for your
|
||||
installation rather than copying values sized for another server.
|
||||
|
||||
Check the command-line configuration before configuring the web server:
|
||||
|
||||
```console
|
||||
C:\php\php.exe --ini
|
||||
C:\php\php.exe -m
|
||||
```
|
||||
|
||||
Set `PHPRC` to `C:\php` for the web-server and poller environments if needed to
|
||||
select this configuration. An absolute path to `php.exe` avoids depending on
|
||||
`PATH` for scheduled tasks. Ensure required DLLs are discoverable by both
|
||||
identities; do not copy PHP DLLs into Windows system directories.
|
||||
|
||||
If loading external MIBs, set `MIBDIRS` to their actual directory and allow the
|
||||
collecting account to update the Net-SNMP index/cache there if needed. This is
|
||||
separate from permission to modify executable files.
|
||||
|
||||
After changing PHP configuration, recycle the application pool or restart the
|
||||
selected web-server service. Confirm the Cacti installer reports the expected
|
||||
configuration and modules for both web PHP and CLI PHP.
|
||||
|
||||
## Configure the web server
|
||||
|
||||
### IIS with FastCGI
|
||||
|
||||
Follow the [PHP IIS instructions][php-iis] and Microsoft's
|
||||
[FastCGI configuration reference][iis-fastcgi].
|
||||
|
||||
1. Enable the IIS CGI role service, which supplies FastCGI support.
|
||||
|
||||
2. Create the Cacti site/application and a dedicated application pool. Match
|
||||
the pool architecture to PHP. In Handler Mappings, map `*.php` through
|
||||
`FastCgiModule` to `C:\php\php-cgi.exe`, not `php.exe`. Use the corresponding
|
||||
FastCGI application entry and allow script execution for the application.
|
||||
PHP 8 does not provide `php8isapi.dll`; do not configure an ISAPI filter.
|
||||
|
||||
3. Add `index.php` to the site's Default Document list. Apply the PHP CGI
|
||||
settings required by the PHP IIS guide, including `cgi.force_redirect=0`
|
||||
for IIS. Configure authentication/impersonation deliberately so the account
|
||||
accessing Cacti files is known.
|
||||
|
||||
4. Configure an HTTPS binding and restrict access during installation. Recycle
|
||||
the affected application pool after configuration changes.
|
||||
|
||||
### Apache
|
||||
|
||||
Follow the [PHP Apache instructions][php-apache] for a matching Apache/PHP
|
||||
build. For Apache 2.4 with a compatible PHP 8 Thread-Safe module, the relevant
|
||||
configuration is:
|
||||
|
||||
```apache
|
||||
LoadModule php_module "C:/php/php8apache2_4.dll"
|
||||
<FilesMatch "\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
DirectoryIndex index.php index.html
|
||||
PHPIniDir "C:/php"
|
||||
```
|
||||
|
||||
Check Apache's configuration before restarting its service. If using FastCGI
|
||||
instead of the Apache module, follow that integration's PHP instructions and
|
||||
use the appropriate PHP build.
|
||||
|
||||
## File permissions
|
||||
|
||||
Identify the effective web identity and the scheduled-task account before
|
||||
setting ACLs. For IIS, this may be `IIS AppPool\Cacti` for a pool named `Cacti`,
|
||||
or another account selected by authentication and FastCGI impersonation.
|
||||
See Microsoft's [application-pool identity guidance][iis-identity]. Do not
|
||||
assume the account is always `IUSR`.
|
||||
|
||||
Give the web and poller identities read access to Cacti's code and
|
||||
configuration, and read/execute access to PHP, RRDtool, SNMP and optional
|
||||
Spine programs and their dependencies. If PHP requires `cmd.exe` to launch
|
||||
a command, allow only the necessary read/execute access. Do not grant
|
||||
either identity write access to Windows system executables or to tool
|
||||
installation directories.
|
||||
|
||||
The poller needs Modify permission on `rra` and `log` and on the cache
|
||||
subdirectories it uses. The web identity also needs Modify permission on
|
||||
`log`, its configured temporary/session directories and the Cacti cache
|
||||
subdirectories used by features such as real-time graphs. Use the
|
||||
installer's permission checks to identify the required paths, including
|
||||
`cache/boost`, `cache/mibcache`, `cache/realtime` and `cache/spikekill`.
|
||||
Grant access only to the identities and paths that need it, accounting for
|
||||
inherited ACLs.
|
||||
|
||||
During installation or signed-package imports, Cacti also needs to write
|
||||
queries and scripts under `resource/snmp_queries`,
|
||||
`resource/script_server`, `resource/script_queries` and `scripts`. Grant
|
||||
temporary Modify access to the identity performing that operation, then
|
||||
remove it when finished. The installer also needs to initialize a nonempty
|
||||
CSRF secret, by default `include/vendor/csrf/csrf-secret.php`. Allow
|
||||
creation in its containing directory during setup, then retain read access
|
||||
to the generated secret and remove the temporary directory write
|
||||
permission. Do not create an empty placeholder secret.
|
||||
|
||||
Edit `include/config.php` as an administrator. Keep it readable by the web and
|
||||
poller identities but not writable by them for ordinary operation. If a
|
||||
specific installation operation needs to update it, grant temporary write
|
||||
access for that operation and remove it afterward.
|
||||
|
||||
## Create the database
|
||||
|
||||
The following commands are for **Command Prompt**, not PowerShell. Use the
|
||||
actual path to `mysql.exe` or the equivalent MariaDB client if it is not on
|
||||
`PATH`. The `--password` option prompts for the database administrator's
|
||||
password; do not put that password on the command line.
|
||||
|
||||
```console
|
||||
mysql --user=root --password
|
||||
```
|
||||
|
||||
Create an empty database and a dedicated application account. Replace
|
||||
`REPLACE_WITH_UNIQUE_DATABASE_PASSWORD` with a unique secret before executing
|
||||
this SQL. The example account and connection use TCP loopback consistently.
|
||||
|
||||
```sql
|
||||
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'cacti_user'@'127.0.0.1'
|
||||
IDENTIFIED BY 'REPLACE_WITH_UNIQUE_DATABASE_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti_user'@'127.0.0.1';
|
||||
GRANT SELECT ON mysql.time_zone_name TO 'cacti_user'@'127.0.0.1';
|
||||
```
|
||||
|
||||
Exit the SQL client and import the schema from the same Cacti release you
|
||||
extracted:
|
||||
|
||||
```console
|
||||
mysql --user=root --password --default-character-set=utf8mb4 cacti < "C:\inetpub\wwwroot\cacti\cacti.sql"
|
||||
```
|
||||
|
||||
Ensure the server's time-zone tables are populated using its documented Windows
|
||||
procedure. Granting access to an empty `mysql.time_zone_name` table does not
|
||||
populate it. Resolve the database and time-zone checks reported by the Cacti
|
||||
installer before completing installation.
|
||||
|
||||
## Optional Cygwin and Spine configuration
|
||||
|
||||
If your Spine or RRDtool build depends on Cygwin, install the runtime packages
|
||||
required by that build using the official
|
||||
[Cygwin installer](https://cygwin.com/).
|
||||
For a source build, follow the release's build instructions and select its
|
||||
current compiler/development dependencies. Do not replace or delete DLLs
|
||||
shipped with a binary distribution without checking that distribution's
|
||||
requirements. Avoid mixing incompatible Cygwin runtimes.
|
||||
|
||||
For Spine, copy `spine.conf.dist` to `spine.conf` and set the connection details
|
||||
to match Cacti. Replace the password placeholder with the same application
|
||||
secret used above, not a sample password:
|
||||
|
||||
```ini
|
||||
DB_Host 127.0.0.1
|
||||
DB_Database cacti
|
||||
DB_User cacti_user
|
||||
DB_Pass REPLACE_WITH_UNIQUE_DATABASE_PASSWORD
|
||||
DB_Port 3306
|
||||
```
|
||||
|
||||
Restrict access to `spine.conf` to administrators and the poller account.
|
||||
Verify Spine from that account before selecting it as the poller in Cacti.
|
||||
|
||||
## Finish the Cacti installation
|
||||
|
||||
1. Copy `include/config.php.dist` to `include/config.php` and set its database
|
||||
connection. Replace the password placeholder with your application secret:
|
||||
|
||||
```php
|
||||
$database_default = "cacti";
|
||||
$database_hostname = "localhost";
|
||||
$database_username = "cactiuser";
|
||||
$database_password = "cactiuser";
|
||||
$database_port = "3306";
|
||||
$database_default = 'cacti';
|
||||
$database_hostname = '127.0.0.1';
|
||||
$database_username = 'cacti_user';
|
||||
$database_password = 'REPLACE_WITH_UNIQUE_DATABASE_PASSWORD';
|
||||
$database_port = '3306';
|
||||
$url_path = '/cacti/';
|
||||
```
|
||||
|
||||
2. Point your web browser to:
|
||||
Adjust `$url_path` if Cacti is served at another URL path.
|
||||
|
||||
`http://your-server/cacti/`
|
||||
2. Open the Cacti URL through HTTPS. For a freshly imported 1.2.31 schema,
|
||||
sign in with application username `admin` and initial password `admin`,
|
||||
then choose a unique administrator password when prompted. These are
|
||||
separate from the database credentials. Complete the installer and resolve
|
||||
its dependency, database, path and permission checks before allowing
|
||||
general access.
|
||||
|
||||
Log in using the username and password of admin/admin. You will be required
|
||||
to change this password immediately.
|
||||
3. In **Console > Configuration > Settings > Paths**, verify the executable
|
||||
paths against your installation. For the example layout:
|
||||
|
||||
3. From Cacti, go to Settings -> Paths and verify/update your paths to point to
|
||||
the correct locations. Recommended examples are posted below. If you plan on
|
||||
using Spine, then it is very important that all paths include forward slashes
|
||||
instead of backslashes.
|
||||
| Setting | Example |
|
||||
| --- | --- |
|
||||
| PHP binary | `C:/php/php.exe` |
|
||||
| RRDtool | `C:/rrdtool/rrdtool.exe` |
|
||||
| SNMP tools, if used | `C:/usr/bin/snmpget.exe`, `snmpwalk.exe`, `snmpbulkwalk.exe`, `snmpgetnext.exe` |
|
||||
| Cacti log | `C:/inetpub/wwwroot/cacti/log/cacti.log` |
|
||||
| Spine, if used | `C:/spine/spine.exe` |
|
||||
|
||||
- PHP Binary Path:
|
||||
Use the CLI PHP executable here, not the IIS FastCGI executable. Verify the
|
||||
separate Spine configuration path if selecting Spine.
|
||||
|
||||
`c:/php/php.exe`
|
||||
4. Create devices and graphs deliberately, or configure discovery and automation
|
||||
rules for the intended network. Installing Cacti does not establish that
|
||||
every discovered device exposes all measurements in its selected template.
|
||||
|
||||
- RRDtool Binary Path:
|
||||
## Schedule and verify the poller
|
||||
|
||||
`c:/rrdtool/rrdtool.exe`
|
||||
Log on as the intended poller account and test the same executable and paths
|
||||
that the task will use:
|
||||
|
||||
- SNMPGET, SNMPWALK, SNMPBULKWALK, SNMPGETNEXT Paths:
|
||||
```console
|
||||
C:\php\php.exe -q C:\inetpub\wwwroot\cacti\poller.php
|
||||
```
|
||||
|
||||
`c:/usr/bin/snmpget.exe`
|
||||
`c:/usr/bin/snmpwalk.exe`
|
||||
`c:/usr/bin/snmpbulkwalk.exe`
|
||||
`c:/usr/bin/snmpgetnext.exe`
|
||||
Check `log/cacti.log`, data-source polling and graph updates. RRD files are
|
||||
created for configured data sources; an installation without graphs need not
|
||||
create them. Resolve permission and configuration errors before scheduling.
|
||||
|
||||
- Cacti Logfile Path:
|
||||
Open **Task Scheduler** and choose **Create Task**:
|
||||
|
||||
`c:/mycacti/website/cacti/log/cacti.log`
|
||||
1. Select the dedicated poller account and **Run whether user is logged on or
|
||||
not**, with the account rights needed for batch logon. Do not enable
|
||||
**Run with highest privileges** unless a documented local requirement needs
|
||||
it.
|
||||
|
||||
- Spine Path:
|
||||
2. Add a daily trigger that repeats every **5 minutes** indefinitely for the
|
||||
default five-minute scheduler configuration. If changing Cacti's scheduler
|
||||
interval, adjust this trigger to match it; the scheduler interval and data
|
||||
source polling intervals are separate settings.
|
||||
|
||||
`c:/spine/spine.exe`
|
||||
3. Add a **Start a program** action with these separate fields:
|
||||
|
||||
4. If you chose automation, once the Cacti poller starts, it will create
|
||||
any compatible devices found on the network using the snmp settings
|
||||
and default automation rules. These are tuned specifically for Linux
|
||||
Cisco and Windows devices by default. A Localhost device will automatically
|
||||
be created for you at install time.
|
||||
|
||||
5. Log into the user account you'll be using for the scheduled task and verify
|
||||
starting a Cacti polling cycle works. Do this by running the following from
|
||||
the command prompt:
|
||||
- **Program/script:** `C:\php\php.exe`
|
||||
- **Add arguments:** `-q "C:\inetpub\wwwroot\cacti\poller.php"`
|
||||
- **Start in:** `C:\inetpub\wwwroot\cacti`
|
||||
|
||||
```sh
|
||||
php c:/cacti_web_root/cacti/poller.php
|
||||
```
|
||||
4. Under **Settings**, choose **Do not start a new instance** if the task is
|
||||
already running. Review any task execution limit against the configured
|
||||
polling cycle; do not terminate a healthy poller prematurely.
|
||||
|
||||
The output should look something like the following:
|
||||
Run the task manually, then verify subsequent scheduled runs, Task Scheduler's
|
||||
result/history, Cacti's poller statistics and graph freshness. Recheck these
|
||||
under the task account after changing PHP, paths, credentials or ACLs.
|
||||
|
||||
```sh
|
||||
C:\>php c:inetpubwwwrootcactipoller.php
|
||||
OK u:0.00 s:0.06 r:1.32
|
||||
OK u:0.00 s:0.06 r:1.32
|
||||
OK u:0.00 s:0.16 r:2.59
|
||||
OK u:0.00 s:0.17 r:2.62
|
||||
10/28/2005 04:57:12 PM - SYSTEM STATS: Time:4.7272 Method:cmd.php Processes:1 Threads:N/A Hosts:1 HostsPerProcess:2 DataSources:4 RRDsProcessed:2
|
||||
```
|
||||
## References
|
||||
|
||||
After this has ran once, you should have `cacti.log` in `/cacti/log/` and
|
||||
RRDfiles in `/cacti/rra/`.
|
||||
- [Cacti 1.2.31 PHP dependency checks][cacti-extensions]
|
||||
- [Cacti 1.2.31 installation permission checks][cacti-permissions]
|
||||
- [PHP Windows installation][php-windows], [IIS][php-iis] and
|
||||
[Apache][php-apache]
|
||||
- [Microsoft FastCGI configuration][iis-fastcgi] and
|
||||
[application-pool identities][iis-identity]
|
||||
- [MySQL 8 removed features][mysql-removed]
|
||||
- [Microsoft Task Scheduler][task-scheduler]
|
||||
|
||||
6. You are going to need to schedule a task while logged on as an Administrator.
|
||||
This task is required so you can run `poller.php` every 5 minutes. Make sure
|
||||
the Task Scheduler service is started and follow the steps below to begin.
|
||||
|
||||
> **Note:** The following instructions are based on most Windows installs.
|
||||
|
||||
1. Select Start -> Settings -> Control Panel and double click on Scheduled
|
||||
Tasks.
|
||||
|
||||
2. Double click on Add Scheduled Task.
|
||||
|
||||
3. Click Next and Browse on the following screen. Find `c:php` and select
|
||||
`php.exe`. Choose Daily on and click Next.
|
||||
|
||||
4. Click Next again without changing the time or date settings.
|
||||
|
||||
5. In the steps above, you should have granted access to the Cacti user, but
|
||||
if the poller encounters problems, make sure you have the correct permissions
|
||||
to the directories below:
|
||||
|
||||
`cacti_web_root/cacti/rra`
|
||||
`cacti_web_root/log`
|
||||
|
||||
Make sure the user has read, write, and execute access to the following
|
||||
directories:
|
||||
|
||||
`c:\php`
|
||||
`c:\php\sapi`
|
||||
|
||||
6. Click Next and Finish to close the wizard.
|
||||
|
||||
7. Right click on the task you just created, and select Properties.
|
||||
|
||||
8. Select the Schedule tab.
|
||||
|
||||
9. Make sure Daily is selected and click the Advanced button.
|
||||
|
||||
10. Check the Repeat checkbox, set it for 5 minutes and set the duration for
|
||||
24 hours.
|
||||
|
||||
11. Click Ok
|
||||
|
||||
12. In the Run textbox enter the following text making sure to use the
|
||||
appropriate paths.
|
||||
|
||||
`c:\php\php.exe c:\mycacti\website\cacti\poller.php`
|
||||
|
||||
The start in box should say `c:\mycacti\website\cacti`.
|
||||
[php-windows]:<https://www.php.net/manual/en/install.windows.manual.php>
|
||||
[php-iis]:<https://www.php.net/manual/en/install.windows.iis.php>
|
||||
[php-apache]:<https://www.php.net/manual/en/install.windows.apache2.php>
|
||||
[iis-fastcgi]:<https://learn.microsoft.com/en-us/iis/configuration/system.webserver/fastcgi/>
|
||||
[iis-identity]:<https://learn.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities>
|
||||
[mysql-removed]:<https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html>
|
||||
[task-scheduler]:<https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page>
|
||||
[cacti-extensions]:<https://github.com/Cacti/cacti/blob/1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1/lib/utility.php#L1923>
|
||||
[cacti-permissions]:<https://github.com/Cacti/cacti/blob/1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1/lib/installer.php#L501>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
Reference in new issue
Block a user