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    


Handy Repopulate Poller Cache Script

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
TheWitness
Developer


Joined: 14 May 2002
Posts: 10805
Location: MI, USA

PostPosted: Thu Nov 10, 2005 8:59 pm    Post subject: Handy Repopulate Poller Cache Script Reply with quote

Hi,

I was asked to write a quick and dirty rebuild poller cache script and I tought I would share it for the rest of the community.

To use, extract to the <cacti_webroot> directory

type "php rebuild_poller_cache.php"

Watch it go.

TheWitness



rebuild_poller_cache.zip
 Description:

Download
 Filename:  rebuild_poller_cache.zip
 Filesize:  1.19 KB
 Downloaded:  2580 Time(s)

Back to top
drose12



Joined: 10 Mar 2005
Posts: 31

PostPosted: Thu Nov 10, 2005 9:02 pm    Post subject: Reply with quote

Thanks a bunch!
You do great work!
Back to top
N3NCY
Cacti User


Joined: 22 Sep 2005
Posts: 242
Location: Landenberg, PA

PostPosted: Sat Nov 12, 2005 5:06 pm    Post subject: Reply with quote

Ok, I have been waiting, now is the time to ask:

What is the poller cache?
When would you want to clear your poller cache?
What is the down side to clearing poller cache?
Doesn't poller cache rebuild automagically next run?
Why would a person want to rebuild poller cache manually via this script?

Sorry, as you can see, poller cache is a complete poller mystery to me!
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 10805
Location: MI, USA

PostPosted: Sat Nov 12, 2005 9:12 pm    Post subject: Reply with quote

Quote:
What is the poller cache?


The poller_cache is (aka poller_item table) a intermediary location for all data source items. Since a data source is made from several database components in 0.8.6x, it made sense to speed up the polling to place that information in a static file to increase poller performance.

Quote:
When would you want to clear your poller cache?


There are a few things that don't have inheritance when you change them, like "Data Input Methods". If you were to say change one and then want all of your Data Sources (aka Poller_items aka Poller_cache) to be updated with the changes, you would have to "update"/"reload" we are going to change the name, the poller_cache.

Quote:
What is the down side to clearing poller cache?


It just takes lot's of time when you have 20k data sources. You should always attempt to clear between polling cycles to avoid gaps in your graphs. Another downside is that if you have damaged a template and then subsequentyly cleared your poller cache, items may no longer graph.

Best advice is good advice, back up your environment regularly.

Quote:
Doesn't poller cache rebuild automagically next run?


No, it updates on a host by host basis when you edit it, a data template/data source/graph/graph template, when you edit them.

Quote:
Why would a person want to rebuild poller cache manually via this script?


So you can watch it prgress instead of looking at your blank web page. We should do something more animated in the web space, I know. Besides, a user asked me to write it an I thought the community might benefit.

TheWitness
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5618
Location: Michigan, USA

PostPosted: Wed Jan 04, 2006 3:27 pm    Post subject: Reply with quote

Now included in 0.8.6h.
Back to top
BelgianViking
Cacti User


Joined: 24 Mar 2005
Posts: 97
Location: Brussels, Belgium

PostPosted: Wed Aug 02, 2006 1:45 am    Post subject: Reply with quote

Witness,
Due to the fact that I have a device on which interfaces appear and dissapear (virtual interfaces on a Nortel VPN Router), I have to 'Reload Data Query' regularly to get the graphs going. Would this script do the same thing automatically ? I guess it would be easily adapted to only reload the cache for this device without touching that of all other devices...
Thanks in advance !
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 10805
Location: MI, USA

PostPosted: Fri Nov 10, 2006 8:10 am    Post subject: Reply with quote

Cron it and it then becomes automatic.

TheWitnes
Back to top
crasis_prefect



Joined: 08 Oct 2007
Posts: 1

PostPosted: Thu Oct 18, 2007 2:38 pm    Post subject: Reply with quote

Would this script query all the routers I'm monitoring to see if any new interfaces have been added to device? I've been trying to find out how cacti handles that.

Regards,
Back to top
fmerrill



Joined: 28 Oct 2008
Posts: 12
Location: North Carolina

PostPosted: Fri Dec 26, 2008 12:20 am    Post subject: Reply with quote

crasis_prefect wrote:
Would this script query all the routers I'm monitoring to see if any new interfaces have been added to device? I've been trying to find out how cacti handles that.


There is a cli script that can recheck a host for changes/new interfaces on polled devices: poller_reindex_hosts.php
That is in the <cacti_root>/cli/ directory.

If interface indexes have changed as the result of a change on the device itself, that will pick them up, but, that does not automatically add any new graphs for those new interfaces.

If you only have one or two devices that you know have changed, then it's almost easier to just go to the device form, go the 'create graphs for this device page' click the green circle to have it poll and re-index the device, and the new interfaces will show up, and then you can add any additional graphs needed.

At some point I was hoping I could get around to setting up and catching device change SNMP traps, and then have that launch a script that reindexed the device, then automatically added graphs if new interfaces met some specific requirements (I don't always graph all interfaces on a device), but, I just have never gotten around to it.

I'd really like to see Cacti do re-indexing automatically - maybe a certain number of devices per hour/day/whatever time-frame, then having it tell me somewhere in the management interface of 'new' or 'changed' interfaces on devices, and then giving me the option of creating/deleting/changing graphs at that time.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group