Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Cacti's SNMP functions and Data Query XML syntax #470

Closed
arno-st opened this issue Mar 23, 2017 · 4 comments
Closed

Enhance Cacti's SNMP functions and Data Query XML syntax #470

arno-st opened this issue Mar 23, 2017 · 4 comments
Labels
enhancement General tag for an enhancement
Milestone

Comments

@arno-st
Copy link
Contributor

arno-st commented Mar 23, 2017

I need to add the -Ox option to some snmp_get query, is there a way of doing it ?
otherwise net_snmp is interpreting the output of any snmp_get and it will give a bad value

Here is 2 queries, first with the option -Ox,
[root@lslcact01:/usr/share/cacti/plugins/linkdiscovery] # snmpwalk -v2c -ctelvlsn se-sve-225 -Ox .1.3.6.1.4.1.9.9.23.1.2.1.1.4
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = Hex-STRING: 0A 55 79 43
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10109.2 = Hex-STRING: 0A 55 00 E0
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.5 = Hex-STRING: 0A 55 00 01

[root@lslcact01:/usr/share/cacti/plugins/linkdiscovery] # snmpwalk -v2c -ctelvlsn se-sve-225 .1.3.6.1.4.1.9.9.23.1.2.1.1.4
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10108.3 = STRING: "
UyC"
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10109.2 = Hex-STRING: 0A 55 00 E0
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.5 = Hex-STRING: 0A 55 00 01

from an email I get on the net-snmp mailing list if snmpwalk receive character higher than 0x20 it will interpret it, no if it's under 0x20.
So since the record I pull is IP address, when I receive 0x79 (the third number) all string is higher than 0x20, so snmpwalk is interpreting it, and give a CR (0x0a), so Cacti is taking this CR and return false result, actually it will give me 4 records from this snmpwalk instead of 3.

The only option is to tel snmpwalk to do print all field in ex format, option -Ox.
You can look into github closed issue #288 but the snmp_get_raw dosen't fix the issue, since it's from the way snmpget (walk) handle the value it read from the snmp queries, and not from cacti

@cigamit
Copy link
Member

cigamit commented Mar 23, 2017

There is another ticket open on this subject. We are going to add it to the SNMP functions. However, neither the php-snmp library function calls or the class object are supporting output formats. So, we are going to call the native snmp* commands to execute it. Should only take a few days to complete. We will additionally look at enhancing php-snmp moving forward.

@cigamit cigamit added the enhancement General tag for an enhancement label Mar 23, 2017
@cigamit cigamit modified the milestone: Cacti Release 1.2.0 Mar 27, 2017
@cigamit
Copy link
Member

cigamit commented May 13, 2017

I'm going to modify the title of this one. Going to make it adopt the following requirements.

  1. Option to request output of HEX, for developers who wish to force HEX output. Make this an input option for Data Query XML as well.
  2. Built in behavior to not sanitize the 'walk' functions as they are primarily used for Data Query's, as we often times optimize out valuable information.

After which, I don't want to be touching this function again.

@cigamit cigamit changed the title Add option to snmp_get / snmp_walk to be able to push it to net_snmp Enhance Cacti's SNMP functions and Data Query XML syntax May 13, 2017
@cigamit
Copy link
Member

cigamit commented May 13, 2017

Additionally:

  1. To assume a numeric format for snmpget output, converting hex to numeric in the process

cigamit added a commit that referenced this issue May 14, 2017
Enhance Cacti's SNMP function and Data Query XML syntax.  Add
<output_format>hex|string|guess</output_format> tag
@cigamit
Copy link
Member

cigamit commented May 14, 2017

Okay resolved now. Not only do the SNMP functions support the $value_output_format variable now, the Data Query XML tags do as well. You need to test this right away. Your HEX2DEC code remained unchanged though.

@cigamit cigamit closed this as completed May 14, 2017
ronytomen pushed a commit that referenced this issue May 21, 2017
Enhance Cacti's SNMP function and Data Query XML syntax.  Add
<output_format>hex|string|guess</output_format> tag
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement General tag for an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants