Import of JFFNMS v0.8.3
[jffnms.git] / engine / graphs / packets_aggregation.inc.php
blob737643824cdee4228e99068fd715ceefe003549a
1 <?
2 /* This file is part of JFFNMS
3 * Copyright (C) <2002-2005> Javier Szyszlican <javier@szysz.com>
4 * This program is licensed under the GNU GPL, full terms in the LICENSE file
5 */
6 //it takes all the interfaces on ID and makes an aggregated graph
8 function graph_packets_aggregation ($data) {
9 $opts_agg = array();
11 $str_cdef_in = "CDEF:inputpackets=0,";
12 $str_cdef_out = "CDEF:outputpackets=0,";
14 foreach ($data[id] as $id) {
15 $interface=$data[$id];
17 $opts_agg = @array_merge ($opts_agg,rrdtool_get_def($interface,array("input$id"=>"inpackets","output$id"=>"outpackets")));
19 $str_cdef_in .="input$id,UN,0,input$id,IF,+,";
20 $str_cdef_out .="output$id,UN,0,output$id,IF,+,";
23 $opts_agg[] = $str_cdef_in;
24 $opts_agg[] = $str_cdef_out;
26 $opts_GRAPH = array(
28 "AREA:inputpackets#00CC00:'Inbound '",
29 "GPRINT:inputpackets:MAX:'Max\:%8.2lf %sPps'",
30 "GPRINT:inputpackets:AVERAGE:'Average\:%8.2lf %sPps'",
31 "GPRINT:inputpackets:LAST:'Last\:%8.2lf %sPps\\n'",
33 "LINE2:outputpackets#0000FF:Outbound",
34 "GPRINT:outputpackets:MAX:'Max\:%8.2lf %sPps'",
35 "GPRINT:outputpackets:AVERAGE:'Average\:%8.2lf %sPps'",
36 "GPRINT:outputpackets:LAST:'Last\:%8.2lf %sPps'"
39 $opts_header[] = "--vertical-label='Packets per Second'";
41 return array ($opts_header, @array_merge($opts_agg,$opts_GRAPH));