Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Master / Slave(s) patch for Cacti 0.8.7b

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
ldrolez



Joined: 12 Nov 2007
Posts: 9

PostPosted: Wed Feb 20, 2008 10:26 am    Post subject: Master / Slave(s) patch for Cacti 0.8.7b Reply with quote

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
Back to top
ldrolez



Joined: 12 Nov 2007
Posts: 9

PostPosted: Wed Feb 20, 2008 11:29 am    Post subject: Reply with quote

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).
Back to top
ldrolez



Joined: 12 Nov 2007
Posts: 9

PostPosted: Thu Feb 21, 2008 9:16 am    Post subject: Updated poller.php Reply with quote

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.



poller.php.patch.gz
 Description:

Download
 Filename:  poller.php.patch.gz
 Filesize:  2.4 KB
 Downloaded:  127 Time(s)


poller.php.gz
 Description:

Download
 Filename:  poller.php.gz
 Filesize:  4.88 KB
 Downloaded:  108 Time(s)

Back to top
mia1dolfan



Joined: 02 Oct 2007
Posts: 16

PostPosted: Thu Mar 06, 2008 2:56 pm    Post subject: Reply with quote

Thank you for sharing your work!

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?
Back to top
ldrolez



Joined: 12 Nov 2007
Posts: 9

PostPosted: Wed Mar 12, 2008 6:16 am    Post subject: Reply with quote

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.
Back to top
chrisgapske
Cacti User


Joined: 22 May 2007
Posts: 263
Location: Padacuh, Ky-Alpena, MI-Gulf Shores,AL

PostPosted: Wed Mar 12, 2008 8:26 am    Post subject: Reply with quote

Can this be used in a way that you could have more than one slave ?
Back to top
ldrolez



Joined: 12 Nov 2007
Posts: 9

PostPosted: Wed Mar 12, 2008 11:41 am    Post subject: Reply with quote

Yes it should work
I only tested with one slave...
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6568
Location: WA, USA

PostPosted: Wed Mar 12, 2008 1:17 pm    Post subject: Reply with quote

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
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 894
Location: B/CS Texas

PostPosted: Sat Mar 22, 2008 9:21 pm    Post subject: Reply with quote

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.
Back to top
super-hornet
Cacti User


Joined: 27 May 2007
Posts: 143

PostPosted: Mon Jun 16, 2008 1:29 am    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group