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

RRD values are not being properly trimmed #2547

Closed
TheNetworkIsDown opened this issue Mar 20, 2019 · 7 comments
Closed

RRD values are not being properly trimmed #2547

TheNetworkIsDown opened this issue Mar 20, 2019 · 7 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@TheNetworkIsDown
Copy link
Contributor

For some reason, a space has appeared behind the variable and for example "RRDtool Tune Info" chokes on it.

Maybe spaces should be trimmed before inserting any fields into the DB?

(Probably this issue is more broad than only concerning "RRDtool Tune Info"...)

image

@TheNetworkIsDown
Copy link
Contributor Author

Note that ifSpeed in this case is 10000000000 anyhow. If the space is removed then the error message is correct:

RRD maximum for Data Source 'traffic_in' should be '10000000000' etc.

(Because the RRD actually contains 4294967295)

@netniV
Copy link
Member

netniV commented Mar 20, 2019

If have searched for that space and it isn't present in the sources. This suggests it's something that has been done by accident at some point, which will stop the variable translation working properly.

@TheNetworkIsDown
Copy link
Contributor Author

TheNetworkIsDown commented Mar 20, 2019

I guess it is not in the sources. Probably |query_ifSpeed| (note the trailing space) was input by mistake. The space should not trigger any weird behavior though IMHO. Are all inputs trimmed by the code before storing in the DB? Or are they at least trimmed before processing?

@netniV
Copy link
Member

netniV commented Mar 20, 2019

Inputs may be trimmed but inner spaces are not. So if you had entered "|query_ifSpeed| " (with space), that may have lost the trailing space. But inside the text it would be impossible to know if it was a valid space or not.

@TheNetworkIsDown
Copy link
Contributor Author

It's clear that bad spaces in the middle of a string cannot be recognized.

But in this case, adding a trailing space (doesn't even need to be after a variable) breaks certain things.

If I input |query_ifSpeed| (note the trailing space) then RRDtool Tune Info complains:
RRD maximum for Data Source 'traffic_out' should be '4294967295 ' ... /usr/bin/rrdtool tune /srv/www/vhosts/cacti/cacti/rra/9/437.rrd --maximum traffic_out:4294967295

In that case the message is totally confusing because:

  1. The RRD already contains "4294967295" (albeit without a space, obviously, since that is not possible)
  2. The variable in question does not even contain 4294967295 but 40000000000.

If I proceed with removing the trailing space then the message is correct: RRD maximum for Data Source 'traffic_out' should be '40000000000' ... /usr/bin/rrdtool tune /srv/www/vhosts/cacti/cacti/rra/9/437.rrd --maximum traffic_out:40000000000
That is correct since the actual RRD contents are this:

DS[traffic_in] typ: COUNTER     hbt: 600        min: 0.0000     max: 4294967295.0000
DS[traffic_out] typ: COUNTER    hbt: 600        min: 0.0000     max: 4294967295.0000

As such they would need to be changed.

cigamit added a commit that referenced this issue Mar 24, 2019
Trailing spaces: Complaining about Max values in RRD without reason
@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels Mar 24, 2019
@cigamit cigamit added this to the v1.2.3 milestone Mar 24, 2019
@cigamit
Copy link
Member

cigamit commented Mar 24, 2019

Test with the latest lib/rrd.php. Should be resolved now. It's a workaround of course.

@cigamit cigamit closed this as completed Mar 26, 2019
@TheNetworkIsDown
Copy link
Contributor Author

Shouldn't input rather be trimmed at the moment it enters the system? As such one would not need to trim it at each point where it is used later...

@netniV netniV changed the title Trailing spaces: Complaining about Max values in RRD without reason RRD values are not being properly trimmed Mar 30, 2019
@github-actions github-actions bot locked as resolved 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
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants