I have noticed that I can only display an uninterrupted period with CACTI. I am wondering whether is possible or not to make a custom graph which displaying only the business hours during a period (a week, a month, etc.).
For example, I would like to be able to display a graph with an average inbound traffic between 8am and 6pm for 5 business days a week (monday to friday) of the last month.
I've tried to configure a script for RRDtool, but I don't know the right syntax. After severals tests, I saw that it is possible to superimpose differents graphs together. I was thinking to calculate the average of all thoses graphs, but I'm don't know how to do it.
I would like to configure something like the following:
--startday 20120604+8h
--endday 20120604+18h
monday: --start startday --end endday
tuesday: --start startday+24h --end endday+24h
wednesday: --start startday+48h --end endday+48h
thursday: --start startday+72h --end endday+72h
friday: --start startday+96h --end endday+96h
DEF:monday=router.rrd:gi0/1:traffic_mon:AVERAGE
DEF:tuesday=router.rrd:gi0/1:traffic_tue:AVERAGE
DEF:wednesday=router.rrd:gi0/1:traffic_wed:AVERAGE
DEF:thursday=router.rrd:gi0/1:traffic_thu:AVERAGE
DEF:friday=router.rrd:gi0/1:traffic_fri:AVERAGE
DEF:traffic_mon:traffic_tue:traffic_wed:traffic_thu:traffic_fri:AVERAGE
I would apreciate any help.
Thank you.
Most likely, Cacti itself isn't going to be able to generate this kind of graph for you. You're going to need to generate your RRD graph manually using
rrdgraph
. The full solution is quite complicated, but the basic gist is that you create aCDEF
with an RPN equation that nulls out the data during non-business hours.A very basic example that removes the hours 2012-01-31 18:00:00 UTC to 2012-02-01 08:00:00 UTC would be:
The
CDEF
forofficehours
basically checks to see if the time of the sample is between 6pm and 8am. If it is, the value isUNKN
. If it isn't, the value is 1. Multiply that by the value and you're left with actual values during office hours and unknowns during non-office hours. A graph would show a hole during non-office hours, and averages, maxes, and mins output viaGPRINT
orPRINT
would not factor in the non-office hour values.You'll have to setup a
CDEF
for each non-office hour period you want to filter out. Time is in seconds since the epoch, so if you were graphing, say, January 1st to February 1st, you'd have on the order of 20 distinct periods you need to filter out. RRD has very good language hooks, so you could write a simple Perl or Python script to generate these graphs on the fly for you.Read over the
rrdgraph
,rrdgraph_rpn
, andrrdgraph_examples
man pages for more details and examples.The CACTI poller runs out of cron.
If you only want to poll within working hours, its possible to configure that in cron, but rrdtool will display the gaps on the graph where polling wasnt conducted.
No, rrdtool doesn't work like that.