When using structured RRD folders, permission issues may be flagged incorrectly
bernisys opened this issue · comments
Describe the bug
Sometimes it happened to us that the rrd subfolder for a device ID is not created when adding the device.
Then Cacti starts to complain that the webpage has no write access ( -> rrd.php/rrdtool_parse_error() ).
(there's also a little thought conflict here .. seel below)
Cacti version is 1.2.27
To Reproduce
Happens randomly .. hard to say, maybe deleting an existing rrd folder can trigger the error, if the system is not creating it from scratch, when data is delivered for the corresponding device. it could be related to this bug we recently discussed (#
Expected behavior
The descriptions are a bit vague - the webpage actually has write access (as my patch shows), but the folder has not been created upstream, probably because the data has not yet been delivered.
The function only checks the error itself (of course, that's why it is called "rrdtool_parse_error"), but actually this isn't enough to determine the problem. It doesn't try to actually create the folder to see if that is really the error or if something else might have gone wrong.
I created a patch so that the function tries to create the folder and throws an error, if that is not working.
bernisys@5a45d37
But i am not sure about one thing:
The function name could then be a bit inconvenient, it suggests that the function only evaluates (parses) the returned string.
So should this function actually check if a folder can be created?
Or would it be better if the function is renamed and then does the whole bunch of sanity checks on its own?
Additional context
I somehow suspect that the issue might be related to #5797 .. the device was created when we were still on 1.2.18 - now we switched to 1.2.27, but the DB repair was not yet done. We want to observe stability for a bit, and then finally run the repair.
I will try and check the queries @TheWitness sent me and see if any of the buggy data IDs are listed.
You should run:
chown -R apache:apache rra
That's definitely not the issue .. we're doing it the other way around and run apache under cacti:cacti so that we don't even get into that dilemma. It's really a missing folder creation after adding a device. Not sure where this comes from, but if that happens, the GUI suggests the wrong reason. This is why i mentioned the possible relation to the other issue - might be that internally something was not processed properly during device creation, the folder creation gets skipped and now the GUI thinks it cannot write, but that's the wrong assumption and can create confusion.
The 1.2.28 version, and much earlier create the path recursively if the file does not exist. So, there must be some issue there. Review the function rrdtool_function_create()
in lib/rrd.php
and add some instrumentation.
Oh, I'm seeing something here that is wrong. I'm going to make this confirmed.
I think we're getting this in shape together!
Be aware: I am quite pedantic. ;)
BTW did you look into my patch-approach that improves the actual message on the placeholder image?
@bernisys, nope. Lost that one in the wash. Been a crazy week.
Marking this one complete. Hopefully you agree. Log a new issue if there is something that remains.