Tuesday, February 14, 2012

Scheduling Poller using Cron

Poller scheduling is not quite common to most of Cacti users. But when I setup a new Cacti system utilizing Ping for availability, there is a need to schedule a poller.php to run at a specified time only or when it's needed. ICMP is a heavy and resource-intensive type of monitoring, it can cause a high CPU utilization to the core routers creating high latency problems within the network. So it is very important to manage the resources wisely. Since my company is operating only on office hours, I scheduled poller.php to run only within the time frame only.

Here's is my cron settings for that particular requirements.

*/10 7-18 * * 1-5 root php /var/www/cacti/poller.php > /dev/null 2>&1

The cron settings above means that poller.php will run every 10mins, from 7:00am to 6:50pm, and from Monday to Friday only. This will coincide with the business operating hours only, and saving precious CPU power for other task such as system backup every night and every weekend.

Output graph of eth0 as a result of cron settings above


Related Posts:
- Cacti 1 minute cron settings
- 1 minute Spine polling

Saturday, January 28, 2012

Motorcycle Pricelist

Motorcycle transportation is booming in the Philippines, with all the daily traffic experience all over Metro Manila, many opted to utilize motorcycle as their alternate mode of transportation. Despite of danger, many still wants to have a motorcycle, simply because of its versatility, low gas consumption, and can inch their way in every traffic jams in the metro. In addition, more and more people can now afford to own a motorcycle especially those below average earners. In-house financing are readily available from most motorcycle dealers.


Thursday, December 29, 2011

Cacti > Data Sources > RRAs

Defining the right RRA Settings is essential if you are customizing how your graph will be displayed. RRAs were set by Steps, Rows and Timespan. These will determine how you keep your data in different intervals and how long would you keep that interval. Manipulating these intervals would require some storage space, the longer you keep the data at a very small interval, the larger space it will require on your storage drive. So proper RRA settings would help you maximize your storage capacity without sacrificing longer period of significant data.


Hourly (1 Minute Average)

Steps - are the number of data points needed to place the data in RRA, (keep in mind that my system is polling every minute)so my value is "1". This means that every minute, the data will be reflected on my graph, but for how long? the answer will be the number of Rows. My value for rows is 10080, this is equivalent to 7 days of 1-minute data.

To get this,

{[10080/(60/1 step)]/24 hours} = 7 days
{[10080/60]/24} = 7 days

Then, what would be my Timespan to display this graph? Timespan value is in seconds, I want to see my 1 minute graph in the last 6 hours, so my value would be 21600 sec = 6 hours


Daily (5 Minute Average)

Steps = 5, This means that the data will be reflected every 5 steps, (which is also equivalent to 5 minutes)

Rows = 8640, using the formula above

{[8640/(60/5 steps)]/24 hours} = 30 days
{[8640/12]/24} = 30 days

Timespan = 86400 sec = 24 hours



Weekly (30 Minute Average)

Steps = 30, This means that the data will be reflected every 30 steps or 30 minutes
Rows = 4320, using the formula

{[4320/(60/30 steps)]/24 hours} = 90 days
{[4320/2]/24} = 90 days

Timespan = 604800 sec = 7 days



Monthly (2-Hour Average)

Steps = 120, This means that the data will be reflected every 120 steps or 120 minutes or 2 hours
Rows = 2160, using the formula

{[2160/(60/120 steps)]/24 hours} = 180 days
{[2160/0.5]/24} = 180 days

Timespan = 2678400 sec = 31 days


Yearly (1 Day Average)

Steps = 1440, This means that the data will be reflected every 1440 steps or 1440 minutes or 24 hours
Rows = 720, using the formula

{[720/(60/1440 steps)]/24 hours} = 720 days
{[720/0.041666666667]/24} = 720 days

Timespan = 31536000 sec = 365 days


In summary, these are the data reflected on my graph.

last 7 days of 1-minute graph
last 30 days of 5-minute graph
last 90 days of 30-minute graph
last 6 months of 2-hour graph
last 2 years of 1-day graph

So every time I zoom in to my graph, I always have those date in every interval.

Friday, December 23, 2011

Cacti > Installing Plugin Architecture

The Plugin Architecture (PIA) is a set of code changes to core cacti. It is provided by Jimmy Conner (cigamit), one of the Cacti core developers. The Plugin Architecture for Cacti was designed to be both simple in nature and robust enough to allow freedom to do almost anything in Cacti. Cacti itself is designed nicely enough that integrating into it is fairly easy with very little modifications necessary (from here).

In simple terms for us users, it is simply a requirement in order to make the Cacti Plugins work.

Keep in mind that this procedure works on the following versions and on the environment I'm working with, see: My System

***Important Version Compatibility***

cacti_0.8.7g
cacti-plugin-0.8.7g-PA-v2.8

Before doing anything, backup your cacti-root-folder just in case you screwed up while making changes on your system.

1. Download cacti-plugin-arch and extract

#cd /opt
#wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
#tar -xzvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz

2. Copy patch file to /var/www and perform patch

#cd cacti-plugin-arch
#cp cacti-plugin-0.8.7g-PA-v2.8.diff /var/www
#cd /var/www/cacti
#patch -p1 -N < /var/www/cacti-plugin-0.8.7g-PA-v2.8.diff

3. Edit include/config.php, and change database credentials

#vi /var/www/cacti/include/config.php

Update "url_path"

$url_path = "/cacti/";

4. Configure Plugin Architecture

- login to Cacti
- User Management > Admin > Realm Permission
- "check" the Plugin Management
- Done

5. Copy pa.sql on cacti webroot directory and execute import command

#cp pa.sql /var/www/cacti
#mysql -u cacti -p cacti < pa.sql



Plugin Management should now be found on the left panel of your Cacti page

In some cases, you may encounter errors such as this:

ERROR 1045 (28000): Access denied for user 'cacti'@'localhost' (using password: YES)

Execute the following commands to get rid of this error.

#cd /var/www/cacti
#mysql cacti < pa.sql
#mysql --user=root mysql

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
mysql> exit

#mysql -u cacti -p cacti < pa.sql
NOTE: on mysql command line, replace the "cacti" with your "cactiuser" if you are using different user for your system

After doing this, you are now ready to install some of the important plugins such as "realtime", "monitor", "threshold", "spikekill", etc.