Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Apr 26, 2019 9:06 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Handy Repopulate Poller Cache Script
PostPosted: Thu Nov 10, 2005 8:59 pm 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14804
Location: MI, USA
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


Attachments:
rebuild_poller_cache.zip [1.19 KiB]
Downloaded 12345 times

_________________
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 9:02 pm 
Offline

Joined: Thu Mar 10, 2005 11:02 am
Posts: 31
Thanks a bunch!
You do great work!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 5:06 pm 
Offline
Cacti User
User avatar

Joined: Thu Sep 22, 2005 7:50 pm
Posts: 242
Location: Landenberg, PA
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!
:D

_________________
Thank you,

Ernie
http://www.NMSWorld.com
Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5
Cacti Version - 0.8.7b
Poller Type - cactid 0.8.7 with Boost v1.7
Server Info - FreeBSD 7.0-RELEASE
Web Server - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
PHP - 5.2.6
MySQL - 5.0.51b Mod: poller_output ENGINE = MEMORY
RRDTool - 1.3.0
SNMP - 5.4.1
Plugins - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 9:12 pm 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14804
Location: MI, USA
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

_________________
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 3:27 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 6016
Location: Michigan, USA
Now included in 0.8.6h.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 1:45 am 
Offline
Cacti User

Joined: Thu Mar 24, 2005 4:59 am
Posts: 97
Location: Brussels, Belgium
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 !

_________________
| Cacti 0.8.6g | MySQL 4.1.14 w Query Cache | Net-SNMP 5.2.1 | IIS 6 | fast-cgi | PHP 5.0.3 | RRDtool 1.2.9 | Windows 2003 Server SP1 | Cactid 0.8.6f |
| Dell 2450 - 2x P3 733 MHz, 1GB RAM |


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 10, 2006 8:10 am 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14804
Location: MI, USA
Cron it and it then becomes automatic.

TheWitnes

_________________
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 2:38 pm 
Offline

Joined: Mon Oct 08, 2007 11:10 am
Posts: 1
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,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 26, 2008 12:20 am 
Offline

Joined: Tue Oct 28, 2008 7:56 pm
Posts: 12
Location: North Carolina
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 07, 2010 10:15 am 
Offline

Joined: Mon Jul 05, 2010 10:17 am
Posts: 9
hello guys i know it is an old post but i have the same issue i coudn't graph in cacti after figure it out with help i know it is my poller is quite massive i tried the rebuild command in cli but i got a message error Cannot connect to Mysql server on localhost ... specify a valid Mysql database in include/config.php. I looked everywhere how to do it without success

thank you for your help


Top
 Profile  
 
 Post subject: Re: Handy Repopulate Poller Cache Script
PostPosted: Mon Aug 22, 2011 5:27 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
I have 4 hosts
3 of them is Windows. One of them linux localhost.
I try to monitor CPU,MEM and Disk Usages of windows server.
So I haveatleast 3x3=12 rrd filesfow windows server (dependshow many drives such as C, D and E) and 5 linux localhost rrd files.
But altough I rebuild poller cache manually or by using CLI script, still i cant see my Disk usage rrd files.

What is the problem?
I mean:
Quote:
08/22/2011 01:35:08 PM - SPINE: Poller[0] NOTE: Spine is behaving in a 0.8.7g manner
08/22/2011 01:35:08 PM - SPINE: Poller[0] Host[2] TH[1] NOTE: There are '2' Polling Items for this Host
08/22/2011 01:35:08 PM - SPINE: Poller[0] Host[2] TH[1] DS[8] SCRIPT: /usr/bin/perl -wU /var/www/cacti/scripts/nt_cpu.pl 10.1.1.24, output: 1
Name "main::UID" used only once: possible typo at /var/www/cacti/scripts/nt_memuse.pl line 3.
Name "main::EUID" used only once: possible typo at /var/www/cacti/scripts/nt_memuse.pl line 3.
08/22/2011 01:35:08 PM - SPINE: Poller[0] Host[2] TH[1] DS[16] SCRIPT: /usr/bin/perl -wU /var/www/cacti/scripts/nt_memuse.pl 10.1.1.24, output: total:869.98 used:469.38
08/22/2011 01:35:08 PM - SPINE: Poller[0] Time: 0.2587 s, Threads: 1, Hosts: 2

But actually 3 polling item for this host. Why spien cant see third items?

Sorry for next posts.. Acidentall pushing. I couldnt delete them


Last edited by TFC on Mon Aug 22, 2011 5:38 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Handy Repopulate Poller Cache Script
PostPosted: Mon Aug 22, 2011 5:29 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
I have 4 hosts
3 of them is Windows. One of them linux localhost.
I try to monitor CPU,MEM and Disk Usages of windows server.
So I haveatleast 3x3=12 rrd filesfow windows server (dependshow many drives such as C, D and E) and 5 linux localhost rrd files.
But altough I rebuild poller cache manually or by using CLI script, still i cant see my Disk usage rrd files.

What is the problem?


Top
 Profile  
 
 Post subject: Re: Handy Repopulate Poller Cache Script
PostPosted: Mon Aug 22, 2011 5:30 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
I have 4 hosts
3 of them is Windows. One of them linux localhost.
I try to monitor CPU,MEM and Disk Usages of windows server.
So I haveatleast 3x3=12 rrd filesfow windows server (dependshow many drives such as C, D and E) and 5 linux localhost rrd files.
But altough I rebuild poller cache manually or by using CLI script, still i cant see my Disk usage rrd files.

What is the problem?


Top
 Profile  
 
 Post subject: Re: Handy Repopulate Poller Cache Script
PostPosted: Thu Apr 18, 2013 9:02 am 
Offline

Joined: Fri Sep 30, 2011 3:37 am
Posts: 40
bash-3.2$ php rebuild_poller_cache.php
PHP Fatal error: Call to undefined function db_execute() in /var/www/cacti/rebuild_poller_cache.php on line 44

I got this issue. any ideas?

_________________
Thanks

Edu


Top
 Profile  
 
 Post subject: Re: Handy Repopulate Poller Cache Script
PostPosted: Thu Sep 26, 2013 3:46 pm 
Offline

Joined: Tue Feb 15, 2011 4:51 am
Posts: 35
Hi,

I am running cacti in windows 2003. "Rebuild Poller Cache", "View SNMP Cache" and "View Poller Cache" option showing in systemutility however, "clear poller cache" is not showing.

Please advise.

Thanks a ton in advance.

--Jit


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group