Previous page: Ports
Next page: Net Traffic

Hourly Graphs

Tested on: 1.4.21

To add hourly graphs (60 minutes worth of data in one graph) follow the following steps..

hourly graph

  1. Open file /usr/local/bin/makegraphs, scroll to the bottom (system and network graphs) where graph data is generated. To add hourly graphs to the CPU section, insert a line like this:
    updatecpudata();
    updatecpugraph ("hour");
    updatecpugraph ("day");
    updatecpugraph ("week");
    updatecpugraph ("month");
    updatecpugraph ("year");
  2. Repeat this insertion for the other graphs:
    updatememgraph("hour");
  3. .
    updatediskgraph("hour");
  4. If you need hourly graphs for the traffic, this is where the line is inserted:
    if ( -e "$rrdlog/GREEN.rrd") {
    updateifgraph ("GREEN", "hour");
    updateifgraph ("GREEN", "day");
    updateifgraph ("GREEN", "week");
    updateifgraph ("GREEN", "month");
    updateifgraph ("GREEN", "year");
  5. and, as appropriate
    updategraph("RED","hour");
  6. .
    updategraph("ORANGE","hour");
  7. .
    updategraph("BLUE","hour");
  8. Add a new file /var/ipcop/addon-lang/linkq.en.pl (unless you have previously added a file for mods, in which case add it there) In that file add the text below:
    # Added
    %tr = ( %tr,
    'hour' => 'Hour',
    );
  9. You'll then need to run perl -e "require '//var/ipcop/lang.pl'; &Lang::BuildCacheLang" as per the instructions in /var/ipcop/lang.pl

    lang
  10. Next in /home/httpd/cgi-bin/graphs.cgi add the following line in the section below. This adds the hourly graph to the top of the page displayed when you click the consolidated daily graphs. They're a bit 'blocky' put usefull to zoom into what is happening in the last hour in greater detail.

    if (-e "$graphdir/${graph}-day.png") {
    my $ftime = localtime((stat("$graphdir/${graph}-day.png"))[9]);
    print "<center>";
    print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
    print "<img src='/graphs/${graph}-hour.png' border='0' alt='${graph}-$Lang::tr{'hour'}' /><hr />";
    print "<img src='/graphs/${graph}-day.png' border='0' alt='${graph}-$Lang::tr{'day'}' /><hr />";
    print "<img src='/graphs/${graph}-week.png' border='0' alt='${graph}-$Lang::tr{'week'}' /><hr />";
    print "<img src='/graphs/${graph}-month.png' border='0' alt='${graph}-$Lang::tr{'month'}' /><hr />";
    print "<img src='/graphs/${graph}-year.png' border='0' alt='${graph}-$Lang::tr{'year'}' />";
    } else {

Job done.


^Top
Previous page: Ports
Next page: Net Traffic