Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 404 forks source link

Allow monitoring IPv6 with interface graphs #4404

Closed gj00354347 closed 3 years ago

gj00354347 commented 3 years ago

Feature Request

A few weeks back the Network Ops Team has requested us to monitor the IPv6 KPI in cacti , we are on 1.2.18 . One of the typical request was like in cacti in Interface Traffic KPI we used to put |query_ifIP| in the graph title and graph name so this time we wanted to put IPv6 IP in the graph name .

But the challenge that we are facing here is that in IPv6 OID Table , the IPV6 IP is suffixed to OID itself and it is present on the left side of the OID Table and index on the right side .

situation is like IPv6 is encoded as byte-values within the OIDs of the SNMP table itself, and we are not sure if cacti is able to handle this type of entry.

below is example

IP-MIB::ipAddressIfIndex.ipv6."2x:xx:xx:xx:xx:xx:10:20:00:xx:00:00:00:xx:00:04" = INTEGER: 585

The hex-part for the IPv6 address is encoded part at the end of the OID.

The byte sequence in the OID is: 42.1.8.135.16.1.16.32.0.1.0.0.0.0.0.4

which is the binary form for 2aXX:0XX7:xxxx:xxxx:1::4

so is it possible in cacti to extract this info and yes then will you please throw some light how to achieve this .

Many thanks in advance Gopal

TheWitness commented 3 years ago

Yea, it's supported. You have to create a new column in the xml file and call it ipv6_address or something and then use a regex replace like the IP address. You should upload you revised resource xml file here, or create a pull request when done with it.

bernisys commented 3 years ago

Hi Larry,

So you mean, we just need to extract the byte-notation and put it into the value of the "ipv6_address" field, then cacti takes care internally, in case the dotted notation in the passed string matches the 16 bytes describing an IPv6 address? That should be easily doable, and yes of course can we provide a pull. I think we have added also a few other elements to the XML already, which could be interesting for the community.

TheWitness commented 3 years ago

Well, upon further investigation, the parsing was not too exceptional. So, I'm going to make a small change to lib/data_query.php and resource/snmp_queries/interface.xml to exploit this.

The change to interface.xml will be the following:

        <ifIPv6>
            <name>IPv6 Address</name>
            <method>walk</method>
            <source>OID2HEX/REGEXP:^\.?1\.3\.6\.1\.2\.1\.4\.34\.1\.3\.2\.16\.(*)</source>
            <direction>input</direction>
            <oid>.1.3.6.1.2.1.4.34.1.3.2.16</oid>
        </ifIPv6>

Then, you will need to alter your suggested values to use the new IPv6 column.

gj00354347 commented 3 years ago

Thanks for the code .

I put it in interface.xml which was until now used for IPv4 KPI but just appended this IPv6 KPI XML , for extracting IPv6 IP . After that I did reindexing but ideally there should be a column for IPv6 which I cannot see .PFA screenshot

interface-xml

is it because below mentioned values are applicable only for IPv4 and they have been defined on top of interface.xml or is it because I see there are some chnages which you have done in lib/data_query.php and I will have to import the new lib/data_query.php from dev branch of cacti .

.1.3.6.1.2.1.2.2.1.1 .1.3.6.1.2.1.2.1.0

so Do I have to modify the interface.xml or import the latest changes from lib/data_query.php from dev branch . I am on 1.2.18 .

Best Regards, Gopal

bernisys commented 3 years ago

Do you think this is really enough? Haven't looked completely into it at this point in time, but as far as i remember the index for the IPv4 objects should be a different one than for the IPv6 objects. For me this seems to look a lot more complex, as you need to identify the correct relationship between the interface ID and the IPv6 object.

Gopal will check if this is the case and report back to you.

TheWitness commented 3 years ago

Here is the output from the verbose query for one of my devices.

image

Not sure why I'm not seeing things show up on the Graphs New page yet though.

TheWitness commented 3 years ago

I might have to re-open this one.

TheWitness commented 3 years ago

This looks better. It was operator error. MySQL search is not case sensitive, by PHP is.

image