[HOWTO] Let cacti work under the cron interval of 15 minutes

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
caomm1982
Posts: 2
Joined: Sun Sep 22, 2013 7:50 am

[HOWTO] Let cacti work under the cron interval of 15 minutes

Post by caomm1982 »

For some reasons, my cron task should be 15 minutes's interval , but cacti only support cron interval of 1 minute or 5 minutes.
So I maked some changes to meet my needs. Here are the steps.

(1) Open the file of cacti/poller.php with a text editor,find some code like :
 if ($cron_interval != 60) {
$cron_interval = 300;
 }

I don't know why it only support 60 and 300, so I make a little change just to comment it out :

 if ($cron_interval != 60) {
// $cron_interval = 300;
 }

(2) Modify the file of cacti/include/global_arrays.php , add item of 900 to both $poller_intervals and $cron_intervals

 $poller_intervals = array(
10 => "Every 10 Seconds",
15 => "Every 15 Seconds",
20 => "Every 20 Seconds",
30 => "Every 30 Seconds",
60 => "Every Minute",
300 => "Every 5 Minutes",
900 => "Every 15 Minutes"

);

$cron_intervals = array(
60 => "Every Minute",
300 => "Every 5 Minutes",
900 => "Every 15 Minutes"
);


(3) Turn to the cacti web page, go to settings ---> Poller tab , now I can set Poller Interval and Cron Interval to Every 15 minutes.
(4) Time to edit cron file, add a 15 minute interval job.
*/15 * * * * root /usr/local/apache/htdocs/cacti/poller.php > /dev/null 2>&1

(5)Now I can get a pic of 15 minute granularity
Attachments
pic of 15 minute granularity
pic of 15 minute granularity
111.jpg (62.01 KiB) Viewed 6959 times
wladimirtm4pda
Posts: 1
Joined: Mon Sep 27, 2021 6:12 am

Re: [HOWTO] Let cacti work under the cron interval of 15 minutes

Post by wladimirtm4pda »

Please advice,

need the instance of cacti with only 15-minutes polling interval graphs
15-minutes - is "very suitable" inteval for existing bussiness reqirements.
(and if there will be any needs "on demand" to look with "more precision" - working "realtime" graphs functionality is completely enough)

never plan to update/upgrade verison of cacti - at this instanse
(if it will be critical - will reinstall cacti "from scratch")

the main goal - is "acheive" the profits:
1) less storage usage
2) (especially!) "Improve performance of Cacti poller on heavily loaded systems #4414"
(i.e. "Cut almost 50% of the polling time for large system with many data sources and very active databases")
Planning to use this instance within >= 1000 devices and about >= 200 000 data sources; existing instanse with this load - shows that "most problem point of the system" - is database performance.
(certainly - planning to delete "other than 15-minutes" polling Data profiles at this system)

Testing instanse "modified" according the insturctions at the first post - works well; no any errorg at logs.
the only "doubt" moment - appearing "Heartbeat" status of poller at every polling interval;
example at image:
Image

searching within the code of cacti for "Heartbeat" - found this strings (1012-1024) in "pollers.php":

Code: Select all

	if (cacti_sizeof($pollers)) {
		foreach ($pollers as $poller) {
			if ($poller['id'] == 1) {
				$disabled = true;
			} else {
				$disabled = false;
			}

			if ($poller['disabled'] == 'on') {
				$poller['status'] = 4;
			}else if ($poller['heartbeat'] > 310) {
				$poller['status'] = 6;
			}

it looks like poller['status'] = 6 (heartbeat) - is "hardcoded-like" with value of 310 seconds (assuming 5 minues polling +10 seconds "margin")
- supposing than the value of polling/cron interval can be "only/definitely" not nore than 5 minutes (300 seconds)

Please advice
if there the sense to make this changes to system according to conditions/reqirements above?
will not this changes "break" the "whole cacti system" ?

and second:
if change the the value at "if statement" above from 310 to 910 - will not couse this any other problems?

Great thanks for the answers!!
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests