Cacti Remote Poller Setup

Hello Everyone

I have always felt that some of the documentation for Cacti even though it has been around for so long has been lacking or at least not laid out nicely to follow.

One of those features that never seem to get a good writeup by is a big feature is the remote poller setup
As of cacti, 1.x cacti support remote polling which allows you to have multiple servers act as pollers the remote pollers send the data to the main server that holds the graphs
this is a great solution for load balancing as well as the ability to have local pollers at remote locations to help with things like latency metrics.

Take the below image, for instance, we have 2 remote pollers connected to the main poller. In this case, Poller 1 and Poller 2 are full cacti installations
but with the exception that the remote pollers don’t store the graphs locally instead, they send the data to the cacti the main poller which then generates the graphs

Each poller processes the SNMP/ICMP and other data sources traffic which helps with the load balancing now, of course, these are not redundant with the below design that would require

you to have the database replicate between a primary and a standby poller and other things not covered in this post.

the remote pollers only generate graphs if the SQL connection is broken.

 

 

cacti-remote-poller-diagram

 

Speaking of SQL connection the remote pollers must be able to talk to the main pollers SQL DB at all times to sync data between them

also, the main server will need to be able to write to the remote pollers database as well.

It is also highly recommended to use the spine poller on each of these servers which is much more scalable and can support many more devices than the PHP poller can.

Also by having remote pollers cacti boost will be enabled by default which will change how cacti update’s each graph file to offload system resources
this will have cacti update the graphs in a minimum of 30-minute intervals or on-demand when the user clicks the device the graphs will be updated which is more efficient for large installations.

 

The below assumes you have 3 servers with FULL cacti installations ready but have not gone through the setup wizard.

Let’s go over the configurations

Main server IP is 192.168.1.5
Remote poller 1 server IP is 192.168.1.10
Remote poller 2 servers Ip is 192.168.1.20

 

Let’s configure the database on the main server to accept connections from Poller 1 and Poller 2

The assumption is that you will be using the credentials for the Pollers as cacti and password cacti DO NOT DO THIS IN PRODUCTION!!!!!!

you would, of course, use a much stronger password

Main server database config

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'; ;

Remote poller 1 database configuration

GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.5' IDENTIFIED BY 'cacti'; ;

Remote poller 2 database configuration

GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'192.168.1.5' IDENTIFIED BY 'cacti'; ;

What we have just done is allowed the remote pollers to talk to the main server via a SQL connection

we have also let the main poller talk to the remote pollers to keep in sync

An important note you will also need to look out for the Mariadb/Mysql db connection limit on the main server you can edit this in the mariadb/mysql my.cnf file

You can see what that limit is currently set to by going to Console >> utilities >> System utilities >> Technical support

you will see below parameter

The left indicates my settings the right indicates Cacti’s recommended settings but of course you need to keep an eye and tune this for your needs

max_connections151>=100

for example you can change the limit to 500 by doing the following

sudo nano /etc/my.cnf
Add or change the below variable
max_connections=500

 

Spine poller configuration when using Multiple pollers

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

Be sure to remove the # next to the below entries

RDB_Host 192.168.1.5
RDB_Database cacti
RDB_User cacti
RDB_Pass cacti
RDB_Port 3306
#RDB_UseSSL 0
#RDB_SSL_Key
#RDB_SSL_Cert
#RDB_SSL_CA

 

Spine poller and max connections

Since in a multi poller setup Spine is highly recommended you will need to follow the following calculation when

That  calculation would be

Connections = Spine-processes x ( 1 + Threads-per-process  + PHP servers )

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 #

$rdatabase_type = 'mysql';
$rdatabase_default = 'cacti';
$rdatabase_hostname = '192.168.1.5;
$rdatabase_username = 'cacti';
$rdatabase_password = 'cacti';
$rdatabase_port = '3306';
$rdatabase_retries = 5;
$rdatabase_ssl = false;
$rdatabase_ssl_key = '';
$rdatabase_ssl_cert = '';
$rdatabase_ssl_ca = '';

Of course you will also need the local database config even on the remote pollers as they will require a local database as well to operate

once you have done this you can now go to the remote poller web installation wizard to finish off the installation by selecting remote poller as the installation type

 

A note on plugins

When using multiple pollers not all plugins are compatible so be sure to check out which plugins are compatible @ cacti.net

Current plugins known to work are Monitor,Thold,Intropage,Audit

 

You can also see my video below to see this in action

Cacti remote poller setup

 

 

 

Liked it? Take a second to support Sean Mancini on Patreon!

1 thought on “Cacti Remote Poller Setup

  1. Hello, I use the cacti built by nginx, but when setting up the remote poller, I always verify the error and can’t go to the next step. I think you can give me some help.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.