Skip to content

Instantly share code, notes, and snippets.

@simonkowallik
Created April 11, 2012 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonkowallik/2358880 to your computer and use it in GitHub Desktop.
Save simonkowallik/2358880 to your computer and use it in GitHub Desktop.
ZBXNEXT-1170 Patch - Support for trigger expressions with more than 255 characters - Patch works till 2.0.0rc4
--- ./src/libs/zbxserver/expression.c.orig 2012-03-30 14:55:53.136539389 +0200
+++ ./src/libs/zbxserver/expression.c 2012-03-30 14:52:37.516538689 +0200
@@ -465,7 +465,7 @@
const char *__function_name = "DCexpand_trigger_expression";
char *tmp = NULL;
- size_t tmp_alloc = 256, tmp_offset = 0, l, r;
+ size_t tmp_alloc = 1025, tmp_offset = 0, l, r;
DC_FUNCTION function;
DC_ITEM item;
zbx_uint64_t functionid;
--- frontends/php/include/schema.inc.php.orig 2012-03-30 14:38:32.096541376 +0200
+++ frontends/php/include/schema.inc.php 2012-03-30 14:38:08.566537692 +0200
@@ -2191,13 +2191,13 @@
'expression' => array(
'null' => false,
'type' => DB::FIELD_TYPE_CHAR,
- 'length' => 255,
+ 'length' => 1024,
'default' => '',
),
'description' => array(
'null' => false,
'type' => DB::FIELD_TYPE_CHAR,
- 'length' => 255,
+ 'length' => 1024,
'default' => '',
),
'url' => array(
@@ -3682,7 +3682,7 @@
'expression' => array(
'null' => false,
'type' => DB::FIELD_TYPE_CHAR,
- 'length' => 255,
+ 'length' => 1024,
'default' => '',
),
'expression_type' => array(
--- ./database/mysql/schema.sql.orig 2012-03-30 14:40:13.626523795 +0200
+++ ./database/mysql/schema.sql 2012-03-30 14:40:57.176529646 +0200
@@ -470,8 +470,8 @@
) ENGINE=InnoDB;
CREATE TABLE triggers (
triggerid bigint unsigned NOT NULL,
- expression varchar(255) DEFAULT '' NOT NULL,
- description varchar(255) DEFAULT '' NOT NULL,
+ expression varchar(1024) DEFAULT '' NOT NULL,
+ description varchar(1024) DEFAULT '' NOT NULL,
url varchar(255) DEFAULT '' NOT NULL,
status integer DEFAULT '0' NOT NULL,
value integer DEFAULT '0' NOT NULL,
@@ -816,7 +816,7 @@
CREATE TABLE expressions (
expressionid bigint unsigned NOT NULL,
regexpid bigint unsigned NOT NULL,
- expression varchar(255) DEFAULT '' NOT NULL,
+ expression varchar(1024) DEFAULT '' NOT NULL,
expression_type integer DEFAULT '0' NOT NULL,
exp_delimiter varchar(1) DEFAULT '' NOT NULL,
case_sensitive integer DEFAULT '0' NOT NULL,
--- ./src/libs/zbxdbhigh/dbschema.c.orig 2012-03-30 14:45:46.616467523 +0200
+++ ./src/libs/zbxdbhigh/dbschema.c 2012-03-30 14:48:11.696540533 +0200
@@ -537,8 +537,8 @@
{"triggers", "triggerid", ZBX_SYNC,
{
{"triggerid", NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
- {"expression", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, 0},
- {"description", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, 0},
+ {"expression", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, 0},
+ {"description", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, 0},
{"url", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, 0},
{"status", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_SYNC, 0},
{"value", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_SYNC, 0},
@@ -919,7 +919,7 @@
{
{"expressionid", NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"regexpid", "regexps", "regexpid", 0, ZBX_TYPE_ID, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, ZBX_FK_CASCADE_DELETE},
- {"expression", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, 0},
+ {"expression", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, 0},
{"expression_type", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, 0},
{"exp_delimiter", NULL, NULL, 1, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, 0},
{"case_sensitive", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, 0},
@@ -1889,8 +1889,8 @@
);\n\
CREATE TABLE triggers (\n\
triggerid bigint NOT NULL,\n\
-expression varchar(255) WITH DEFAULT '' NOT NULL,\n\
-description varchar(255) WITH DEFAULT '' NOT NULL,\n\
+expression varchar(1024) WITH DEFAULT '' NOT NULL,\n\
+description varchar(1024) WITH DEFAULT '' NOT NULL,\n\
url varchar(255) WITH DEFAULT '' NOT NULL,\n\
status integer WITH DEFAULT '0' NOT NULL,\n\
value integer WITH DEFAULT '0' NOT NULL,\n\
@@ -2235,7 +2235,7 @@
CREATE TABLE expressions (\n\
expressionid bigint NOT NULL,\n\
regexpid bigint NOT NULL,\n\
-expression varchar(255) WITH DEFAULT '' NOT NULL,\n\
+expression varchar(1024) WITH DEFAULT '' NOT NULL,\n\
expression_type integer WITH DEFAULT '0' NOT NULL,\n\
exp_delimiter varchar(1) WITH DEFAULT '' NOT NULL,\n\
case_sensitive integer WITH DEFAULT '0' NOT NULL,\n\
@@ -3411,8 +3411,8 @@
) ENGINE=InnoDB;\n\
CREATE TABLE triggers (\n\
triggerid bigint unsigned NOT NULL,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
-description varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
+description varchar(1024) DEFAULT '' NOT NULL,\n\
url varchar(255) DEFAULT '' NOT NULL,\n\
status integer DEFAULT '0' NOT NULL,\n\
value integer DEFAULT '0' NOT NULL,\n\
@@ -3757,7 +3757,7 @@
CREATE TABLE expressions (\n\
expressionid bigint unsigned NOT NULL,\n\
regexpid bigint unsigned NOT NULL,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
expression_type integer DEFAULT '0' NOT NULL,\n\
exp_delimiter varchar(1) DEFAULT '' NOT NULL,\n\
case_sensitive integer DEFAULT '0' NOT NULL,\n\
@@ -4933,8 +4933,8 @@
);\n\
CREATE TABLE triggers (\n\
triggerid number(20) NOT NULL,\n\
-expression nvarchar2(255) DEFAULT '' ,\n\
-description nvarchar2(255) DEFAULT '' ,\n\
+expression nvarchar2(1024) DEFAULT '' ,\n\
+description nvarchar2(1024) DEFAULT '' ,\n\
url nvarchar2(255) DEFAULT '' ,\n\
status number(10) DEFAULT '0' NOT NULL,\n\
value number(10) DEFAULT '0' NOT NULL,\n\
@@ -5279,7 +5279,7 @@
CREATE TABLE expressions (\n\
expressionid number(20) NOT NULL,\n\
regexpid number(20) NOT NULL,\n\
-expression nvarchar2(255) DEFAULT '' ,\n\
+expression nvarchar2(1024) DEFAULT '' ,\n\
expression_type number(10) DEFAULT '0' NOT NULL,\n\
exp_delimiter nvarchar2(1) DEFAULT '' ,\n\
case_sensitive number(10) DEFAULT '0' NOT NULL,\n\
@@ -6527,8 +6527,8 @@
);\n\
CREATE TABLE triggers (\n\
triggerid bigint NOT NULL,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
-description varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
+description varchar(1024) DEFAULT '' NOT NULL,\n\
url varchar(255) DEFAULT '' NOT NULL,\n\
status integer DEFAULT '0' NOT NULL,\n\
value integer DEFAULT '0' NOT NULL,\n\
@@ -6873,7 +6873,7 @@
CREATE TABLE expressions (\n\
expressionid bigint NOT NULL,\n\
regexpid bigint NOT NULL,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
expression_type integer DEFAULT '0' NOT NULL,\n\
exp_delimiter varchar(1) DEFAULT '' NOT NULL,\n\
case_sensitive integer DEFAULT '0' NOT NULL,\n\
@@ -8049,8 +8049,8 @@
);\n\
CREATE TABLE triggers (\n\
triggerid bigint NOT NULL,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
-description varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
+description varchar(1024) DEFAULT '' NOT NULL,\n\
url varchar(255) DEFAULT '' NOT NULL,\n\
status integer DEFAULT '0' NOT NULL,\n\
value integer DEFAULT '0' NOT NULL,\n\
@@ -8395,7 +8395,7 @@
CREATE TABLE expressions (\n\
expressionid bigint NOT NULL,\n\
regexpid bigint NOT NULL REFERENCES regexps (regexpid) ON DELETE CASCADE,\n\
-expression varchar(255) DEFAULT '' NOT NULL,\n\
+expression varchar(1024) DEFAULT '' NOT NULL,\n\
expression_type integer DEFAULT '0' NOT NULL,\n\
exp_delimiter varchar(1) DEFAULT '' NOT NULL,\n\
case_sensitive integer DEFAULT '0' NOT NULL,\n\
@simonkowallik
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment