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



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 a CDEF 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:

AREA:dslimit#00cc00:"Value "

The CDEF for officehours basically checks to see if the time of the sample is between 6pm and 8am. If it is, the value is UNKN. 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 via GPRINT or PRINT 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, and rrdgraph_examples man pages for more details and examples.


The CACTI poller runs out of cron.

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

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.

  • Can I just retrieved the average traffic ? I don't mind if the graphs won't display well. – Blast Raider Jun 11 '12 at 12:48
  • Not for cacti, if you have the rrd data, contrary to what womble says, yes rrdtool does work like that, you have a great ammount of control over what you can see, have a look at oss.oetiker.ch/rrdtool/doc/rrdgraph_examples.en.html – Sirch Jun 11 '12 at 13:09
  • Thank you for the rrdgraph examples. I would like viewing 5 days from 8am to 6pm together and caclulate the overall average. – Blast Raider Jun 12 '12 at 8:50
  • I have edited the question – Blast Raider Jun 12 '12 at 9:18
  • You cant superimpose different time periods over each other. In rrdtool graphs, time is linear, from a start point until an end point. Any graphs you wish displayed will be along this continual line. What you can do is pull out sections, and averages for that section. What you are asking to do now... no, rrdtool doesnt work like that. – Sirch Jun 12 '12 at 17:24

No, rrdtool doesn't work like that.

  • 1
    rrdtool does let you view discreet regions of data. Cacti might not have the capacity to. – Sirch Jun 11 '12 at 13:10
  • @Sirch: How? The rrdgraph manpage doesn't mention anything. – womble Jun 13 '12 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.