New device creation fail

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

New device creation fail

#1 Post by dsmelk » Fri Dec 13, 2019 3:54 pm

Hi everybody,

Since yesterday I started to get this message attached when I try to create a new device linked to any template.
The message is: SQL Save on table 'data_template_data': Column 'local_graph_template_graph_id' does not exist, unable to save
Selection_003.png
Selection_003.png (11.24 KiB) Viewed 702 times
I already figured out the Device is shown after error message but with no Data Source, I mean, the discovery process shows the items but when I click in Data Source for those specific devices, it is empty.

Discovered Items
Selection_007.png
Selection_007.png (32.09 KiB) Viewed 702 times
Empty Data Source Page
Selection_006.png
Selection_006.png (21.09 KiB) Viewed 702 times
I already checked my MariaDB database and found no errors, I also search for this Column local_graph_template_graph_id on data_template_data and didn't find anything.

Any clue?
Davyd Silva - 8)

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: New device creation fail

#2 Post by netniV » Fri Dec 13, 2019 6:04 pm

Do the following and post the result:

Code: Select all

show create table `data_template_data`\G

User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

Re: New device creation fail

#3 Post by dsmelk » Fri Dec 13, 2019 9:41 pm

Hi, result below:

MariaDB [cacti]> show create table `data_template_data`\G
*************************** 1. row ***************************
Table: data_template_data
Create Table: CREATE TABLE `data_template_data` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`local_data_template_data_id` mediumint(8) unsigned NOT NULL DEFAULT 0,
`local_data_id` mediumint(8) unsigned NOT NULL DEFAULT 0,
`data_template_id` mediumint(8) unsigned NOT NULL DEFAULT 0,
`data_input_id` mediumint(8) unsigned NOT NULL DEFAULT 0,
`t_name` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
`name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`name_cache` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`data_source_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`t_active` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
`active` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
`t_rrd_step` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
`rrd_step` mediumint(8) unsigned NOT NULL DEFAULT 0,
`t_data_source_profile_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
`data_source_profile_id` mediumint(8) unsigned NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `local_data_id` (`local_data_id`),
KEY `data_template_id` (`data_template_id`),
KEY `data_input_id` (`data_input_id`),
KEY `data_source_path` (`data_source_path`),
KEY `name_cache` (`name_cache`(191))
) ENGINE=InnoDB AUTO_INCREMENT=874524 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)
Davyd Silva - 8)

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: New device creation fail

#4 Post by netniV » Mon Dec 16, 2019 12:24 pm

Can you give the exact steps to reproduce this as the column doesn't exist, nor does it in mine. So I think something weird is going on here.

User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

Re: New device creation fail

#5 Post by dsmelk » Mon Dec 16, 2019 12:45 pm

Hi netniV, sorry for not having included the details.

My environment:
  • Cacti Version: 1.2.7 (with spine)
  • 01 Frontend, 01 Database, 03 Remote Collectors
  • Database: MariaDB 10.4.8
Important Notes:
  • My cacti were upgraded from 0.8.8b
  • I imported over 500 scripts + 3000 devices and 60 templates
The DB was working relatively fine until last Friday when it started to show the table error message during the deploy for new devices.

The very first error that I got was like:
  • I found a device that not collect data since the upgrade, and I saw the collect items were on FrontEnd but not inserted on the Remote Collector Backend
  • My idea was to duplicate the device to force cacti to create a new one and rebuild the index
  • When I manually duplicate de configuration and select the Device template and save, I got the error message
  • After that, no matter the template I choose for this or any other device, the error message is the same.
Selection_003.png
Selection_003.png (11.24 KiB) Viewed 670 times
Davyd Silva - 8)

cigamit
Developer
Posts: 2831
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: New device creation fail

#6 Post by cigamit » Mon Dec 16, 2019 10:53 pm

Does the Cacti log show the full SQL command that is erroring out?

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: New device creation fail

#7 Post by netniV » Tue Dec 17, 2019 9:30 am

Hold on... there are two messages, this means that something else is trying to save after the original save. Do you have any plugins enabled? And don't forget to answer cigamit's question too.

User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

Re: New device creation fail

#8 Post by dsmelk » Tue Dec 17, 2019 11:05 am

Hi cigamit,

I did enable the MariaDB queries log and what I got was:
~# cat /common/mysql-log/queries.log |grep local_graph_template_graph_id
35360723 Query SELECT local_graph_template_graph_id FROM graph_templates_graph WHERE local_graph_id = '767941'
35360723 Query INSERT INTO graph_templates_graph (`id`, `local_graph_template_graph_id`, `local_graph_id`, `graph_template_id`, `title`, `vertical_label`, `image_format_id`, `height`, `width`, `base_value`, `slope_mode`, `auto_scale`, `auto_scale_opts`, `auto_scale_log`, `scale_log_units`, `auto_scale_rigid`, `upper_limit`, `lower_limit`, `unit_value`, `unit_exponent_value`, `unit_length`, `no_gridfit`, `alt_y_grid`, `right_axis`, `right_axis_label`, `right_axis_format`, `right_axis_formatter`, `left_axis_formatter`, `auto_padding`, `dynamic_labels`, `force_rules_legend`, `tab_width`, `legend_position`, `legend_direction`) VALUES (0, 8, 767941, 8, '|host_description| - Processes', 'processes', 1, 120, 500, 1000, 'on', 'on', 2, '', '', '', '100', '0', '', '', NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 'on', NULL, NULL, '30', NULL, NULL) ON DUPLICATE KEY UPDATE `local_graph_template_graph_id`=VALUES(`local_graph_template_graph_id`), `local_graph_id`=VALUES(`local_graph_id`), `graph_template_id`=VALUES(`graph_template_id`), `title`=VALUES(`title`), `vertical_label`=VALUES(`vertical_label`), `image_format_id`=VALUES(`image_format_id`), `height`=VALUES(`height`), `width`=VALUES(`width`), `base_value`=VALUES(`base_value`), `slope_mode`=VALUES(`slope_mode`), `auto_scale`=VALUES(`auto_scale`), `auto_scale_opts`=VALUES(`auto_scale_opts`), `auto_scale_log`=VALUES(`auto_scale_log`), `scale_log_units`=VALUES(`scale_log_units`), `auto_scale_rigid`=VALUES(`auto_scale_rigid`), `upper_limit`=VALUES(`upper_limit`), `lower_limit`=VALUES(`lower_limit`), `unit_value`=VALUES(`unit_value`), `unit_exponent_value`=VALUES(`unit_exponent_value`), `unit_length`=VALUES(`unit_length`), `no_gridfit`=VALUES(`no_gridfit`), `alt_y_grid`=VALUES(`alt_y_grid`), `right_axis`=VALUES(`right_axis`), `right_axis_label`=VALUES(`right_axis_label`), `right_axis_format`=VALUES(`right_axis_format`), `right_axis_formatter`=VALUES(`right_axis_formatter`), `left_axis_formatter`=VALUES(`left_axis_formatter`), `auto_padding`=VALUES(`auto_padding`), `dynamic_labels`=VALUES(`dynamic_labels`), `force_rules_legend`=VALUES(`force_rules_legend`), `tab_width`=VALUES(`tab_width`), `legend_position`=VALUES(`legend_position`), `legend_direction`=VALUES(`legend_direction`)
35360723 Query SELECT local_graph_template_graph_id FROM graph_templates_graph WHERE local_graph_id = '767942'
35360723 Query INSERT INTO graph_templates_graph (`id`, `local_graph_template_graph_id`, `local_graph_id`, `graph_template_id`, `title`, `vertical_label`, `image_format_id`, `height`, `width`, `base_value`, `slope_mode`, `auto_scale`, `auto_scale_opts`, `auto_scale_log`, `scale_log_units`, `auto_scale_rigid`, `upper_limit`, `lower_limit`, `unit_value`, `unit_exponent_value`, `unit_length`, `no_gridfit`, `alt_y_grid`, `right_axis`, `right_axis_label`, `right_axis_format`, `right_axis_formatter`, `left_axis_formatter`, `auto_padding`, `dynamic_labels`, `force_rules_legend`, `tab_width`, `legend_position`, `legend_direction`) VALUES (0, 9, 767942, 9, '|host_description| - Load Average', 'processes in the run queue', 1, 120, 500, 1000, 'on', 'on', 2, '', '', 'on', '100', '0', '', '0', NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 'on', NULL, NULL, '30', NULL, NULL) ON DUPLICATE KEY UPDATE `local_graph_template_graph_id`=VALUES(`local_graph_template_graph_id`), `local_graph_id`=VALUES(`local_graph_id`), `graph_template_id`=VALUES(`graph_template_id`), `title`=VALUES(`title`), `vertical_label`=VALUES(`vertical_label`), `image_format_id`=VALUES(`image_format_id`), `height`=VALUES(`height`), `width`=VALUES(`width`), `base_value`=VALUES(`base_value`), `slope_mode`=VALUES(`slope_mode`), `auto_scale`=VALUES(`auto_scale`), `auto_scale_opts`=VALUES(`auto_scale_opts`), `auto_scale_log`=VALUES(`auto_scale_log`), `scale_log_units`=VALUES(`scale_log_units`), `auto_scale_rigid`=VALUES(`auto_scale_rigid`), `upper_limit`=VALUES(`upper_limit`), `lower_limit`=VALUES(`lower_limit`), `unit_value`=VALUES(`unit_value`), `unit_exponent_value`=VALUES(`unit_exponent_value`), `unit_length`=VALUES(`unit_length`), `no_gridfit`=VALUES(`no_gridfit`), `alt_y_grid`=VALUES(`alt_y_grid`), `right_axis`=VALUES(`right_axis`), `right_axis_label`=VALUES(`right_axis_label`), `right_axis_format`=VALUES(`right_axis_format`), `right_axis_formatter`=VALUES(`right_axis_formatter`), `left_axis_formatter`=VALUES(`left_axis_formatter`), `auto_padding`=VALUES(`auto_padding`), `dynamic_labels`=VALUES(`dynamic_labels`), `force_rules_legend`=VALUES(`force_rules_legend`), `tab_width`=VALUES(`tab_width`), `legend_position`=VALUES(`legend_position`), `legend_direction`=VALUES(`legend_direction`)
35360723 Query SELECT local_graph_template_graph_id FROM graph_templates_graph WHERE local_graph_id = '767943'
35360723 Query INSERT INTO graph_templates_graph (`id`, `local_graph_template_graph_id`, `local_graph_id`, `graph_template_id`, `title`, `vertical_label`, `image_format_id`, `height`, `width`, `base_value`, `slope_mode`, `auto_scale`, `auto_scale_opts`, `auto_scale_log`, `scale_log_units`, `auto_scale_rigid`, `upper_limit`, `lower_limit`, `unit_value`, `unit_exponent_value`, `unit_length`, `no_gridfit`, `alt_y_grid`, `right_axis`, `right_axis_label`, `right_axis_format`, `right_axis_formatter`, `left_axis_formatter`, `auto_padding`, `dynamic_labels`, `force_rules_legend`, `tab_width`, `legend_position`, `legend_direction`) VALUES (0, 10, 767943, 10, '|host_description| - Logged in Users', 'users', 1, 120, 500, 1000, 'on', 'on', 2, '', '', 'on', '100', '0', '', '', NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 'on', NULL, NULL, '30', NULL, NULL) ON DUPLICATE KEY UPDATE `local_graph_template_graph_id`=VALUES(`local_graph_template_graph_id`), `local_graph_id`=VALUES(`local_graph_id`), `graph_template_id`=VALUES(`graph_template_id`), `title`=VALUES(`title`), `vertical_label`=VALUES(`vertical_label`), `image_format_id`=VALUES(`image_format_id`), `height`=VALUES(`height`), `width`=VALUES(`width`), `base_value`=VALUES(`base_value`), `slope_mode`=VALUES(`slope_mode`), `auto_scale`=VALUES(`auto_scale`), `auto_scale_opts`=VALUES(`auto_scale_opts`), `auto_scale_log`=VALUES(`auto_scale_log`), `scale_log_units`=VALUES(`scale_log_units`), `auto_scale_rigid`=VALUES(`auto_scale_rigid`), `upper_limit`=VALUES(`upper_limit`), `lower_limit`=VALUES(`lower_limit`), `unit_value`=VALUES(`unit_value`), `unit_exponent_value`=VALUES(`unit_exponent_value`), `unit_length`=VALUES(`unit_length`), `no_gridfit`=VALUES(`no_gridfit`), `alt_y_grid`=VALUES(`alt_y_grid`), `right_axis`=VALUES(`right_axis`), `right_axis_label`=VALUES(`right_axis_label`), `right_axis_format`=VALUES(`right_axis_format`), `right_axis_formatter`=VALUES(`right_axis_formatter`), `left_axis_formatter`=VALUES(`left_axis_formatter`), `auto_padding`=VALUES(`auto_padding`), `dynamic_labels`=VALUES(`dynamic_labels`), `force_rules_legend`=VALUES(`force_rules_legend`), `tab_width`=VALUES(`tab_width`), `legend_position`=VALUES(`legend_position`), `legend_direction`=VALUES(`legend_direction`)
35360723 Query SELECT local_graph_template_graph_id FROM graph_templates_graph WHERE local_graph_id = '767944'
35360723 Query INSERT INTO graph_templates_graph (`id`, `local_graph_template_graph_id`, `local_graph_id`, `graph_template_id`, `title`, `vertical_label`, `image_format_id`, `height`, `width`, `base_value`, `slope_mode`, `auto_scale`, `auto_scale_opts`, `auto_scale_log`, `scale_log_units`, `auto_scale_rigid`, `upper_limit`, `lower_limit`, `unit_value`, `unit_exponent_value`, `unit_length`, `no_gridfit`, `alt_y_grid`, `right_axis`, `right_axis_label`, `right_axis_format`, `right_axis_formatter`, `left_axis_formatter`, `auto_padding`, `dynamic_labels`, `force_rules_legend`, `tab_width`, `legend_position`, `legend_direction`) VALUES (0, 12, 767944, 12, '|host_description| - Memory Usage', 'kilobytes', 1, 120, 500, 1000, 'on', 'on', 2, '', '', 'on', '100', '0', '', '', NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 'on', NULL, NULL, '30', NULL, NULL) ON DUPLICATE KEY UPDATE `local_graph_template_graph_id`=VALUES(`local_graph_template_graph_id`), `local_graph_id`=VALUES(`local_graph_id`), `graph_template_id`=VALUES(`graph_template_id`), `title`=VALUES(`title`), `vertical_label`=VALUES(`vertical_label`), `image_format_id`=VALUES(`image_format_id`), `height`=VALUES(`height`), `width`=VALUES(`width`), `base_value`=VALUES(`base_value`), `slope_mode`=VALUES(`slope_mode`), `auto_scale`=VALUES(`auto_scale`), `auto_scale_opts`=VALUES(`auto_scale_opts`), `auto_scale_log`=VALUES(`auto_scale_log`), `scale_log_units`=VALUES(`scale_log_units`), `auto_scale_rigid`=VALUES(`auto_scale_rigid`), `upper_limit`=VALUES(`upper_limit`), `lower_limit`=VALUES(`lower_limit`), `unit_value`=VALUES(`unit_value`), `unit_exponent_value`=VALUES(`unit_exponent_value`), `unit_length`=VALUES(`unit_length`), `no_gridfit`=VALUES(`no_gridfit`), `alt_y_grid`=VALUES(`alt_y_grid`), `right_axis`=VALUES(`right_axis`), `right_axis_label`=VALUES(`right_axis_label`), `right_axis_format`=VALUES(`right_axis_format`), `right_axis_formatter`=VALUES(`right_axis_formatter`), `left_axis_formatter`=VALUES(`left_axis_formatter`), `auto_padding`=VALUES(`auto_padding`), `dynamic_labels`=VALUES(`dynamic_labels`), `force_rules_legend`=VALUES(`force_rules_legend`), `tab_width`=VALUES(`tab_width`), `legend_position`=VALUES(`legend_position`), `legend_direction`=VALUES(`legend_direction`)


What I got from Cacti LOG it was:
Screenshot_10.png
Screenshot_10.png (49.12 KiB) Viewed 603 times
Davyd Silva - 8)

User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

Re: New device creation fail

#9 Post by dsmelk » Tue Dec 17, 2019 11:08 am

netniV wrote:
Tue Dec 17, 2019 9:30 am
Hold on... there are two messages, this means that something else is trying to save after the original save. Do you have any plugins enabled? And don't forget to answer cigamit's question too.
Yes, checking this time I see 3 plugins, but I'm not sure if they came up after import the DB from 0.8.8b

Do you think this could cause problems?
Screenshot_11.png
Screenshot_11.png (23.13 KiB) Viewed 603 times
Davyd Silva - 8)

User avatar
dsmelk
Posts: 15
Joined: Thu Feb 14, 2019 7:10 am

Re: New device creation fail

#10 Post by dsmelk » Wed Dec 18, 2019 10:44 am

Hello guys, thanks for helping me.

I just downloaded the cacti 1.2.7 install package again and ran a diff from my files. I found some of my PHP files were corrupted and just did a new copy and the problem seems to be fixed.

Thank you all.
Davyd Silva - 8)

Post Reply