Previous page: Bandwidth
Next page: CPU Graph

Hourly Graphs

Version 2.0.2

If I am actively monitoring my ipcop, I find that I often need a little more detail to the graphs over the preceding minutes.  So I wanted to  add hourly graphs (60 minutes worth of data in one graph)


Here's how it's done.

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:


updatelq();
sleep 2;
updatelqgraph("hour");
updatelqgraph("day");
updatelqgraph("week");
updatelqgraph("month");
updatelqgraph("year");

 

2. Repeat this for the other graphs (ie updatecpugraph("hour");, updatememgraph("hour");, updatediskusegraph("hour"); etc.) like this partial edit screen:


updatediskdata();
updatediskgraph("hour");
updatediskgraph("day");
updatediskgraph("week");
updatediskgraph("month");
updatediskgraph("year");

###
### Network Graphs
###
for my $color ('GREEN', 'RED', 'ORANGE', 'BLUE') {
my $icount = $settings{"${color}_COUNT"};
while ($icount > 0) {
my $thisitf = "${color}_${icount}";
my $thisdev = $settings{"${thisitf}_DEV"};
updateifdata($thisitf, $thisdev);
if (-e "$rrdlog/$thisitf.rrd") {
updateifgraph($thisitf, "hour");
updateifgraph($thisitf, "day");
updateifgraph($thisitf, "week");
updateifgraph($thisitf, "month");
updateifgraph($thisitf, "year");
}
$icount--;
}
}
###
### Special case Modem/ISDN
###
if ($settings{'RED_COUNT'} == 0) {
my $thisitf = 'RED_1';
my $thisdev = &General::getredinterface();

# If RED interface does not exist, add 0:0 to traffic
$thisdev = 'dummyinterface' if ($thisdev eq '');
updateifdata($thisitf, "ppp0");
if (-e "$rrdlog/$thisitf.rrd") {
updateifgraph($thisitf, "hour");
updateifgraph($thisitf, "day");

 

3. Add a new file /var/ipcop/addon-lang/hour.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',
);

 

4. If you've added a language file, run the command rebuildlangtexts

5. 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.


</tr></table>
<hr />
<img src='/graphs/${graph}-hour.png' border='0' alt='${graph}-$Lang::tr{'hour'}' /><hr />
<img src='/graphs/${graph}-day.png' border='0' alt='${graph}-$Lang::tr{'day'}' /><hr />
<img src='/graphs/${graph}-week.png' border='0' alt='${graph}-$Lang::tr{'week'}' /><hr />
<img src='/graphs/${graph}-month.png' border='0' alt='${graph}-$Lang::tr{'month'}' /><hr />
<img src='/graphs/${graph}-year.png' border='0' alt='${graph}-$Lang::tr{'year'}' />
END
;
}

 


^Top
Previous page: Bandwidth
Next page: CPU Graph