A question of timing...

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
slack
Posts: 17
Joined: Thu May 18, 2006 12:52 pm

A question of timing...

#1 Post by slack » Tue May 23, 2006 1:02 pm

I have a script that polls a switch via HTTP for some statistics. I'm using a data query and I want to minimize the number of times that the script actually contacts the switch (because it's a slow process, the switch requires single user login, and the switch's web server dies if it's hit too hard).

So what I'm doing right now is caching the output from the switch, and if the cache hasn't been updated in the last 60 seconds, then the script will contact the switch directly, otherwise read from the cache.

What kinds of pitfalls might this idea have? I'm not terribly familiar with rrd or cacti. Is my 60 second window long enough? Too long? I don't want to run into a situation where the cache isn't updated frequently enough, and I don't want to run into a situation where my numbers are off because the caching is interfering with the polling. My *assumption* here is that cacti is going to ask the switch for information every five minutes, so this should work...maybe...

User avatar
BSOD2600
Cacti Moderator
Posts: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#2 Post by BSOD2600 » Tue May 23, 2006 2:30 pm

Cacti by default only polls every 5 minutes. I don't think there would be anything wrong with if your script did the same.

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#3 Post by gandalf » Wed May 24, 2006 2:35 pm

I agree with BSOD2600 (as usual :wink: ) but want to add one statement:
Due to the actual way cacti works, it will spawn the script for each Graph generated by the common procedure (Create Graphs for this Host from the Device edit screen). To avoid this, perform this task only once. Add all other Graphs directly from Graph Management and refer to the already defined data sources.
An exact procedure how to do this was already published several times, but if you need this after you've created the first graph as given above, please post for more help. It's not that complicated
Reinhard

slack
Posts: 17
Joined: Thu May 18, 2006 12:52 pm

#4 Post by slack » Wed May 24, 2006 5:14 pm

Ok, I've got 26 graphs going for this device. Yeah, I added them from the device itself, and just checked off all 26 sources that were created automatically for me.

So what you're saying is that I should create one graph from the device and the create the other graphs via graph management? But it's only going to list the data sources created when I made the first graph... do I have to add them manually? Why are there two processes for creating the same graphs that affect how cacti manages the graphs?

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#5 Post by gandalf » Thu May 25, 2006 7:56 am

Oops, I made a mistake. As you're using a Data Query, this does not apply.
Reinhard

Post Reply