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

cacti.log show Duplicate entry for table 'snmpagent_cache' #2280

Closed
ddb4github opened this issue Jan 7, 2019 · 1 comment
Closed

cacti.log show Duplicate entry for table 'snmpagent_cache' #2280

ddb4github opened this issue Jan 7, 2019 · 1 comment
Labels
resolved A fixed issue

Comments

@ddb4github
Copy link
Contributor

cacti.log

2019/01/07  15:10:04 - CMDPHP SQL Backtrace:   (/poller.php[788]:snmpagent_poller_bottom(),  /lib/snmpagent.php[519]:MibCache->insert(),  /lib/mib_cache.php[211]:db_execute_prepared())
--
2019/01/07 15:10:04 - CMDPHP ERROR: A DB Exec Failed!, Error:  Duplicate entry '.1.3.6.1.4.1.23925.1.16.1.5.1' for key 'PRIMARY'

Suggest diff as:

--- lib/mib_cache.php        2018-11-26 13:59:58.000000000 +0800
+++ lib/mib_cache.php   2019-01-07 15:32:15.692192704 +0800
@@ -203,7 +203,7 @@
                                                $column_params['value'] = $values[$column_params['name']];
                                        }

-                                       db_execute_prepared('INSERT INTO `snmpagent_cache`
+                                       db_execute_prepared('INSERT IGNORE INTO `snmpagent_cache`
                                                (`oid`, `name`, `mib`, `type`, `otype`, `kind`, `max-access`, `value`)
                                                VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
                                                array($column_params['oid'], $column_params['name'], $column_params['mib'],
cigamit added a commit that referenced this issue Jan 7, 2019
SQL Errors in snmpagent cache table inserts
@cigamit
Copy link
Member

cigamit commented Jan 7, 2019

Pull requests are better. This one I would have rejected. It was that way previously, but the original author rejected the change, so it was reverted to what it is today. I have resolved using ON DUPLICATE KEY UPDATE instead.

@cigamit cigamit closed this as completed Jan 7, 2019
@cigamit cigamit added the resolved A fixed issue label Jan 8, 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
resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

2 participants