I searched on many topics, but don't found consistent information about it.
A changed the cron to run every minut.
A changed the Poller Interval and Cron Interval in settings -> Poller.
I restarted the crond service and run "php rebuild_poller_cache.php" in cli folder.
I saw the logs and the processes continue running every 5 minutes.
Any tips?
PS. I need to know imediatelly if a server is down!
[SOLVED]How to adjust poller time to run every minut or less
Moderators: Developers, Moderators
-
- Posts: 2
- Joined: Fri Dec 03, 2010 8:49 am
[SOLVED]How to adjust poller time to run every minut or less
Last edited by aldo_vieira on Fri Dec 03, 2010 3:52 pm, edited 1 time in total.
-
- Posts: 2
- Joined: Fri Dec 03, 2010 8:49 am
Re: I need to adjust the poller time to run every minut or l
Hi all,
I encountered a turn around solution for my question. If a server is out for, inner a cycle of 20 seconds i receive a mail and alert of plugin monitor. Below the steps to configure the cacti as i need.
1- Create a script named /var/www/cacti/poller_new.sh with the content below: (taken of other topic)
##########################
loop=1
ps=`ps -ef | grep "poller.php" | egrep -v "grep"`
while [ $loop -le 6 ] ; do
if [ ! -n "$ps" ]; then
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
else
echo "`date` Waiting on old processes..."
echo "$ps"
echo "$loop"
sleep 1
loop=`expr $loop + 1`
fi
done
##########################
2- Schedule the script to run every 5 minutes:
crontab -e
*/5 * * * * cacti /var/www/cacti/poller_new.sh
3- Change Settings -> Poller values:
Pooler Interval: Every 20 Seconds
Cron Interval: Every 5 Minutes
4- Edit the file: /var/www/cacti/graph.php
Change value 300 to 20 na as below
$ds_step = empty($ds_step) ? 20 : $ds_step;
5- Edit the file: /var/www/cacti/graph.php
$cron_interval = 20;
$min_period = "20";
6- Create a service (CentOS)
Create a file in /etc/init.d named cacti with the content below:
#######################
#!/bin/sh
RETVAL=0
start() {
KIND="CACTI"
echo -n $"Starting $KIND services: "
/var/www/cacti/poller_new.sh > /dev/null 2>&1 &
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cacti || \
RETVAL=1
return $RETVAL
}
stop() {
KIND="CACTI"
echo -n $"Shutting down $KIND services: "
killall cacti
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cacti
return $RETVAL
}
restart() {
stop
start
}
# Allow status as non-root.
if [ "$1" = status ]; then
rhstatus
exit $?
fi
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
exit $?
#######################
Give exec permission:
chmod +x /etc/init.d/cacti
7- Configure service cacti to start with Operational System
Insert this line into /etc/rc.local:
/var/www/cacti/poller_new.sh > /dev/null 2>&1 &
I encountered a turn around solution for my question. If a server is out for, inner a cycle of 20 seconds i receive a mail and alert of plugin monitor. Below the steps to configure the cacti as i need.
1- Create a script named /var/www/cacti/poller_new.sh with the content below: (taken of other topic)
##########################
loop=1
ps=`ps -ef | grep "poller.php" | egrep -v "grep"`
while [ $loop -le 6 ] ; do
if [ ! -n "$ps" ]; then
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
sleep 10
/usr/bin/php /var/www/cacti/poller.php
else
echo "`date` Waiting on old processes..."
echo "$ps"
echo "$loop"
sleep 1
loop=`expr $loop + 1`
fi
done
##########################
2- Schedule the script to run every 5 minutes:
crontab -e
*/5 * * * * cacti /var/www/cacti/poller_new.sh
3- Change Settings -> Poller values:
Pooler Interval: Every 20 Seconds
Cron Interval: Every 5 Minutes
4- Edit the file: /var/www/cacti/graph.php
Change value 300 to 20 na as below
$ds_step = empty($ds_step) ? 20 : $ds_step;
5- Edit the file: /var/www/cacti/graph.php
$cron_interval = 20;
$min_period = "20";
6- Create a service (CentOS)
Create a file in /etc/init.d named cacti with the content below:
#######################
#!/bin/sh
RETVAL=0
start() {
KIND="CACTI"
echo -n $"Starting $KIND services: "
/var/www/cacti/poller_new.sh > /dev/null 2>&1 &
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cacti || \
RETVAL=1
return $RETVAL
}
stop() {
KIND="CACTI"
echo -n $"Shutting down $KIND services: "
killall cacti
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cacti
return $RETVAL
}
restart() {
stop
start
}
# Allow status as non-root.
if [ "$1" = status ]; then
rhstatus
exit $?
fi
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
exit $?
#######################
Give exec permission:
chmod +x /etc/init.d/cacti
7- Configure service cacti to start with Operational System
Insert this line into /etc/rc.local:
/var/www/cacti/poller_new.sh > /dev/null 2>&1 &
Who is online
Users browsing this forum: No registered users and 2 guests