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 updating a device, duplicate entry errors occur when inserting to the database #3639

Closed
bmfmancini opened this issue Jun 25, 2020 · 6 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@bmfmancini
Copy link
Member

Hey All,

So we have been moving some devices to SNMP V3 what I notice is that if you update the creds on an exisiting device the error log shows the below

2020/06/25 14:35:31 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-8789' for key 'PRIMARY'
2020/06/25 14:35:00 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-8789' for key 'PRIMARY'

2020/06/25 14:45:20 - CMDPHP SQL Backtrace: (/host.php[60]:form_save(), /host.php[253]:api_device_save(), /lib/api_device.php[730]:api_device_purge_from_remote(), /lib/api_device.php[103]:db_execute_prepared())
2020/06/25 14:35:31 - CMDPHP SQL Backtrace: (/host.php[60]:form_save(), /host.php[253]:api_device_save(), /lib/api_device.php[730]:api_device_purge_from_remote(), /lib/api_device.php[103]:db_execute_prepared())
2020/06/25 14:35:00 - CMDPHP SQL Backtrace: (/host.php[60]:form_save(), /host.php[253]:api_device_save(), /lib/api_device.php[730]:api_device_purge_from_remote(), /lib/api_device.php[103]:db_execute_prepared())
2020/06/25 13:15:14 - CMDPHP SQL Backtrace: (/host.php[60]:form_save(), /host.php[253]:api_device_save(), /lib/api_device.php[730]:api_device_purge_from_remote(), /lib/api_device.php[103]:db_execute_prepared())
2020/06/25 13:15:06 - CMDPHP SQL Backtrace: (/host.php[60]:form_save(), /host.php[253]:api_device_save(), /lib/api_device.php[730]:api_device_purge_from_remote(), /lib/api_device.php[103]:db_execute_prepared())

It looks like a dummy error since the device updates just fine and everything works
but I thought I would bring it up

@bmfmancini bmfmancini added bug Undesired behaviour unverified Some days we don't have a clue labels Jun 25, 2020
@bmfmancini bmfmancini changed the title Duplicate Entry error V1.2.12 Duplicate Entry error when updating device V1.2.12 Jun 25, 2020
@bmfmancini
Copy link
Member Author

One additional Error I found

2020/06/25 15:31:12 - ERROR PHP WARNING: A non-numeric value encountered in file: /var/www/html/cacti/lib/api_device.php on line: 1071

@bmfmancini
Copy link
Member Author

OK did more digging also see the same errors when you do a poller sync only after you make a device change
so I am certain its something to do with the save routine trying to append data in duplicate and only the change actually goes through

2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-9886' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-8725' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-7934' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-7463' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-6461' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-4056' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-2928' for key 'PRIMARY'
2020/06/25 16:20:46 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate entry '7-3-2721' for key 'PRIMARY'

TheWitness added a commit that referenced this issue Jun 27, 2020
- Backtrace Errors attempting to run AUTOM8 to Remote Data Collector
- Duplicate Entry error when updating Device
- This missed a new option to limit device sync to single, or multiple hosts
@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Jun 27, 2020
@TheWitness TheWitness added this to the 1.2.13 milestone Jun 27, 2020
@TheWitness
Copy link
Member

This should be resolved now. Thanks for all the testing.

@bmfmancini
Copy link
Member Author

Thank @TheWitness I will try these fixes and get back to you !

@bmfmancini
Copy link
Member Author

Ok tried the fixes on My lab and prod boxes all working good !

@TheWitness
Copy link
Member

Cool.

@netniV netniV changed the title Duplicate Entry error when updating device V1.2.12 When updating a device, duplicate entry errors occur when inserting to the database Jul 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 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

2 participants