Added device_id to eventlog table #3682

Merged
merged 1 commit into from Jun 24, 2016

Projects

None yet

5 participants

@laf
Member
laf commented Jun 18, 2016

This is so you can use eventlog items in alerting to match up with a device.

On a large install 4m+ eventlog entries it takes a while to run hence we set the schema version on the first line so now duplicate schema updates are ran. We also go back and update all old entries to have a correct device_id based on host field. This isn't necessary but has been done for completeness.

mysql> ALTER TABLE eventlog ADD device_id INT NOT NULL AFTER host ;
Query OK, 4057885 rows affected (8 min 39.57 sec)
Records: 4057885 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE eventlog ADD INDEX ( device_id ) ;
Query OK, 0 rows affected (33.89 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> UPDATE eventlog SET device_id=host WHERE device_id=0;
Query OK, 4057904 rows affected (6 min 25.35 sec)
Rows matched: 4058103 Changed: 4057904 Warnings: 0

@laf laf Added device_id to eventlog table
110dcae
@laf laf added the Schema label Jun 18, 2016
@Rosiak
Contributor
Rosiak commented Jun 18, 2016

Is this a notification worthy?

@laf
Member
laf commented Jun 18, 2016

Why? The update should just run in the background. Don't think I saw any ill effects whilst running it

@murrant
Contributor
murrant commented Jun 21, 2016

๐Ÿ‘ from me

@f0o f0o merged commit 33b2621 into librenms:master Jun 24, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laf laf deleted the laf:eventlog-device-id branch Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment