1. Overview
...
Warning | ||||
---|---|---|---|---|
| ||||
Opmantek VM has SNMPv2c enabled by default, the community used on this VM is: nmisGig8 This can be verified on the snmp configuration file that can be found in /etc/snmpd/snmpd.conf |
...
As we have seen in the previous tutorial, we need to obtain the relevant information about the objects to model it for the device. We could get these details directly from the vendor or if the objects are more common, we can search online to obtain more details about them. In this case, we need to model relevant Objects from the Mib 2 - IP MIB Group 1.3.6.1.2.1.4 iso(1). org(3). dod(6). internet(1). mgmt(2). mib-2(1). ip(4).
IP | GROUP | 1.3.6.1.2.1.4 iso(1). org(3). dod(6). internet(1). mgmt(2). mib-2(1). ip(4) | ||||
ipForwarding | SCALAR | read-write | INTEGER | 1.3.6.1.2.1.4.1 | ||
ipDefaultTTL | SCALAR | read-write | INTEGER | 1.3.6.1.2.1.4.2 | ||
ipInReceives | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.3 | ||
ipInHdrErrors | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.4 | ||
ipInAddrErrors | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.5 | ||
ipForwDatagrams | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.6 | ||
ipInUnknownProtos | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.7 | ||
ipInDiscards | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.8 | ||
ipInDelivers | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.9 | ||
ipOutRequests | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.10 | ||
ipOutDiscards | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.11 | ||
ipOutNoRoutes | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.12 | ||
ipReasmTimeout | SCALAR | read-only | INTEGER | 1.3.6.1.2.1.4.13 | ||
ipReasmReqds | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.14 | ||
ipReasmOKs | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.15 | ||
ipReasmFails | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.16 | ||
ipFragOKs | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.17 | ||
ipFragFails | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.18 | ||
ipFragCreates | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.19 | ||
ipAddrTable | TABLE | not-accessible | SEQUENCE OF | 1.3.6.1.2.1.4.20 | ||
| ipAddrEntry | ENTRY | not-accessible | IpAddrEntry | 1.3.6.1.2.1.4.20.1 | |
| ipAdEntAddr | TABULAR | read-only | IpAddress | 1.3.6.1.2.1.4.20.1.1 | |
ipAdEntIfIndex | TABULAR | read-only | INTEGER | 1.3.6.1.2.1.4.20.1.2 | ||
ipAdEntNetMask | TABULAR | read-only | IpAddress | 1.3.6.1.2.1.4.20.1.3 | ||
ipAdEntBcastAddr | TABULAR | read-only | INTEGER | 1.3.6.1.2.1.4.20.1.4 | ||
ipAdEntReasmMaxSize | TABULAR | read-only | INTEGER ( 0..65535 ) | 1.3.6.1.2.1.4.20.1.5 | ||
ipRouteTable | TABLE | not-accessible | SEQUENCE OF | 1.3.6.1.2.1.4.21 | ||
| ipRouteEntry | ENTRY | not-accessible | IpRouteEntry | 1.3.6.1.2.1.4.21.1 | |
| ipRouteDest | TABULAR | read-write | IpAddress | 1.3.6.1.2.1.4.21.1.1 | |
ipRouteIfIndex | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.2 | ||
ipRouteMetric1 | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.3 | ||
ipRouteMetric2 | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.4 | ||
ipRouteMetric3 | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.5 | ||
ipRouteMetric4 | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.6 | ||
ipRouteNextHop | TABULAR | read-write | IpAddress | 1.3.6.1.2.1.4.21.1.7 | ||
ipRouteType | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.8 | ||
ipRouteProto | TABULAR | read-only | INTEGER | 1.3.6.1.2.1.4.21.1.9 | ||
ipRouteAge | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.10 | ||
ipRouteMask | TABULAR | read-write | IpAddress | 1.3.6.1.2.1.4.21.1.11 | ||
ipRouteMetric5 | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.21.1.12 | ||
ipRouteInfo | TABULAR | read-only | OBJECT IDENTIFIER | 1.3.6.1.2.1.4.21.1.13 | ||
ipNetToMediaTable | TABLE | not-accessible | SEQUENCE OF | 1.3.6.1.2.1.4.22 | ||
| ipNetToMediaEntry | ENTRY | not-accessible | IpNetToMediaEntry | 1.3.6.1.2.1.4.22.1 | |
| ipNetToMediaIfIndex | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.22.1.1 | |
ipNetToMediaPhysAddress | TABULAR | read-write | PhysAddress | 1.3.6.1.2.1.4.22.1.2 | ||
ipNetToMediaNetAddress | TABULAR | read-write | IpAddress | 1.3.6.1.2.1.4.22.1.3 | ||
ipNetToMediaType | TABULAR | read-write | INTEGER | 1.3.6.1.2.1.4.22.1.4 | ||
ipRoutingDiscards | SCALAR | read-only | Counter | 1.3.6.1.2.1.4.23 |
Now get the devices snmp data using snmpwalk. We will request data from the OID:
...
To make the returned data more useful and easier to interprete, we put the results in a table that shows the OID, the numerical OID and the value.
OID | Numerical OID | Value |
IP-MIB::ipForwarding.0 | .1.3.6.1.2.1.4.1.0 | INTEGER: 2 |
IP-MIB::ipDefaultTTL.0 | .1.3.6.1.2.1.4.2.0 | INTEGER: 64 |
IP-MIB::ipInReceives.0 | .1.3.6.1.2.1.4.3.0 | Counter32: 1137737 |
IP-MIB::ipInHdrErrors.0 | .1.3.6.1.2.1.4.4.0 | Counter32: 0 |
IP-MIB::ipInAddrErrors.0 | .1.3.6.1.2.1.4.5.0 | Counter32: 170 |
IP-MIB::ipForwDatagrams.0 | .1.3.6.1.2.1.4.6.0 | Counter32: 0 |
IP-MIB::ipInUnknownProtos.0 | .1.3.6.1.2.1.4.7.0 | Counter32: 0 |
IP-MIB::ipInDiscards.0 | .1.3.6.1.2.1.4.8.0 | Counter32: 0 |
IP-MIB::ipInDelivers.0 | .1.3.6.1.2.1.4.9.0 | Counter32: 1137567 |
IP-MIB::ipOutRequests.0 | .1.3.6.1.2.1.4.10.0 | Counter32: 1150410 |
IP-MIB::ipOutDiscards.0 | .1.3.6.1.2.1.4.11.0 | Counter32: 0 |
IP-MIB::ipOutNoRoutes.0 | .1.3.6.1.2.1.4.12.0 | Counter32: 43108 |
IP-MIB::ipReasmTimeout.0 | .1.3.6.1.2.1.4.13.0 | INTEGER: 0 |
IP-MIB::ipReasmReqds.0 | .1.3.6.1.2.1.4.14.0 | Counter32: 0 |
IP-MIB::ipReasmOKs.0 | .1.3.6.1.2.1.4.15.0 | Counter32: 0 |
IP-MIB::ipReasmFails.0 | .1.3.6.1.2.1.4.16.0 | Counter32: 0 |
IP-MIB::ipFragOKs.0 | .1.3.6.1.2.1.4.17.0 | Counter32: 0 |
IP-MIB::ipFragFails.0 | .1.3.6.1.2.1.4.18.0 | Counter32: 0 |
IP-MIB::ipFragCreates.0 | .1.3.6.1.2.1.4.19.0 | Counter32: 0 |
IP-MIB::ipAdEntAddr.127.0.0.1 | .1.3.6.1.2.1.4.20.1.1.127.0.0.1 | IpAddress: 127.0.0.1 |
IP-MIB::ipAdEntAddr.192.168.1.100 | .1.3.6.1.2.1.4.20.1.1.192.168.1.100 | IpAddress: 192.168.1.100 |
IP-MIB::ipAdEntIfIndex.127.0.0.1 | .1.3.6.1.2.1.4.20.1.2.127.0.0.1 | INTEGER: 1 |
IP-MIB::ipAdEntIfIndex.192.168.1.100 | .1.3.6.1.2.1.4.20.1.2.192.168.1.100 | INTEGER: 2 |
IP-MIB::ipAdEntNetMask.127.0.0.1 | .1.3.6.1.2.1.4.20.1.3.127.0.0.1 | IpAddress: 255.0.0.0 |
IP-MIB::ipAdEntNetMask.192.168.1.100 | .1.3.6.1.2.1.4.20.1.3.192.168.1.100 | IpAddress: 255.255.255.0 |
IP-MIB::ipAdEntBcastAddr.127.0.0.1 | .1.3.6.1.2.1.4.20.1.4.127.0.0.1 | INTEGER: 0 |
IP-MIB::ipAdEntBcastAddr.192.168.1.100 | .1.3.6.1.2.1.4.20.1.4.192.168.1.100 | INTEGER: 1 |
IP-MIB::ip.21.1.1.192.168.1.0 | .1.3.6.1.2.1.4.21.1.1.192.168.1.0 | IpAddress: 192.168.1.0 |
IP-MIB::ip.21.1.2.192.168.1.0 | .1.3.6.1.2.1.4.21.1.2.192.168.1.0 | INTEGER: 2 |
IP-MIB::ip.21.1.3.192.168.1.0 | .1.3.6.1.2.1.4.21.1.3.192.168.1.0 | INTEGER: 0 |
IP-MIB::ip.21.1.7.192.168.1.0 | .1.3.6.1.2.1.4.21.1.7.192.168.1.0 | IpAddress: 0.0.0.0 |
IP-MIB::ip.21.1.8.192.168.1.0 | .1.3.6.1.2.1.4.21.1.8.192.168.1.0 | INTEGER: 3 |
IP-MIB::ip.21.1.9.192.168.1.0 | .1.3.6.1.2.1.4.21.1.9.192.168.1.0 | INTEGER: 2 |
IP-MIB::ip.21.1.11.192.168.1.0 | .1.3.6.1.2.1.4.21.1.11.192.168.1.0 | IpAddress: 255.255.255.0 |
IP-MIB::ip.21.1.13.192.168.1.0 | .1.3.6.1.2.1.4.21.1.13.192.168.1.0 | OID: .0.0 |
IP-MIB::ipNetToMediaIfIndex.2.192.168.1.59 | .1.3.6.1.2.1.4.22.1.1.2.192.168.1.59 | INTEGER: 2 |
IP-MIB::ipNetToMediaPhysAddress.2.192.168.1.59 | .1.3.6.1.2.1.4.22.1.2.2.192.168.1.59 | STRING: 50:eb:71:57:ee:a5 |
IP-MIB::ipNetToMediaNetAddress.2.192.168.1.59 | .1.3.6.1.2.1.4.22.1.3.2.192.168.1.59 | IpAddress: 192.168.1.59 |
IP-MIB::ipNetToMediaType.2.192.168.1.59 | .1.3.6.1.2.1.4.22.1.4.2.192.168.1.59 | INTEGER: 3 |
IP-MIB::ipRoutingDiscards.0 | .1.3.6.1.2.1.4.23.0 | Counter32: 0 |
After carefully analysing the object that are useful for our case, we have decided to add these objects: "ipForwDatagrams", "ipFragCreates", "ipFragFails", "ipFragOKs", "ipInAddrErrors", "ipInDelivers", "ipInDiscards", "ipInHdrErrors", "ipInReceives", "ipInUnknownProtos", "ipOutDiscards", "ipOutRequests", "ipReasmFails", "ipReasmOKs" and "ipReasmReqds. This table only shows these selected objects.
OID | Numerical OID | Value | Description |
IP-MIB::ipInReceives.0 | .1.3.6.1.2.1.4.3.0 | Counter32: 1137737 | The total number of input datagrams received from interfaces, including those received in error. |
IP-MIB::ipInHdrErrors.0 | .1.3.6.1.2.1.4.4.0 | Counter32: 0 | The number of input datagrams discarded due to errors in their IPv4 headers, including bad checksums, version number mismatch, other format errors, time-to-live exceeded, errors discovered in processing their IPv4 options, etc. |
IP-MIB::ipInAddrErrors.0 | .1.3.6.1.2.1.4.5.0 | Counter32: 170 | The number of input datagrams discarded because the IPv4 address in their IPv4 header's destination field was not a valid address to be received at this entity. This count includes invalid addresses (e.g., 0.0.0.0) and addresses of unsupported Classes (e.g., Class E). For entities which are not IPv4 routers, and therefore do not forward datagrams, this counter includes datagrams discarded because the destination address was not a local address. |
IP-MIB::ipForwDatagrams.0 | .1.3.6.1.2.1.4.6.0 | Counter32: 0 | The number of input datagrams for which this entity was not their final IPv4 destination, as a result of which an attempt was made to find a route to forward them to that final destination. In entities which do not act as IPv4 routers, this counter will include only those packets which were Source-Routed via this entity, and the Source-Route option processing was successful. |
IP-MIB::ipInUnknownProtos.0 | .1.3.6.1.2.1.4.7.0 | Counter32: 0 | The number of locally-addressed datagrams received successfully but discarded because of an unknown or unsupported protocol. |
IP-MIB::ipInDiscards.0 | .1.3.6.1.2.1.4.8.0 | Counter32: 0 | The number of input IPv4 datagrams for which no problems were encountered to prevent their continued processing, but which were discarded (e.g., for lack of buffer space). Note that this counter does not include any datagrams discarded while awaiting re-assembly. |
IP-MIB::ipInDelivers.0 | .1.3.6.1.2.1.4.9.0 | Counter32: 1137567 | The total number of input datagrams successfully delivered to IPv4 user-protocols (including ICMP). |
IP-MIB::ipOutRequests.0 | .1.3.6.1.2.1.4.10.0 | Counter32: 1150410 | The total number of IPv4 datagrams which local IPv4 user protocols (including ICMP) supplied to IPv4 in requests for transmission. Note that this counter does not include any datagrams counted in ipForwDatagrams. |
IP-MIB::ipOutDiscards.0 | .1.3.6.1.2.1.4.11.0 | Counter32: 0 | The number of output IPv4 datagrams for which no problem was encountered to prevent their transmission to their destination, but which were discarded (e.g., for lack of buffer space). Note that this counter would include datagrams counted in ipForwDatagrams if any such packets met this (discretionary) discard criterion. |
IP-MIB::ipReasmReqds.0 | .1.3.6.1.2.1.4.14.0 | Counter32: 0 | The number of IPv4 fragments received which needed to be reassembled at this entity. |
IP-MIB::ipReasmOKs.0 | .1.3.6.1.2.1.4.15.0 | Counter32: 0 | The number of IPv4 datagrams successfully re-assembled. |
IP-MIB::ipReasmFails.0 | .1.3.6.1.2.1.4.16.0 | Counter32: 0 | The number of failures detected by the IPv4 re-assembly algorithm (for whatever reason: timed out, errors, etc). |
IP-MIB::ipFragOKs.0 | .1.3.6.1.2.1.4.17.0 | Counter32: 0 | The number of IPv4 datagrams that have been successfully fragmented at this entity. |
IP-MIB::ipFragFails.0 | .1.3.6.1.2.1.4.18.0 | Counter32: 0 | The number of IPv4 datagrams that have been discarded because they needed to be fragmented at this entity but could not be, e.g., because their Don't Fragment flag was set. |
IP-MIB::ipFragCreates.0 | .1.3.6.1.2.1.4.19.0 | Counter32: 0 | The number of IPv4 datagram fragments that have been generated as a result of fragmentation at this entity. |
4. Model Implementation
This time, we will be mapping the Numeric OIDs to a more descriptive name, in this case, we call them as it is specified on the MIB. To do this, we have to edit the /usr/local/nmis8/mibs/nmis_mibs.oid file and add the entries. Once we have done this, the NMIS will be able to identify the name and replace it by the numeric OID.
...
In similar fashion, we add the other objects to the model. Also, remember to temporarily use 'no_graphs'
=>
'1'
inside the "mib2ip" section before testing our implementation to avoid errors related to graphs for this section. Once we have done that, the "mib2ip" section may look as follows:
...
'GPRINT:ipInReceives:AVERAGE:Avg %6.0lf \\n',
GPRINT:variable:CF:Format
variable: To specify the data that is associated with.
CF: Consolidation Function, can be AVERAGE, MINIMUM, MAXIMUM, and LAST
Format: The description shown, the number format and line formatting.
e.g: "Avg %6.0lf \\n" → "Avg" is the textual description, "%6.0lf" is the placeholder for the returned value, the value on the left side of the "." indicates the number of whole digits to show(6) and on the right side of the ".", the amount of decimal digits, in this case (0). "\\n" specify a line return".
Code Block |
---|
%hash = ( 'title' => { 'standard' => '$node - $length from $datestamp_start to $datestamp_end', 'short' => '$node - $length' }, 'vlabel' => { 'standard' => 'IP Packet Statistics', 'short' => 'IP Packet Stats' }, 'option' => { 'standard' => [ 'DEF:ipInReceives=$database:ipInReceives:AVERAGE', 'DEF:ipInDelivers=$database:ipInDelivers:AVERAGE', 'DEF:ipOutRequests=$database:ipOutRequests:AVERAGE', 'DEF:ipForwDatagrams=$database:ipForwDatagrams:AVERAGE', 'LINE1:ipInReceives#ff0000:IP Packets Received', 'GPRINT:ipInReceives:AVERAGE:Avg %6.0lf\\n', 'LINE1:ipInDelivers#000000:IP Packets Local', 'GPRINT:ipInDelivers:AVERAGE:Avg %6.0lf\\n', 'LINE1:ipOutRequests#00FF7F:IP Packets Sent', 'GPRINT:ipOutRequests:AVERAGE:Avg %6.0lf\\n', 'LINE1:ipForwDatagrams#40E0D0:IP Packets Forwarded', 'GPRINT:ipForwDatagrams:AVERAGE:Avg %6.0lf\\n', ] } ); |
...
CDEF: Indicates the Calculation Definition. More details about the RRDtool's CDEF language.
NewVariable= Is the assignation of a new variable to hold the result performed by the calculation.
RPN_expression The Reverse Polish Notation expression used to calculate the new value. More info here.
...
This is how the small version of the graph must look:
[END]
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 | ||
---|---|---|
| ||
%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 | ||
---|---|---|
| ||
--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 | ||
---|---|---|
| ||
'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 | ||
---|---|---|
| ||
'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 | ||
---|---|---|
| ||
'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',
], |
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 | ||
---|---|---|
| ||
'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
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 | ||
---|---|---|
| ||
%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'
]
}
); |
END