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 removing graphs by command line, regex is not properly validated when empty #3224

Closed
bmfmancini opened this issue Jan 29, 2020 · 7 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@bmfmancini
Copy link
Member

bmfmancini commented Jan 29, 2020

Hey Guys

This may be or bug or by design but if you run
php remove_graphs.php --graph-regex= --list
you will get a list of all of the devices in your install
Is there supposed to be an error displayed if the regex is null?

This is going to work great for me because I am in the middle of changing our data profile so I need to delete all of my graphs but I could see this being a danger if someone were to issue the force option and forget to add a regex value .....maybe...possibly ??

Here is the output from my test

[root@li1303-178 cli]# php remove_graphs.php --graph-regex= --list
There are 4 Graphs to Remove. Use the --force option to remove these Graphs.
ID GraphName
17 Local Linux Machine - Processes
18 Local Linux Machine - Load Average
19 Local Linux Machine - Logged in Users
20 Local Linux Machine - Memory Usage

[root@li1303-178 cli]# php remove_graphs.php --graph-regex= --force
There are 4 Graphs to Remove. Data Sources will be removed is possible.
[root@li1303-178 cli]#

@bmfmancini
Copy link
Member Author

Oh BTW if it is a bug could we add keep it as a feature say something like
php remove_graphs.php --all
with a confirmation that your about to do something bad(Potentially)
I know that its not something you would do every day but it would come in handy if you need to

@netniV
Copy link
Member

netniV commented Jan 30, 2020

That would work currently because the regex is considered not to have been set, rather than being set to something that will never match. If you had used ' ' after the =, that would have only listed those with a space.

Should that be considered a bug, I think so. If you are setting the regex, you should have a regex.

@bmfmancini
Copy link
Member Author

ok cool
can we add the --all flag ??

@cigamit
Copy link
Member

cigamit commented Jan 31, 2020

Why don't you just change the profile, and repopulate the poller cache, move the RRDfiles to a backup location, wait for the new RRDfiles to be created, and then use the rrd_splice.php tool to stitch the old and the new together?

@bmfmancini
Copy link
Member Author

bmfmancini commented Jan 31, 2020 via email

@bmfmancini
Copy link
Member Author

bmfmancini commented Jan 31, 2020 via email

@cigamit cigamit added the enhancement General tag for an enhancement label Feb 2, 2020
@cigamit
Copy link
Member

cigamit commented Feb 2, 2020

If you are doing something like adding rows to rra's, the splicer will still work. Just make a backup copy of the file before you add rows, and then splice the old into the new. You will see no gaps in the data for areas of rows that were added.

The splicing can be time consuming, so it's best to do it in parallel with as many threads as possible.

@cigamit cigamit changed the title Possible bug with remove_graphs.php Add '--all' option to remove_graphs.php and issue an error if command would result in all graphs being removed and --all not specified Feb 2, 2020
cigamit added a commit that referenced this issue Feb 2, 2020
Add '--all' option to remove_graphs.php and issue an error if command would result in all graphs being removed and --all not specified
@cigamit cigamit added bug Undesired behaviour resolved A fixed issue and removed enhancement General tag for an enhancement labels Feb 2, 2020
@cigamit cigamit added this to the v1.2.9 milestone Feb 2, 2020
@cigamit cigamit closed this as completed Feb 2, 2020
@netniV netniV changed the title Add '--all' option to remove_graphs.php and issue an error if command would result in all graphs being removed and --all not specified When removing graphs by command line, regex is not properly validated when empty Feb 10, 2020
@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
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants