Librenms instance crashed due to hardware failure. Need to know the version from DB schema to restore the backup

Hello Everyone,

My Librenms instance got crashed due to hardware failure. I don’t know the exact version of the librenms which was installed. I have librenms.sql DB backup file. I want to restore the data to the new instance. But it is giving schema error and WebUI is crashing after restoring the data. I believe it’s because probably I am installing different version of librenms which has different schema structure.

Is there a way to identify the version of the old instance from DB file ?

Please help !!

Regards
Shikha

My migrations table has the last applied schema migrations, that might give you a tip:

| 203 | 2021_03_11_003540_rename_toner_table                                       |    18 |
| 204 | 2021_03_11_003713_rename_printer_columns                                   |    18 |
| 205 | 2020_12_14_091314_create_port_groups_table                                 |    19 |
| 206 | 2021_02_09_122930_migrate_to_utf8mb4                                       |    19 |
| 207 | 2020_12_14_091314_create_port_group_port_table                             |    20 |
| 208 | 2021_04_08_151101_add_foreign_keys_to_port_group_port_table                |    20 |
+-----+----------------------------------------------------------------------------+-------+

If you have that in a librenms.sql export file, you can grep the INSERT line out, break it all in to the new lines and print out the last 10 for easy reading:

$ egrep '^INSERT INTO `migrations`' librenms.sql | sed -e 's/),/),\n/g' | tail -10
(199,'2021_02_08_224355_fix_invalid_dates',14),
(200,'2021_02_21_203415_location_add_fixed_coordinates_flag',15),
(201,'2021_03_17_160729_service_templates_cleanup',16),
(202,'2021_03_26_014054_change_cache_to_mediumtext',17),
(203,'2021_03_11_003540_rename_toner_table',18),
(204,'2021_03_11_003713_rename_printer_columns',18),
(205,'2020_12_14_091314_create_port_groups_table',19),
(206,'2021_02_09_122930_migrate_to_utf8mb4',19),
(207,'2020_12_14_091314_create_port_group_port_table',20),
(208,'2021_04_08_151101_add_foreign_keys_to_port_group_port_table',20);

Install latest librenms, Then run daily.sh.
That should clear any migrations missing
Else try running php artisan migrate

Hi Everyone,

I have mounted the librenms hardware to another machine, so I have all the files like- etc, /opt/librenms, rrds. But Database dump file got corrupted. Is there any other way to recover database now ?

Please help !

Regards
Shikha

This topic was automatically closed 186 days after the last reply. New replies are no longer allowed.