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

Allow command line reindex to work with disabled devices #4193

Closed
zuka1337 opened this issue Mar 22, 2021 · 1 comment
Closed

Allow command line reindex to work with disabled devices #4193

zuka1337 opened this issue Mar 22, 2021 · 1 comment
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@zuka1337
Copy link

zuka1337 commented Mar 22, 2021

Describe the bug

When running poller_reindex_hosts.php script I've noticed that it try to reindex disabled devices.

To Reproduce

Steps to reproduce the behavior:

Run the script with:
/usr/bin/php poller_reindex_hosts.php --id=all --qid=all --debug
grep any disabled devices id

Expected behavior

Expect to reindex only enabled devices

I tryed this:

/* determine the hosts to reindex */
if (strtolower($host_id) == 'all') {
        $sql_where = '';
}else if (is_numeric($host_id) && $host_id > 0) {
        $sql_where = 'WHERE host_id = ' . $host_id . "'AND disabled NOT LIKE 'on'"; <---
} else {
        print "ERROR: You must specify either a host_id or 'all' to proceed.\n";
        display_help();
        exit;
}

Does not work..

Cacti 1.2.16
Centos 7

@zuka1337 zuka1337 added bug Undesired behaviour unverified Some days we don't have a clue labels Mar 22, 2021
TheWitness added a commit that referenced this issue Mar 23, 2021
- Script poller_reindex_hosts.php | Try to Reindex disabled devices
- Added better verbose output when using --debug option
- Moved query to prepared statements for security
- Report orphan and item counts too
@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Mar 23, 2021
@TheWitness TheWitness added this to the v1.2.17 milestone Mar 23, 2021
@zuka1337
Copy link
Author

That's some impressive work, thank you for all the effort!!!
Working as speected !!!

@netniV netniV changed the title Script poller_reindex_hosts.php | Try to Reindex disabled devices Allow command line reindex to work with disabled devices Apr 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2021
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

2 participants