Master / Slave(s) patch for Cacti 0.8.7b

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

ldrolez
Posts: 9
Joined: Mon Nov 12, 2007 8:24 am

Master / Slave(s) patch for Cacti 0.8.7b

Post by ldrolez »

Hi !
Here's my simple modification to have a master / slave architecture. Just replace the original poller.php with the one below and:
1- install cacti on slave servers without the DB setup. Install the new poller.php also.
2- configure cacti to use the existing master mysql server. (and set-up mysql for remote TCP connections)
3- run 'poller.php --slave' in the cron, on slaves.
4- if a device should use a slave poller, simply add 'slave:theslavehostname' in the device's notes field.

Note that time sync between the master and the slaves is important so use NTP.

All suggestions are welcome ! Only a few dozen lines were modified for this first implementation, so it's not optimal regarding the current threads/processes launched by the poller. Anyway it works !

Ludovic.
Last edited by ldrolez on Thu Feb 21, 2008 9:28 am, edited 1 time in total.
ldrolez
Posts: 9
Joined: Mon Nov 12, 2007 8:24 am

Post by ldrolez »

Update: It seems to work better if the slave pollers are the last ones to run... Still investigating... (add a sleep 60 in your slave cron jobs).
ldrolez
Posts: 9
Joined: Mon Nov 12, 2007 8:24 am

Updated poller.php

Post by ldrolez »

Hi !

I've fixed the 'slaves must be last' bug. However, please note that the slaves should not run 'poller.php --slave', before the master, because the "poller_output" table would be cleared by the master.
So here is my crontab entry:
*/5 * * * * sleep 20;php /home/cacti-0.8.7b/poller.php --slave >/tmp/poller.log 2>&1

I've attached an updated version of poller.php and the patch fof Cacti 0.8.7b.

Cheers,

Ludo.
Attachments
poller.php.gz
(4.88 KiB) Downloaded 641 times
poller.php.patch.gz
(2.4 KiB) Downloaded 598 times
mia1dolfan
Posts: 18
Joined: Tue Oct 02, 2007 3:19 pm

Post by mia1dolfan »

Thank you for sharing your work! :D

I was thinking of trying your setup. My question does this setup create two sets of RRD files? If so, could I mount the rra directory as a nfs share? Do you think this would work with the boost plugin?
ldrolez
Posts: 9
Joined: Mon Nov 12, 2007 8:24 am

Post by ldrolez »

Hi !

The rrd files are on the 'master' Cacti server (as well as the database).

Since boost uses its own custom poller, I don't think that it would work. Anyway, my hack should also improve the performance, since polling scripts can be distributed on several hosts :-)

Cheers,

Ludovic.
User avatar
chrisgapske
Cacti User
Posts: 278
Joined: Tue May 22, 2007 7:56 am
Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL

Post by chrisgapske »

Can this be used in a way that you could have more than one slave ?
ldrolez
Posts: 9
Joined: Mon Nov 12, 2007 8:24 am

Post by ldrolez »

Yes it should work :-?
I only tested with one slave...
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

1) you realize this is being talked about to be implemented in the future, right? http://forums.cacti.net/viewtopic.php?t=24869

2) Consider submitting it to http://www.cacti.net/bugs.php
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Also, just to note, I have basically took the same concept and made a plugin using it. You can select a poller per device using a drop down menu. New slave Pollers automatically register themselves with the master. It also doesn't require any wierd stuff like making sure the master poller runs first. Doesn't work with boost though, as it actually uses a few of the same concepts (separate poller_output table).

I'm still working on a few minor things, but overall seems to work just fine.
super-hornet
Cacti User
Posts: 175
Joined: Sun May 27, 2007 5:42 pm

Post by super-hornet »

Hi cigamit

Is your plugin ready? I would like to test it on my side. Thinking of putting the slave on different country instead :)

SH
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Nope. There are some fundamental issues in Cacti that stop it from going prime time. Once I resolve those issues then I will release it.
SoftDux
Posts: 39
Joined: Thu Jun 19, 2008 9:24 am
Location: Johannesburg, South Africa
Contact:

Post by SoftDux »

Just out of curiosity, cigamit - what needs to change in Cacti for your script to work?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I'm trying to free up some of my rare personal time these days, evident by my absence on the forums, to remove the fundamental issues that prevent us from doing the remote pollers.

I have given this topic so much thought, I need to do the development, so I can make some room in my brain for other things :)

TheWitness
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?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

TheWitness wrote:I have given this topic so much thought, I need to do the development, so I can make some room in my brain for other things :)
I recommend Dumbledore's pensieve to ease this task :wink:
Reinhard
Frizz
Cacti User
Posts: 80
Joined: Sat Mar 05, 2005 5:07 pm
Location: Herne Germany

Post by Frizz »

TheWitness wrote:I'm trying to free up some of my rare personal time these days, evident by my absence on the forums, to remove the fundamental issues that prevent us from doing the remote pollers.

I have given this topic so much thought, I need to do the development, so I can make some room in my brain for other things :)

TheWitness
Take all the time you need, to achieve this milestone in the Cacti architecture.
Let's have a talk about your ideas at the 3.CCC.eu (via Skype) at the 11.october 2008.
We're all very curious.
regards
-Frizz
Cacti 0.8.6j | Cactid 0.8.6j | RRDtool 1.2.23 |
SuSe 9.x | PHP 4.4.4 | MySQL 5.0.27 | IHS 2.0.42.1
Come and join the 3.CCC.eu
http://forums.cacti.net/viewtopic.php?t=27908
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests