Cacti / cacti

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

Allow Mib usage for specific data query #3176

Closed sysres-dev closed 4 years ago

sysres-dev commented 4 years ago

Is your feature request related to a problem? Please describe. In some cases for snmp data queries, it happens to have hexstring instead of its value : image

I noticed for some reason cacti doesnt include mibs in its snmp commands, which lead in my case in situations where i end up with hex graphs names, when i run same commands with and without mibs includes, i reproduce the behavior :

# snmpbulkwalk -v3 -l authPriv -u community -x AES -X XXXXX -a SHA -A XXXXX 1.2.3.4  .1.3.6.1.4.1.41263.8.1.3 
SNMPv2-SMI::enterprises.41263.8.1.3.1 = Hex-STRING: 4E 75 74 61 6E 69 78 4D 61 6E 61 67 65 6D 65 6E
74 53 68 61 72 65 00
SNMPv2-SMI::enterprises.41263.8.1.3.2 = Hex-STRING: 53 65 6C 66 53 65 72 76 69 63 65 43 6F 6E 74 61
69 6E 65 72 00
SNMPv2-SMI::enterprises.41263.8.1.3.3 = Hex-STRING: 64 65 66 61 75 6C 74 2D 63 6F 6E 74 61 69 6E 65
72 2D 38 37 33 36 38 30 30 33 37 38 39 36 31 37
00
# snmpbulkwalk -v3 -l authPriv -u community -x AES -X XXXXX -a SHA -A XXXXX 1.2.3.4 .1.3.6.1.4.1.41263.8.1.3 -m +ALL
NUTANIX-MIB::citContainerName.1 = STRING: NutanixManagementShare.
NUTANIX-MIB::citContainerName.2 = STRING: SelfServiceContainer.
NUTANIX-MIB::citContainerName.3 = STRING: default-container-87368003789617.

Describe the solution you'd like Possibility to enable of disable mib usage for a given data query on device page when launching a reload.

Describe alternatives you've considered Put oid used by data query in a wrapper script.

Additional context Technical Support [Summary] Date | Fri, 28 Feb 2020 18:35:10 +0100 Cacti Version | 1.1.38 Cacti OS | unix NET-SNMP Version | NET-SNMP version: 5.7.2 RRDtool Version | RRDtool 1.4.x Devices | 35319 Graphs | 597661

cigamit commented 4 years ago

Version of Cacti, and a description of the Data Query? Is it one of ours?

cigamit commented 4 years ago

For the <input> types, there is a tag that you can add to the Resource XML file calle:

<output_format>ascii</output_format>

Adding this to your Resource XML file, followed by a re-index, should solve your problem.

cigamit commented 4 years ago

This is documented, though maybe without a real good example. You should consider using this case to provide an example for our documentation. A pull request in that repository would be a nice way to give back to the project.

Here is a link to the page...

https://github.com/Cacti/documentation/blob/develop/Data-Queries.md

sysres-dev commented 4 years ago

I missed this possibility in the doc, Thanks !

I added the output_format to the xml, but after a polling (to wait to have the xml updated on the poller), and after multiple reindex of the data query, it seems to have lost track of the values : image

Here is the complete xml file :

<interface>
        <name>Nutanix Container Data</name>
        <description>Nutanix Container Data</description>
        <oid_index>.1.3.6.1.4.1.41263.8.1.1</oid_index>
        <index_order>citIndex</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>
        <fields>
                <citIndex>
                        <name>Container Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <output_format>ascii</output_format>
                        <oid>.1.3.6.1.4.1.41263.8.1.1</oid>
                </citIndex>
                <citName>
                        <name>Container Name</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <output_format>ascii</output_format>
                        <oid>.1.3.6.1.4.1.41263.8.1.3</oid>
                </citName>
                <citTotalCapacity>
                        <name>Container Total Capacity</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.41263.8.1.4</oid>
                </citTotalCapacity>
                <citUsedCapacity>
                        <name>Container Used Capacity</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.41263.8.1.5</oid>
                </citUsedCapacity>
                <citIOPerSecond>
                        <name>Container IOPS</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.41263.8.1.6</oid>
                </citIOPerSecond>
                <citAvgLatencyUsecs>
                        <name>Container Average Usec latency</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.41263.8.1.7</oid>
                </citAvgLatencyUsecs>
                <citIOBandwidth>
                        <name>Container IO Bandwitdh</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.41263.8.1.8</oid>
                </citIOBandwidth>
        </fields>
</interface>

Also, our cacti version is 1.1.38 and the data query is handmade, i attached it to the comment.

cacti_data_querynutanix-_container.zip

sysres-dev commented 4 years ago

The issue with previous information is still valid, what can we do about it ?

sysres-dev commented 4 years ago

Hello, I looked at the code, output_format with ascii parameter sets SNMP_STRING_OUTPUT_ASCII, but it doesn't seems to be used in either snmp.php or data_query.php to change output (i'm in 1.1.38).

EDIT : I realized i forgot to give you additional context, i've updated the initial post with it, sorry !

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.