Glen Pitt-Pladdy :: BlogICMP Connectivity Monitoring with Cacti | |||
Recently I was discussing network monitoring with someone and realised ICMP would be very useful to know about. ICMP is the Internet Control Message Protocol - it is the protocol that carries messages about connectivity. As an example, if there is a routing problem then you may well get ICMP type 3 (unreachable) code 0 (network unreachable), so a large increase in this would suggest a routing problem. Likewise, if you got loads of type 3 code 4 (fragmentation needed, but can't fragment) then you would know that there was some packet size related problem. Any distinct changes in ICMP patterns may indicate some change in connectivity. What is better, you don't have to actually ping all destinations which would be impractical anyway - the ICMP is generated on demand as connections are created or fail. It isn't necessarily going to show up everything (eg. packets are just being lost or if inbound connectivity is failing), but provides a useful "passive" way of monitoring a network. I searched around for such a tool.... and found none that where practical for continuous monitoring of networks. The ICMP monitoring tools I could find where predominantly ping tools, but that's not the aim here - I want to passively listen and measure the volumes of different types of ICMP to detect changes in connectivity, and that's most useful if they are graphed to make changing patterns easy to spot. With that in mind I cobbled together one of my own in Perl using the pcap modules to listen for both ICMP (IPv4) and ICMPv6 (IPv6), plus some extension scripts to ship the data via snmpd. Shipping the data via SNMP allows for easy remote monitoring of devices, and makes it rather easy to hook it up to Cacti. Monitoring DaemonThe ICMP monitoring would normally need to run as root to capture packets, and be running continuously so it made sense to write a simple daemon. This runs in the background and periodically writes a stats file in a location of your choosing. This can be read by simple shell scripts to get the data into a form that is useful. The daemon takes 4 arguments:
So for a SNMP set up like I run you would launch the daemon with something like: # ./icmpmond eth0 false 60 /var/local/snmp/icmp Download: ICMP monitoring daemon snmpd ExtensionsThese are really simple shell scripts that loop through all the possibilities. The usual story - add the config to your /etc/snmpd.conf as per the SNMP basics discussed before:
extend icmp6 /etc/snmp/icmp6-stats-total After restarting snmpd it should be able to pick up the counts in the data file. If you are using a custom file/location then you will need to tweak the scripts appropriately. Download: ICMP snmpd extension scripts (tarball) CactiAnd finally a set of Cacti templates to go with these. If you are doing ping monitoring then the "ICMP Types" graphs can get swamped by that so I have also provided a "no Ping" version and a ping graph which can be much clearer under these circumstances. Download: ICMP monitoring Cacti Template The graphs look like this:
|
|||
Disclaimer: This is a load of random thoughts, ideas and other nonsense and is not intended to be taken seriously. I have no idea what I am doing with most of this so if you are stupid and naive enough to believe any of it, it is your own fault and you can live with the consequences. More importantly this blog may contain substances such as humor which have not yet been approved for human (or machine) consumption and could seriously damage your health if taken seriously. If you still feel the need to litigate (or whatever other legal nonsense people have dreamed up now), then please address all complaints and other stupidity to yourself as you clearly "don't get it".
Copyright Glen Pitt-Pladdy 2008-2023
|
Comments:
i follow this article, but i cant do to function, when i run de command with snmpwalk, i see this error, snmpwalk -v 1 -c public 192.168.19.128 NET-SNMP-EXTEND-MIB::nsExtendOutLine."icmp".4
NET-SNMP-EXTEND-MIB::nsExtendOutLine.icmp.4: Unknown Object Identifier (Index out of range: icmp (nsExtendToken))
somebody , can help me, tks
There are multiple possible things which could cause this, but first of all the shell will evaluate the quoting and unless you either escape it or put further quoting around the OID I don't think it will work. Either:
snmpwalk -v 1 -c public 192.168.19.128 NET-SNMP-EXTEND-MIB::nsExtendOutLine.\"icmp\".4
OR
snmpwalk -v 1 -c public 192.168.19.128 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."icmp".4'
See if that solves the problem first