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

When an OID starts with space, SNMP returns undefined data #4492

Closed
xmacan opened this issue Dec 3, 2021 · 4 comments
Closed

When an OID starts with space, SNMP returns undefined data #4492

xmacan opened this issue Dec 3, 2021 · 4 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@xmacan
Copy link
Member

xmacan commented Dec 3, 2021

Creating new graph with generic OID template. If OID starts with space, the output of snmp query is:
POLLER: Poller[1] PID[52707] Device[1] DS[23] TT[4.51] SNMP: v2: 127.0.0.1, dsname: snmp_oid, oid: .1.3.6.1.2.1.25.2.3.1.6.7, output: U

Easy fix - in snmp.php in function cacti_snmp_session_get add trim:
$out = @$session->get(trim($oid));

I'm not doing PR, because this also applies to other functions (.._getnext,...) and you may want to solve it somehow in a systematic way.

Current 1.2.x branch

@xmacan xmacan added bug Undesired behaviour unverified Some days we don't have a clue labels Dec 3, 2021
@netniV
Copy link
Member

netniV commented Dec 3, 2021

An OID should never start with a space, so I don't think this is really something that we should handle. If a space is being inserted, it should be sorted at the source.

@xmacan
Copy link
Member Author

xmacan commented Dec 8, 2021

@netniV - There isn't any user input check, so an error can easily happen. It is not easy to find the error, because even in the log you can easily miss the extra space:
Device[1] DS[23] TT[4.51] SNMP: v2: 127.0.0.1, dsname: snmp_oid, **oid: .1.3.6.**1.2.1.25.2.3.1.6.7, output: U

If you don't agree with fix, I'll at least add a test to Intropage (Analyze cacti objects)

@TheWitness
Copy link
Member

Trim would add a few cycles, but not too much in today's world. I'm surprised that the underlying stack is not handing this correctly. Might be something that's version dependent.

@TheWitness TheWitness added this to the v1.2.20 milestone Dec 10, 2021
TheWitness added a commit that referenced this issue Feb 4, 2022
Output = U when OID starts with space
@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Feb 4, 2022
@TheWitness
Copy link
Member

I made an executive decision on this one. Most are using spine anyway. This is more important for little installs.

@netniV netniV changed the title Output = U when OID starts with space When an OID starts with space, SNMP returns undefined data Apr 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants