Hourly Graphs Modification
Tested on: 1.4.21
To add hourly graphs (60 minutes worth of data in one graph) follow the following steps..

- 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"); - Repeat this insertion for the other graphs:
updatememgraph("hour"); - .
updatediskgraph("hour"); - 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"); - and, as appropriate
updategraph("RED","hour"); - .
updategraph("ORANGE","hour"); - .
updategraph("BLUE","hour"); - 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',
); - You'll then need to run perl -e "require '//var/ipcop/lang.pl'; &Lang::BuildCacheLang" as per the instructions in /var/ipcop/lang.pl

- 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.
This page has been viewed 733 times since Nov 2009.
Previous page: Language File
Next page: Single IPs or Ranges of IPs
Print this page