Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is how the small version of the graph must look:

Graph-frag.nmis

Now that we know how to make a useful graph for packets stats, it's time to build one for IP packet fragmentation and reassembly. This new graph will be identified as "frag" (short of "fragmentation") and we will have to add it to the system → nodegraph list and also to  mib2ip → graphtype .

Code Block
--snip--
 'system' => {
    'nodegraph' => 'laload,ip,frag',
    'rrd' => {
      'laload' => {
        'graphtype' => 'laload',
        'snmp' => {
          'laLoad1' => {
            'oid' => '1.3.6.1.4.1.2021.10.1.3.1',
            'option' => 'gauge,0:U'
          },
          'laLoad5' => {
            'oid' => '1.3.6.1.4.1.2021.10.1.3.2',
            'option' => 'gauge,0:U'
          }
        }
      },
      'mib2ip' => {
        'graphtype' => 'ip,frag',
        'snmp' => {
          'ipInReceives' => {
            'oid' => 'ipInReceives',
            'option' => 'counter,0:U'
          },
          'ipInHdrErrors' => {
            'oid' => 'ipInHdrErrors',
            'option' => 'counter,0:U'
          },

Now we create our basic graph template. Having "Fragmentation/Reassembly" on the "vlabel".

Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
%hash = (
	'title' => {
		'standard' => '$node - $length from $datestamp_start to $datestamp_end',
		'short' => '$node - $length'
	},
	'vlabel' => {
		'standard' => 'Fragmentation/Reassembly'
	},
	'option' => {
		'standard' => [

		],
		'small' => [

...



		]
	}
);ipInDelivers

Do not forget to add the associated description to the Common-heading.nmis file.

Code Block
title/usr/local/nmis8/models/Common-heading.nmis
--snip--
      'frag' => 'IP Fragmentation/Reassembly (as a % of Packets Received)',
--snip--

We will be using average values of these objects: "ipReasmReqds","ipReasmOKs","ipReasmFails","ipFragOKs","ipFragFails","ipFragCreates","ipInDelivers". Let's define them first:

Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
'standard' => [
	'DEF:ipReasmReqds=$database:ipReasmReqds:AVERAGE',
	'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
	'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
	'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
	'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
	'DEF:ipFragCreates=$database:ipFragCreates:AVERAGE',
	'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',
],

Now, we have to make a calculation to obtain more useful data. For example, graphing only the objects themselves and showing the current average values is not really indicative, however, if we show the percentage of each object that correspond to the total it is more useful. The calculation is very simple:

The total number of input datagrams successfully delivered to IPv4 user-protocols (including ICMP) is represented by: "ipInDelivers", this will represent the 100%.

To calculate the percentage of IPv4 fragments received which needed to be reassembled (ipReasmReqds), we have to calculate:

  ipReasmReqds divided by ipInDelivers and the result multiplied by 100, which is equivalent to:  (ipReasmReqds / ipInDelivers) * 100

In Reverse Polish Notation (RPN) that will be: ipReasmReqds,ipInDelivers,/,100,*

The result of this calculation must be stored in a named variable, in this case we will call it: "ReasmReqds". Finally our CDEF or Calculation Definition should be:

'CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*'

Let's apply the same logic for all the other objects and we should get:

Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
'standard' => [
	'DEF:ipReasmReqds=$database:ipReasmReqds:AVERAGE',
	'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
	'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
	'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
	'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
	'DEF:ipFragCreates=$database:ipFragCreates:AVERAGE',
	'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',

	'CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*',
	'CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*',
	'CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*',
	'CDEF:FragOKs=ipFragOKs,ipInDelivers,/,100,*',
	'CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*',
	'CDEF:FragCreates=ipFragCreates,ipInDelivers,/,100,*',
],

Now we will add the lines to the graph, in this case we have decided to draw 4 lines (FragOKs,FragFails,ReasmOKs and ReasmFails), also we have decided to give a bit more of importance to the "Failed" objects, so the line width will be thicker. 

'LINE1:FragOKs#00ff00:Fragmentation OK',
'LINE2:FragFails#ff0000:Fragmentation Fail',

Notice that the drawing style "LINE" is accompanied by a number, this number specifies the width of the line on the graph, it can be a floating point number.

Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
'standard' => [
	'DEF:ipReasmReqds=$database:ipReasmReqds:AVERAGE',
	'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
	'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
	'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
	'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
	'DEF:ipFragCreates=$database:ipFragCreates:AVERAGE',
	'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',

	'CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*',
	'CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*',
	'CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*',
	'CDEF:FragOKs=ipFragOKs,ipInDelivers,/,100,*',
	'CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*',
	'CDEF:FragCreates=ipFragCreates,ipInDelivers,/,100,*',

	'LINE1:FragOKs#00ff00:Fragmentation OK',
	'LINE2:FragFails#ff0000:Fragmentation Fail',
	'LINE1:ReasmOKs#0033aa:Reassembly OK',
	'LINE2:ReasmFails#000000:Reassembly Fail',
],

Image Added

As we can see, we need to add the legend of the graph using GPRINT, which will show the values that we have calculated in the previous step. In addition, we are going to add a Comment to the legend of the graph:

'COMMENT: Calculated as a % of ipInDelivers' 

COMMENT:text

Text is printed literally in the legend section of the graph.

Info

Additional information about formatting options can be found in: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html


Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
'standard' => [
	'DEF:ipReasmReqds=$database:ipReasmReqds:AVERAGE',
	'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
	'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
	'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
	'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
	'DEF:ipFragCreates=$database:ipFragCreates:AVERAGE',
	'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',

	'CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*',
	'CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*',
	'CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*',
	'CDEF:FragOKs=ipFragOKs,ipInDelivers,/,100,*',
	'CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*',
	'CDEF:FragCreates=ipFragCreates,ipInDelivers,/,100,*',

	'LINE1:FragOKs#00ff00:Fragmentation OK',
	'GPRINT:FragOKs:AVERAGE:Avg FragOK %1.2lf %%\n',

	'LINE2:FragFails#ff0000:Fragmentation Fail',
	'GPRINT:FragFails:AVERAGE:Avg FragFail %1.2lf %%\n',

	'LINE1:ReasmOKs#0033aa:Reassembly OK',
	'GPRINT:ReasmOKs:AVERAGE:Avg ReasmOK %1.2lf %%\n',

	'LINE2:ReasmFails#000000:Reassembly Fail',
	'GPRINT:ReasmFails:AVERAGE:Avg ReasmFail %1.2lf %%\n',

	'GPRINT:ReasmReqds:AVERAGE:Avg ReasmReqd %1.2lf %%',
	'GPRINT:FragCreates:AVERAGE:Avg FragCreate %1.2lf %%\n',

	'COMMENT:Calculated as a % of ipInDelivers'
],

n

Image Added

To make our graph ever more descriptive, we can add the maximum values just repeating the whole process again. Also it may need the small version of the graph. The final result should be like this:


Code Block
title/usr/local/nmis8/models/Graph-frag.nmis
%hash = (
	'title' => {
		'standard' => '$node - $length from $datestamp_start to $datestamp_end',
		'short' => '$node - $length'
	},
	'vlabel' => {
		'standard' => 'Fragmentation/Reassembly'
	},
	'option' => {
		'standard' => [
			'DEF:ipReasmReqds=$database:ipReasmReqds:AVERAGE',
			'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
			'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
			'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
			'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
			'DEF:ipFragCreates=$database:ipFragCreates:AVERAGE',
			'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',

			'DEF:MipReasmReqds=$database:ipReasmReqds:MAX',
			'DEF:MipReasmOKs=$database:ipReasmOKs:MAX',
			'DEF:MipReasmFails=$database:ipReasmFails:MAX',
			'DEF:MipFragOKs=$database:ipFragOKs:MAX',
			'DEF:MipFragFails=$database:ipFragFails:MAX',
			'DEF:MipFragCreates=$database:ipFragCreates:MAX',

			'CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*',
			'CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*',
			'CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*',
			'CDEF:FragOKs=ipFragOKs,ipInDelivers,/,100,*',
			'CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*',
			'CDEF:FragCreates=ipFragCreates,ipInDelivers,/,100,*',

			'CDEF:MReasmReqds=MipReasmReqds,ipInDelivers,/,100,*',
			'CDEF:MReasmOKs=MipReasmOKs,ipInDelivers,/,100,*',
			'CDEF:MReasmFails=MipReasmFails,ipInDelivers,/,100,*',
			'CDEF:MFragOKs=MipFragOKs,ipInDelivers,/,100,*',
			'CDEF:MFragFails=MipFragFails,ipInDelivers,/,100,*',
			'CDEF:MFragCreates=MipFragCreates,ipInDelivers,/,100,*',

			'LINE1:FragOKs#00ff00:Fragmentation OK',
			'GPRINT:FragOKs:AVERAGE:Avg FragOK %1.2lf %%',
			'GPRINT:MFragOKs:MAX:Max FragOK %1.2lf %%\n',

			'LINE2:FragFails#ff0000:Fragmentation Fail',
			'GPRINT:FragFails:AVERAGE:Avg FragFail %1.2lf %%',
			'GPRINT:MFragFails:MAX:Max FragFail %1.2lf %%\n',

			'LINE1:ReasmOKs#0033aa:Reassembly OK',
			'GPRINT:ReasmOKs:AVERAGE:Avg ReasmOK %1.2lf %%',
			'GPRINT:MReasmOKs:MAX:Max ReasmOK %1.2lf %%\n',

			'LINE2:ReasmFails#000000:Reassembly Fail',
			'GPRINT:ReasmFails:AVERAGE:Avg ReasmFail %1.2lf %%',
			'GPRINT:MReasmFails:MAX:Max ReasmFail %1.2lf %%\n',

			'GPRINT:ReasmReqds:AVERAGE:Avg ReasmReqd %1.2lf %%',
			'GPRINT:MReasmReqds:MAX:Max ReasmReqd %1.2lf %%\n',

			'GPRINT:FragCreates:AVERAGE:Avg FragCreate %1.2lf %%',
			'GPRINT:MFragCreates:MAX:Max FragCreate %1.2lf %%\n',

			'COMMENT:Calculated as a % of ipInDelivers'
		],
		'small' => [
			'DEF:ipReasmOKs=$database:ipReasmOKs:AVERAGE',
			'DEF:ipReasmFails=$database:ipReasmFails:AVERAGE',
			'DEF:ipFragOKs=$database:ipFragOKs:AVERAGE',
			'DEF:ipFragFails=$database:ipFragFails:AVERAGE',
			'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE',
			'CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*',
			'CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*',
			'CDEF:FragOKs=ipFragOKs,ipInDelivers,/,100,*',
			'CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*',
			'LINE1:FragOKs#00ff00: Fragmentation OK',
			'LINE2:FragFails#ff0000: Fragmentation Fail',
			'LINE1:ReasmOKs#0033aa: Reassembly OK',
			'LINE2:ReasmFails#000000: Reassembly Fail',
			'COMMENT:   Calculated as a % of ipInDelivers'
		]
	}
);


Image Added

END