|
|
| Author |
Message |
ldrolez
Joined: 12 Nov 2007 Posts: 9
|
Posted: Wed Feb 20, 2008 10:26 am Post subject: Master / Slave(s) patch for Cacti 0.8.7b |
|
|
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
|
Posted: Wed Feb 20, 2008 11:29 am Post subject: |
|
|
| 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
|
Posted: Thu Feb 21, 2008 9:16 am Post subject: Updated poller.php |
|
|
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.
| Description: |
|
 Download |
| Filename: |
poller.php.patch.gz |
| Filesize: |
2.4 KB |
| Downloaded: |
130 Time(s) |
| Description: |
|
 Download |
| Filename: |
poller.php.gz |
| Filesize: |
4.88 KB |
| Downloaded: |
112 Time(s) |
|
|
| Back to top |
|
 |
mia1dolfan
Joined: 02 Oct 2007 Posts: 16
|
Posted: Thu Mar 06, 2008 2:56 pm Post subject: |
|
|
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
|
Posted: Wed Mar 12, 2008 6:16 am Post subject: |
|
|
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
|
Posted: Wed Mar 12, 2008 8:26 am Post subject: |
|
|
| 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
|
Posted: Wed Mar 12, 2008 11:41 am Post subject: |
|
|
Yes it should work
I only tested with one slave...
|
|
| Back to top |
|
 |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6599 Location: WA, USA
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 895 Location: B/CS Texas
|
Posted: Sat Mar 22, 2008 9:21 pm Post subject: |
|
|
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: 144
|
Posted: Mon Jun 16, 2008 1:29 am Post subject: |
|
|
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 |
|
 |
|