Remote Poller Automation/Install Process?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Remote Poller Automation/Install Process?

Post by smcline06 »

Wondering what Cacti does under the hood when accepting or installing a remote poller? I would like to tweak some docker containers and have the ability to self-install a remote poller w/o needing to log into the web UI and click buttons for things to start working if possible.
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Remote Poller Automation/Install Process?

Post by TheWitness »

Good question. The poller self registers in the installer, that could be automated pretty easily using a small modification to the install_cacti.php script. You should consider a pull request. It basically involves the following:

1) verify that that RDB* stuff is un-commented in the config.php
2) finding your hostname, and then looking for it in the poller table on the main database.
3) If there, set your poller_id to the id that is already registered and continue installation
4) If it's not there, insert a record into the poller table, including connection details and then note the ID of the row in the poller table
5) place that entry into the config.php $poller_id variable.
6) complete the installation bypassing things like package install.

To get things fully working requires a grant on the main collector that requires super access in order to setup, so there would have to be a step to verify that the main data collector actually includes the grant. This could be facilitated by the remote_agent.php, which is essentially a mini web service for internal IPC (non-sql). Doing those grants has to be done by a super, so basically we would have to have some other callback to allow that grant work to be done, which is what makes it a little difficult.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
smcline06
Posts: 27
Joined: Mon Apr 22, 2013 1:30 pm

Re: Remote Poller Automation/Install Process?

Post by smcline06 »

Fantastic, thank you for the in depth response and next steps. Will see if I can throw something together and start the PR/Convo in GitHub (^_^)
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Remote Poller Automation/Install Process?

Post by netniV »

Technically, there is already a cli installer that should handle this if you tell it the install is a remote one. It is designed to perform all the operations that the GUI would do.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Remote Poller Automation/Install Process?

Post by phalek »

I have done something similiar with a Raspberry PI based Cacti Remote Poller :
- Setup a Complete Cacti on the PI
- Configure the config.php file completely with remote and local database settings
- Set the poller-id to something high ( e.g 999 )
- Run a script at boottime/cron that registers the new poller in the master system ( ID 999 -> New poller, register and retrieve new local poller id )
- Store the new poller id in the config.php file ( 999 becomes the new poller-id i.e. "2")

As my setup assumes the PI is using DHCP, the script also updates the IP address on the master system when it changes.

I've attached the script as a reference, maybe it helps.
Attachments
register_update_remotepoller.zip
(1.08 KiB) Downloaded 27 times
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests