RELEASED: < 1 Minute to 5 Minute Polling Interval Patch

Important information about Cacti developments that all users should be interested in.

Moderators: Developers, Moderators

Post Reply
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Any script can have it's "template" adjusted to work with 1 minute polling, you simply need to follow the procedure within the PDF file. If you plan on publishing a template, you need to NOT modify an existing one. Rather you should create from scratch.

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

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
himohit
Posts: 11
Joined: Fri Jun 30, 2006 8:59 am

Post by himohit »

I need 1 minute poller for Traffic interface, so that means i just follow the 2nd step which is shown in pdf and start by creating new RRA's ?
himohit
Posts: 11
Joined: Fri Jun 30, 2006 8:59 am

Post by himohit »

OK, i finally figured my stuff and my graphs are looking great here. The only problem i see now is that my inbound and outbound traffic is showing the same. Can you please suggest me something here.
Thanks.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please select the data source that belongs to that graph. I suppose, that both items, inbound and outbound, reference the same data. Change this and save
Reinhard
himohit
Posts: 11
Joined: Fri Jun 30, 2006 8:59 am

Post by himohit »

Gandalf, here is my Data template and it is exactly the same as given in the pdf. Am i missing something? Thanks for your reply.
Attachments
traffic_in
traffic_in
in.jpg (97.74 KiB) Viewed 15589 times
traffic_out
traffic_out
out.jpg (99.17 KiB) Viewed 15589 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I did not talk about the data template but about the data source (2 items below Graph Management)
Reinhard
himohit
Posts: 11
Joined: Fri Jun 30, 2006 8:59 am

Post by himohit »

I got it. I had to make my changes in the Data Query section and point to the right location.
Thanks for all your help.
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

ran into a little snag on my test Cacti server running CactiEZ.

Couldn't figure out how to change apache's crontab since I am not able to su to apache.

finally figured it out
as root: crontab -u apache -l lists the file
crontab -u apache -e edits the file.

I thought I did it thru webmin, but it listed it as:
* * * * * instead of */1 * * * *
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
eschoeller
Cacti User
Posts: 234
Joined: Mon Dec 13, 2004 3:03 pm

Post by eschoeller »

I have gotten 1min resolutions working correctly.
I would like to try out using 30sec resolutions now.

I am curious, what values should I be using for step, heartbeat, X-Files Factor, Steps, Rows and timespan?

Thanks!
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Here is a small addition that someone may find usable. Sorry for not posting a patch, but I have some other custom stuff too.

What this code does is it makes the Polling Interval setting "smart". If you set your cron to 1 min intervals, but Cacti's setting is only set at 5 min pollings, it will only poll at 5 min intervals. If your Debug log is set to 3+ it will warn you that the polling intervals are different. Now if for instance you set the cron job for 5 minute intervals, but Cacti at 10 sec intervals, it will also warn you (1+). This helps keep you from breaking things accidently, and warns you if you are breaking things.

Open poller.php, find this code

Code: Select all

/* Record Start Time */
list($micro,$seconds) = split(" ", microtime());
$start = $seconds + $micro;

/* Get number of polling items from the database */
$polling_interval = read_config_option("poller_interval");
and place this directly afterwards.

Code: Select all

/* Retreive the last time the poller ran */
$polling_lastrun = read_config_option("poller_lastrun");

/* Get to see if we are polling faster than reported by the settings, if so, exit */
if (isset($polling_lastrun) && isset($polling_interval) && $polling_lastrun != 0) {
	if ($seconds - $polling_lastrun + 5 < $polling_interval) {
		if (read_config_option("log_verbosity") >= POLLER_VERBOSITY_MEDIUM) {
			cacti_log("Poller Interval is $polling_interval seconds, but only " . ($seconds - $polling_lastrun) . " seconds have passed since the last polling.", true, "POLLER");
		}
		exit;
	}
}

/* Check to see whether we have the poller interval set lower than the poller is actually ran */
if ($seconds - $polling_lastrun - 5 > $polling_interval) {
	cacti_log("Poller Interval is $polling_interval seconds, but " . ($seconds - $polling_lastrun) . " seconds have passed since the last polling.", true, "POLLER");
}

db_execute("replace into settings (name,value) values ('poller_lastrun'," . $seconds . ")");
dermoth
Posts: 7
Joined: Thu Jul 13, 2006 10:39 am

Post by dermoth »

This is a copy of I post I sent on the mailing list, just FYI.

I just tried the new 1-minute patch... Isn't there something wrong in the RRA settings? If I follow the doc, my daily, weekly, monthly and yearly RRA won't have the correct "Steps" parameter when used with one-minute templates.

My guess is that we'll end up with one-minute data in the 5-minute data RRA (and so on for the other RRAs) which mean redundant data and much less available data than it is supposed to hold.

I see three ways to fix this:

1. Change all RRAs, and set all templates and current graphs to 1-minute pooling (This is what I did).

2. Create one set of RRAs per polling interval. This is the quickest fix according to the way the patch works but is ridiculous IMHO.

3. Remove the "Steps" option in the RRA setting and change it to a "Time factor" option. The time factor should be divisible by any of the smaller time factors. When the smallest time factor in a RRA set is 1, then "time factor" = "Steps", otherwise "Steps" = "Time factor" / smallest time factor. When adding a new RRA there could be a multiple by witch you want to multiply the RRAs with equal or bigger time factors so that it would ease inserting new RRAs without breaking all other templates. For removing RRAs, a divide by options could be added as well. It would be also required to replace "Rows" by a factor of the Timespan value. I.e. if you want two days of daily data (86400 seconds) you would chose a "Row factor" of "2". Ex. For Daily graph with timespan=86400, time factor=5, Step (in the data template)=60, then 86400/60/5*2=576 rows.


Meanwhile here's my current RRA settings and some SQL queries to run to make all graphs and templates 1-minute (require that you recreate all RRD files and you will loose all data).

Code: Select all

Name                        Steps  Rows  Timespan
Hourly (1 Minute Average)   1      4000  14400
Daily (5 Minute Average)    5      1600  86400
Weekly (30 Minute Average)  30     1600  604800
Monthly (2 Hour Average)    120    1600  2678400
Yearly (1 Day Average)      1440   1600  33053184

Code: Select all

update data_template_data set rrd_step=60 where rrd_step=300;
update data_template_rrd set rrd_heartbeat=120 where rrd_heartbeat=600;

## WARNING ## Here it assumes that your 1-minute RRA id is "5".
## Replace "5" by your 1-minute RRA id on BOTH SQL queries!!
delete from data_template_data_rra where rra_id=5;
insert into data_template_data_rra select distinct(data_template_data_id), 5 from data_template_data_rra;

## WARNING ## This will reset all your graphs
rm -f /PATH/TO/cacti/rra/*.rrd
thurwood
Posts: 1
Joined: Mon Jan 15, 2007 6:33 pm

NAN error

Post by thurwood »

I've added the patch at the beginning of this thread, and followed the how-to several times. I have created and recreated the data template, graph templates and data-queries and several times. Each time I do, I end up with graphs showing NAN. Graph debug says everything is ok, and data source debug again shows everything is fine.

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="mymachine- Traffic - Gi0/2 " \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/usr/share/cacti/site/rra/mymachine_traffic_in_37.rrd":traffic_in:AVERAGE \
DEF:b="/usr/share/cacti/site/rra/mymachine_traffic_in_37.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
AREA:cdefa#00CF00:"Inbound" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefe#002A97:"Outbound" \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s" \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s"


/usr/bin/rrdtool create \
/usr/share/cacti/site/rra/mymachine_traffic_in_37.rrd \
--step 60 \
DS:traffic_out:COUNTER:120:0:1000000000 \
DS:traffic_in:COUNTER:120:0:1000000000 \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \



Around 9 months ago, I did this successfully, but that machine is now long gone. I was a bit of a slacker and grabbed templates that were posted rather than creating the templates myself.
I am running 8.6i
The RRD files that are being created look correct and the graph is being generated but the values are shown as NAN. Does this issue appear to be anything someone would be immediately familiar with?

As an alternative is there any chance someone could post templates that work with this version? I would be terribly indebted to you.

Thanks!
dermoth
Posts: 7
Joined: Thu Jul 13, 2006 10:39 am

Post by dermoth »

May look a stupid suggestion but just in case...

1. Have you set the poller to "Every Minutes" in the Cacti Poller settings page?
2. Are you actually polling every minute ( */1 * * * * in crontab)?
CuBe
Posts: 3
Joined: Tue Jan 16, 2007 6:31 pm

Post by CuBe »

Hi all!

Recently I have been playing around with CACTI and so far i'm very happy with it.

I have also installed this 1 minute poller, but it seems there is just one issue I can't seem to be able to resolve...

It seems my 'Hourly (1 Minute Average)' graph doesn't give results on a minute basis, but instead it keeps creating those 5 minute averages.

I've done everything the PDF told me to do, I also see the page refreshing itself every minute, and the crontab is set to 1 minute.

So if anyone got any info that could help me ;-)

Here's the code:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1169028824 \
--end=1169042924 \
--title="sitename - Traffic - eth0 1 min" \
--rigid \
--base=1000 \
--height=144 \
--width=600 \
--alt-autoscale-max \
--lower-limit=0 \
COMMENT:"From 2007/01/17 11\:13\:44 To 2007/01/17 15\:08\:44\c" \
COMMENT:"  \n" \
--vertical-label="bytes per second" \
--slope-mode \
DEF:a="/usr/share/cacti/site/rra/sitename_traffic_in_73.rrd":traffic_in:AVERAGE \
DEF:b="/usr/share/cacti/site/rra/sitename_traffic_in_73.rrd":traffic_out:AVERAGE \
AREA:a#00CF00:"Inbound"  \
GPRINT:a:LAST:" Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s"  \
COMMENT:"Total In\:  2.37 GB\n"  \
LINE1:b#002A97:"Outbound"  \
GPRINT:b:LAST:"Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s"  \
COMMENT:"Total Out\: 19.24 GB"  \
COMMENT:"" 
view my graph at http://img162.imagevenue.com/img.php?im ... _396lo.JPG

Thanks in advance for all replies!
cwalton
Posts: 15
Joined: Wed May 10, 2006 7:53 am

Post by cwalton »

Posting a link to my OP about the fast poller, at the suggestion of BSOD:

http://forums.cacti.net/viewtopic.php?t=19234


Many thanks for any assistance.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests