Problems with Thold update 0.3.9 -> 0.4.1 (SQL Error)

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
kyosanim
Posts: 37
Joined: Thu Apr 05, 2007 5:33 am

Problems with Thold update 0.3.9 -> 0.4.1 (SQL Error)

Post by kyosanim »

Hi guys,
i have problems updating my running thold version 0.3.9 to the newest.

what i have done is:
- i copied the new files into plugins/thold
- deleted the entry in include/global.php
- i installed thold 0.4.1 via "plugin management"
- i run extras/upgrade.php

Now i have some errors in my cacti.log.

And i'am not able to edit Threshold templates und threshold.

I reviewed the upgrade.php and database.php.

I line 76 the script tries to alter the thold_template table "after" "syslog_priority".

Code: Select all

03/13/2009 09:52:07 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1054', SQL:"ALTER TABLE `thold_template` ADD `data_type` int (3) NOT NULL default 0 AFTER syslog_priority'
I don't have the colum syslog_priority in this table!

is this a bug/mistake in the upgrade script or is my database corrupt?

cheer markus
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Yea, it's attempting to perform the upgrade and there is a column or two missing. My solution is this:

Code: Select all

mysqldump -d cacti thold_table1 .. thold_tablen > mycurr_thold.sql
diff 041_thold.sql mycurr_thold.sql
And then correct the issues.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
galco
Cacti User
Posts: 63
Joined: Fri Aug 03, 2007 3:09 am
Location: Barcelona, Catalunya

Post by galco »

Hi,

I experienced exactly the same problem:

Code: Select all

03/13/2009 11:02:29 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1054', SQL:"ALTER TABLE `thold_template` ADD `data_type` int (3) NOT NULL default 0 AFTER syslog_priority'
I thought to add this field manually but I'm not sure where to place it because I realised that "syslog_priority" field appeared on table thold_data. What's exactly the solution?

I have to add this field on thold_template table or does it really have to be on thold_data table?

I thought all worked correctly until now, I get an "Error: Save Failed" when I tried to modify a value from a template in "Treshold template". I looked for a solution but people who have the same problem are not related whit thold version 0.41.

Thanks


EDIT:
This people have the same behaviour with this plugin version: http://forums.cacti.net/post-158305.html
Last edited by galco on Fri Mar 20, 2009 6:34 am, edited 1 time in total.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Please see my note above. If you follow that procedure and post your two SQL files, I can answer the question. If not, well, I wish you the best.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
galco
Cacti User
Posts: 63
Joined: Fri Aug 03, 2007 3:09 am
Location: Barcelona, Catalunya

Post by galco »

Sorry, I atached this information in another related post,

Thanks!

Code: Select all

# diff thold.sql mydatabase.sql 
12a13,16
>   `time_hi` varchar(100) default NULL,
>   `time_low` varchar(100) default NULL,
>   `time_fail_trigger` int(12) NOT NULL default '1',
>   `time_fail_length` int(12) NOT NULL default '1',
15a20
>   `thold_type` int(3) NOT NULL default '0',
27a33
>   `data_type` int(3) NOT NULL default '0',
30d35
<   `data_type` int(3) NOT NULL default '0',
32c37
<   `percent_ds` varchar(64) NOT NULL,
---
>   `percent_ds` varchar(64) NOT NULL default '0',
39d43
<   KEY `host_id` (`host_id`),
40a45,46
>   KEY `template` (`template`),
>   KEY `template_enabled` (`template_enabled`),
41a48,49
>   KEY `thold_enabled` (`thold_enabled`),
>   KEY `tcheck` (`tcheck`),
44,48c52,53
<   KEY `data_template` (`data_template`),
<   KEY `template` (`template`),
<   KEY `template_enabled` (`template_enabled`),
<   KEY `thold_enabled` (`thold_enabled`)
< ) TYPE=MyISAM;
---
>   KEY `data_template` (`data_template`)
> ) ENGINE=MyISAM AUTO_INCREMENT=786 DEFAULT CHARSET=latin1;
51,80c56,88
< CREATE TABLE thold_template (
<   id int(11) NOT NULL auto_increment,
<   name varchar(100) NOT NULL default '',
<   data_template_id int(32) NOT NULL default '0',
<   data_template_name varchar(100) NOT NULL default '',
<   data_source_id int(10) NOT NULL default '0',
<   data_source_name varchar(100) NOT NULL default '',
<   data_source_friendly varchar(100) NOT NULL default '',
<   thold_hi varchar(100) default NULL,
<   thold_low varchar(100) default NULL,
<   thold_fail_trigger int(10) default '1',
<   thold_enabled enum('on','off') NOT NULL default 'on',
<   bl_enabled enum('on','off') NOT NULL default 'off',
<   bl_ref_time int(50) default NULL,
<   bl_ref_time_range int(10) default NULL,
<   bl_pct_down int(10) default NULL,
<   bl_pct_up int(10) default NULL,
<   bl_fail_trigger int(10) default NULL,
<   bl_alert int(2) default NULL,
<   repeat_alert int(10) NOT NULL default '12',
<   notify_extra varchar(255) NOT NULL default '',
<   data_type int(3) NOT NULL default '0',
<   cdef int(11) NOT NULL default '0',
<   percent_ds varchar(64) NOT NULL,
<   exempt char(3) NOT NULL default 'off',
<   restored_alert char(3) NOT NULL default 'off',
<   PRIMARY KEY  (id),
<   KEY `data_template_id` (`data_template_id`),
<   KEY `data_source_id` (`data_source_id`)
< ) TYPE=MyISAM COMMENT='Table of thresholds defaults for graphs';
---
> CREATE TABLE `thold_template` (
>   `id` int(11) NOT NULL auto_increment,
>   `name` varchar(100) NOT NULL default '',
>   `data_template_id` int(32) NOT NULL default '0',
>   `data_template_name` varchar(100) NOT NULL default '',
>   `data_source_id` int(10) NOT NULL default '0',
>   `data_source_name` varchar(100) NOT NULL default '',
>   `data_source_friendly` varchar(100) NOT NULL default '',
>   `thold_hi` varchar(100) default NULL,
>   `thold_low` varchar(100) default NULL,
>   `thold_fail_trigger` int(10) default '1',
>   `time_hi` varchar(100) default NULL,
>   `time_low` varchar(100) default NULL,
>   `time_fail_trigger` int(12) NOT NULL default '1',
>   `time_fail_length` int(12) NOT NULL default '1',
>   `thold_enabled` enum('on','off') NOT NULL default 'on',
>   `thold_type` int(3) NOT NULL default '0',
>   `bl_enabled` enum('on','off') NOT NULL default 'off',
>   `bl_ref_time` int(50) default NULL,
>   `bl_ref_time_range` int(10) default NULL,
>   `bl_pct_down` int(10) default NULL,
>   `bl_pct_up` int(10) default NULL,
>   `bl_fail_trigger` int(10) default NULL,
>   `bl_alert` int(2) default NULL,
>   `repeat_alert` int(10) NOT NULL default '12',
>   `notify_extra` varchar(255) NOT NULL default '',
>   `cdef` int(11) NOT NULL default '0',
>   `percent_ds` varchar(64) NOT NULL default '0',
>   `exempt` char(3) NOT NULL default 'off',
>   `restored_alert` char(3) NOT NULL default 'off',
>   UNIQUE KEY `data_source_id` (`data_source_id`),
>   KEY `id` (`id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='Table of thresholds defaults for graphs';
83,88c91,96
< CREATE TABLE plugin_thold_template_contact (
<   template_id int(12) NOT NULL,
<   contact_id int(12) NOT NULL,
<   KEY template_id (template_id),
<   KEY contact_id (contact_id)
< ) TYPE=MyISAM COMMENT='Table of Tholds Template Contacts';
---
> CREATE TABLE `plugin_thold_template_contact` (
>   `template_id` int(12) NOT NULL,
>   `contact_id` int(12) NOT NULL,
>   KEY `template_id` (`template_id`),
>   KEY `contact_id` (`contact_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table of Tholds Template Contacts';
91,96c99,104
< CREATE TABLE plugin_thold_threshold_contact (
<   thold_id int(12) NOT NULL,
<   contact_id int(12) NOT NULL,
<   KEY thold_id (thold_id),
<   KEY contact_id (contact_id)
< ) TYPE=MyISAM COMMENT='Table of Tholds Threshold Contacts';
---
> CREATE TABLE `plugin_thold_threshold_contact` (
>   `thold_id` int(12) NOT NULL,
>   `contact_id` int(12) NOT NULL,
>   KEY `thold_id` (`thold_id`),
>   KEY `contact_id` (`contact_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table of Tholds Threshold Contacts';
99c107
< CREATE TABLE plugin_thold_contacts (
---
> CREATE TABLE `plugin_thold_contacts` (
107c115
< ) TYPE=MyISAM;
---
> ) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=latin1;
108a117
> DROP TABLE IF EXISTS `plugin_thold_log`;
110,111c119,120
<   `id` int(12) NOT NULL auto_increment,
<   `time` int(24) NOT NULL,
---
>   `id` int(10) NOT NULL auto_increment,
>   `time` int(32) NOT NULL,
124d132
<   KEY `threshold_id` (`threshold_id`),
126,135c134,136
<   KEY `type` (`type`)
< ) ENGINE=MyISAM COMMENT='Table of All Threshold Breaches';
< 
< REPLACE INTO user_auth_realm VALUES (18, 1);
< REPLACE INTO user_auth_realm VALUES (19, 1);
< 
< REPLACE INTO settings VALUES ('alert_bl_past_default',86400);
< REPLACE INTO settings VALUES ('alert_bl_timerange_def',10800);
< REPLACE INTO settings VALUES ('alert_bl_percent_def',20);
< REPLACE INTO settings VALUES ('alert_bl_trigger',3);
---
>   KEY `type` (`type`),
>   KEY `threshold_id` (`threshold_id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=168 DEFAULT CHARSET=latin1;
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Yup, see my other post. I would like the two files, not as code snippets and I don't want diffs.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
galco
Cacti User
Posts: 63
Joined: Fri Aug 03, 2007 3:09 am
Location: Barcelona, Catalunya

Post by galco »

Ok! Here you are!

Thanks!


# mysqldump -uuser -p -d cacti thold_data thold_template plugin_thold_template_contact plugin_thold_threshold_contact plugin_thold_contacts plugin_thold_log

Code: Select all

-- MySQL dump 10.11
--
-- Host: localhost    Database: cacti
-- ------------------------------------------------------
-- Server version	5.0.32-Debian_7etch8-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `thold_data`
--

DROP TABLE IF EXISTS `thold_data`;
CREATE TABLE `thold_data` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `rra_id` int(11) NOT NULL default '0',
  `data_id` int(11) NOT NULL default '0',
  `graph_id` int(11) NOT NULL default '0',
  `graph_template` int(11) NOT NULL default '0',
  `data_template` int(11) NOT NULL default '0',
  `thold_hi` varchar(100) default NULL,
  `thold_low` varchar(100) default NULL,
  `thold_fail_trigger` int(10) unsigned default NULL,
  `time_hi` varchar(100) default NULL,
  `time_low` varchar(100) default NULL,
  `time_fail_trigger` int(12) NOT NULL default '1',
  `time_fail_length` int(12) NOT NULL default '1',
  `thold_fail_count` int(11) NOT NULL default '0',
  `thold_alert` int(1) NOT NULL default '0',
  `thold_enabled` enum('on','off') NOT NULL default 'on',
  `thold_type` int(3) NOT NULL default '0',
  `bl_enabled` enum('on','off') NOT NULL default 'off',
  `bl_ref_time` int(50) unsigned default NULL,
  `bl_ref_time_range` int(10) unsigned default NULL,
  `bl_pct_down` int(10) unsigned default NULL,
  `bl_pct_up` int(10) unsigned default NULL,
  `bl_fail_trigger` int(10) unsigned default NULL,
  `bl_fail_count` int(11) unsigned default NULL,
  `bl_alert` int(2) NOT NULL default '0',
  `lastread` varchar(100) default NULL,
  `oldvalue` varchar(100) NOT NULL default '',
  `repeat_alert` int(10) unsigned default NULL,
  `notify_extra` varchar(255) default NULL,
  `data_type` int(3) NOT NULL default '0',
  `host_id` int(10) default NULL,
  `syslog_priority` int(2) default '3',
  `cdef` int(11) NOT NULL default '0',
  `percent_ds` varchar(64) NOT NULL default '0',
  `template` int(11) NOT NULL default '0',
  `template_enabled` char(3) NOT NULL default '',
  `tcheck` int(1) NOT NULL default '0',
  `exempt` char(3) NOT NULL default 'off',
  `restored_alert` char(3) NOT NULL default 'off',
  PRIMARY KEY  (`id`),
  KEY `rra_id` (`rra_id`),
  KEY `template` (`template`),
  KEY `template_enabled` (`template_enabled`),
  KEY `data_id` (`data_id`),
  KEY `thold_enabled` (`thold_enabled`),
  KEY `tcheck` (`tcheck`),
  KEY `graph_id` (`graph_id`),
  KEY `graph_template` (`graph_template`),
  KEY `data_template` (`data_template`)
) ENGINE=MyISAM AUTO_INCREMENT=786 DEFAULT CHARSET=latin1;

--
-- Table structure for table `thold_template`
--

DROP TABLE IF EXISTS `thold_template`;
CREATE TABLE `thold_template` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `data_template_id` int(32) NOT NULL default '0',
  `data_template_name` varchar(100) NOT NULL default '',
  `data_source_id` int(10) NOT NULL default '0',
  `data_source_name` varchar(100) NOT NULL default '',
  `data_source_friendly` varchar(100) NOT NULL default '',
  `thold_hi` varchar(100) default NULL,
  `thold_low` varchar(100) default NULL,
  `thold_fail_trigger` int(10) default '1',
  `time_hi` varchar(100) default NULL,
  `time_low` varchar(100) default NULL,
  `time_fail_trigger` int(12) NOT NULL default '1',
  `time_fail_length` int(12) NOT NULL default '1',
  `thold_enabled` enum('on','off') NOT NULL default 'on',
  `thold_type` int(3) NOT NULL default '0',
  `bl_enabled` enum('on','off') NOT NULL default 'off',
  `bl_ref_time` int(50) default NULL,
  `bl_ref_time_range` int(10) default NULL,
  `bl_pct_down` int(10) default NULL,
  `bl_pct_up` int(10) default NULL,
  `bl_fail_trigger` int(10) default NULL,
  `bl_alert` int(2) default NULL,
  `repeat_alert` int(10) NOT NULL default '12',
  `notify_extra` varchar(255) NOT NULL default '',
  `cdef` int(11) NOT NULL default '0',
  `percent_ds` varchar(64) NOT NULL default '0',
  `exempt` char(3) NOT NULL default 'off',
  `restored_alert` char(3) NOT NULL default 'off',
  UNIQUE KEY `data_source_id` (`data_source_id`),
  KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='Table of thresholds defaults for graphs';

--
-- Table structure for table `plugin_thold_template_contact`
--

DROP TABLE IF EXISTS `plugin_thold_template_contact`;
CREATE TABLE `plugin_thold_template_contact` (
  `template_id` int(12) NOT NULL,
  `contact_id` int(12) NOT NULL,
  KEY `template_id` (`template_id`),
  KEY `contact_id` (`contact_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table of Tholds Template Contacts';

--
-- Table structure for table `plugin_thold_threshold_contact`
--

DROP TABLE IF EXISTS `plugin_thold_threshold_contact`;
CREATE TABLE `plugin_thold_threshold_contact` (
  `thold_id` int(12) NOT NULL,
  `contact_id` int(12) NOT NULL,
  KEY `thold_id` (`thold_id`),
  KEY `contact_id` (`contact_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table of Tholds Threshold Contacts';

--
-- Table structure for table `plugin_thold_contacts`
--

DROP TABLE IF EXISTS `plugin_thold_contacts`;
CREATE TABLE `plugin_thold_contacts` (
  `id` int(12) NOT NULL auto_increment,
  `user_id` int(12) NOT NULL,
  `type` varchar(32) NOT NULL,
  `data` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `type` (`type`),
  KEY `user_id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=latin1;

--
-- Table structure for table `plugin_thold_log`
--

DROP TABLE IF EXISTS `plugin_thold_log`;
CREATE TABLE `plugin_thold_log` (
  `id` int(10) NOT NULL auto_increment,
  `time` int(32) NOT NULL,
  `host_id` int(10) NOT NULL,
  `graph_id` int(10) NOT NULL,
  `threshold_id` int(10) NOT NULL,
  `threshold_value` varchar(64) NOT NULL,
  `current` varchar(64) NOT NULL,
  `status` int(5) NOT NULL,
  `type` int(5) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `time` (`time`),
  KEY `host_id` (`host_id`),
  KEY `graph_id` (`graph_id`),
  KEY `status` (`status`),
  KEY `type` (`type`),
  KEY `threshold_id` (`threshold_id`)
) ENGINE=MyISAM AUTO_INCREMENT=168 DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2009-03-20 11:49:34
# cat thold.sql

Code: Select all

DROP TABLE IF EXISTS `thold_data`;
CREATE TABLE `thold_data` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `rra_id` int(11) NOT NULL default '0',
  `data_id` int(11) NOT NULL default '0',
  `graph_id` int(11) NOT NULL default '0',
  `graph_template` int(11) NOT NULL default '0',
  `data_template` int(11) NOT NULL default '0',
  `thold_hi` varchar(100) default NULL,
  `thold_low` varchar(100) default NULL,
  `thold_fail_trigger` int(10) unsigned default NULL,
  `thold_fail_count` int(11) NOT NULL default '0',
  `thold_alert` int(1) NOT NULL default '0',
  `thold_enabled` enum('on','off') NOT NULL default 'on',
  `bl_enabled` enum('on','off') NOT NULL default 'off',
  `bl_ref_time` int(50) unsigned default NULL,
  `bl_ref_time_range` int(10) unsigned default NULL,
  `bl_pct_down` int(10) unsigned default NULL,
  `bl_pct_up` int(10) unsigned default NULL,
  `bl_fail_trigger` int(10) unsigned default NULL,
  `bl_fail_count` int(11) unsigned default NULL,
  `bl_alert` int(2) NOT NULL default '0',
  `lastread` varchar(100) default NULL,
  `oldvalue` varchar(100) NOT NULL default '',
  `repeat_alert` int(10) unsigned default NULL,
  `notify_extra` varchar(255) default NULL,
  `host_id` int(10) default NULL,
  `syslog_priority` int(2) default '3',
  `data_type` int(3) NOT NULL default '0',
  `cdef` int(11) NOT NULL default '0',
  `percent_ds` varchar(64) NOT NULL,
  `template` int(11) NOT NULL default '0',
  `template_enabled` char(3) NOT NULL default '',
  `tcheck` int(1) NOT NULL default '0',
  `exempt` char(3) NOT NULL default 'off',
  `restored_alert` char(3) NOT NULL default 'off',
  PRIMARY KEY  (`id`),
  KEY `host_id` (`host_id`),
  KEY `rra_id` (`rra_id`),
  KEY `data_id` (`data_id`),
  KEY `graph_id` (`graph_id`),
  KEY `graph_template` (`graph_template`),
  KEY `data_template` (`data_template`),
  KEY `template` (`template`),
  KEY `template_enabled` (`template_enabled`),
  KEY `thold_enabled` (`thold_enabled`)
) TYPE=MyISAM;

DROP TABLE IF EXISTS `thold_template`;
CREATE TABLE thold_template (
  id int(11) NOT NULL auto_increment,
  name varchar(100) NOT NULL default '',
  data_template_id int(32) NOT NULL default '0',
  data_template_name varchar(100) NOT NULL default '',
  data_source_id int(10) NOT NULL default '0',
  data_source_name varchar(100) NOT NULL default '',
  data_source_friendly varchar(100) NOT NULL default '',
  thold_hi varchar(100) default NULL,
  thold_low varchar(100) default NULL,
  thold_fail_trigger int(10) default '1',
  thold_enabled enum('on','off') NOT NULL default 'on',
  bl_enabled enum('on','off') NOT NULL default 'off',
  bl_ref_time int(50) default NULL,
  bl_ref_time_range int(10) default NULL,
  bl_pct_down int(10) default NULL,
  bl_pct_up int(10) default NULL,
  bl_fail_trigger int(10) default NULL,
  bl_alert int(2) default NULL,
  repeat_alert int(10) NOT NULL default '12',
  notify_extra varchar(255) NOT NULL default '',
  data_type int(3) NOT NULL default '0',
  cdef int(11) NOT NULL default '0',
  percent_ds varchar(64) NOT NULL,
  exempt char(3) NOT NULL default 'off',
  restored_alert char(3) NOT NULL default 'off',
  PRIMARY KEY  (id),
  KEY `data_template_id` (`data_template_id`),
  KEY `data_source_id` (`data_source_id`)
) TYPE=MyISAM COMMENT='Table of thresholds defaults for graphs';

DROP TABLE IF EXISTS `plugin_thold_template_contact`;
CREATE TABLE plugin_thold_template_contact (
  template_id int(12) NOT NULL,
  contact_id int(12) NOT NULL,
  KEY template_id (template_id),
  KEY contact_id (contact_id)
) TYPE=MyISAM COMMENT='Table of Tholds Template Contacts';

DROP TABLE IF EXISTS `plugin_thold_threshold_contact`;
CREATE TABLE plugin_thold_threshold_contact (
  thold_id int(12) NOT NULL,
  contact_id int(12) NOT NULL,
  KEY thold_id (thold_id),
  KEY contact_id (contact_id)
) TYPE=MyISAM COMMENT='Table of Tholds Threshold Contacts';

DROP TABLE IF EXISTS `plugin_thold_contacts`;
CREATE TABLE plugin_thold_contacts (
  `id` int(12) NOT NULL auto_increment,
  `user_id` int(12) NOT NULL,
  `type` varchar(32) NOT NULL,
  `data` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `type` (`type`),
  KEY `user_id` (`user_id`)
) TYPE=MyISAM;

CREATE TABLE `plugin_thold_log` (
  `id` int(12) NOT NULL auto_increment,
  `time` int(24) NOT NULL,
  `host_id` int(10) NOT NULL,
  `graph_id` int(10) NOT NULL,
  `threshold_id` int(10) NOT NULL,
  `threshold_value` varchar(64) NOT NULL,
  `current` varchar(64) NOT NULL,
  `status` int(5) NOT NULL,
  `type` int(5) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `time` (`time`),
  KEY `host_id` (`host_id`),
  KEY `graph_id` (`graph_id`),
  KEY `threshold_id` (`threshold_id`),
  KEY `status` (`status`),
  KEY `type` (`type`)
) ENGINE=MyISAM COMMENT='Table of All Threshold Breaches';

REPLACE INTO user_auth_realm VALUES (18, 1);
REPLACE INTO user_auth_realm VALUES (19, 1);

REPLACE INTO settings VALUES ('alert_bl_past_default',86400);
REPLACE INTO settings VALUES ('alert_bl_timerange_def',10800);
REPLACE INTO settings VALUES ('alert_bl_percent_def',20);
REPLACE INTO settings VALUES ('alert_bl_trigger',3);
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

looks like Jimmy got ahead of himself. The default SQL and your SQL are a bit off. Please edit setup.php and change the following line to this one.

Code: Select all

ALTER TABLE `thold_template` ADD `data_type` int (3) NOT NULL default 0 AFTER syslog_priority'

Code: Select all

ALTER TABLE `thold_template` ADD `data_type` int (3) NOT NULL default 0 AFTER notify_extra'
He does plan on moving the syslog details to the THold level, but apparently, some things made it quicker than others.

Now this will allow that code to execute, but I think there are other issues as I see differences between thold_data and thold_template tables that worry me.

I'll send a note to jimmy.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
galco
Cacti User
Posts: 63
Joined: Fri Aug 03, 2007 3:09 am
Location: Barcelona, Catalunya

Post by galco »

Thanks a lot TheWitness I do really appreciate your help

I executed this command directly from mysql client because I couldn't find the wrong line in my setup.php. I spouse I had to change this line in database.php and re-run upgrade.php but I preferred do that manually and I solved the problem.

I hope the other differences between thold_data and thold_template tables don't affect me.

Thanks!
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Nope. Jimmies just slacking off... ;)

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
kyosanim
Posts: 37
Joined: Thu Apr 05, 2007 5:33 am

Post by kyosanim »

this solution worked for me, too.
i just edited the function thold_upgrade_database in thold/include/database.php and thold is running :)

thx
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

works fine - now I can save templates!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests