summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-03-21 14:29:28 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-03-21 14:29:28 +0000
commit2eb280db699731b6e13a9a03add4be88c54b7e6a (patch)
tree8b3080ac40dc93e11a6f473871483b1b25a3f221
parentccf82edc4a3c9c119d0207cfa4bdf2aa3c53462f (diff)
downloadzabbix-2eb280db699731b6e13a9a03add4be88c54b7e6a.tar.gz
zabbix-2eb280db699731b6e13a9a03add4be88c54b7e6a.tar.xz
zabbix-2eb280db699731b6e13a9a03add4be88c54b7e6a.zip
- added directory upgrades/dbpatches/1.0beta2_to_1.0beta3 (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@338 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog8
-rw-r--r--create/mysql/schema.sql2
-rw-r--r--create/postgresql/schema.sql12
-rw-r--r--include/cfg.c11
-rw-r--r--include/db.c4
-rw-r--r--include/expression.c2
-rw-r--r--src/zabbix_agent/Makefile.in4
-rw-r--r--src/zabbix_agent/sysinfo.c54
-rw-r--r--src/zabbix_agent/zabbix_agent.c44
-rw-r--r--src/zabbix_agent/zabbix_agentd.c25
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c18
-rw-r--r--src/zabbix_trapper/zabbix_trapper.c14
-rw-r--r--src/zabbix_trapper/zabbix_trapperd.c6
-rw-r--r--upgrades/dbpatches/1.0beta2_to_1.0beta3/mysql/patch.sql8
-rw-r--r--upgrades/dbpatches/1.0beta2_to_1.0beta3/postgresql/patch.sql10
15 files changed, 142 insertions, 80 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f1e0c96..38ee4238 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
Not ready yet:
+[ Common parser (cfg.c) ]
+
[ Update task status on SF ]
[ Support for flexible permissions ]
@@ -11,14 +13,14 @@ Not ready yet:
[ All parameters should contain section "How can be used" in the Manual ]
[ PHP to support non-numeric values ]
[ Support for system[proccount] on FreeBSD ]
-[ Patches for PostgreSQL& MySQL ]
-[ Common parser (cfg.c) ]
+[ Agent to support several hosts in parameter Server ]
Changes for 1.0beta3:
+ - added directory upgrades/dbpatches/1.0beta2_to_1.0beta3 (Alexei)
+
- correct handling of timeout situations for zabbix_agentd (Alexei)
- added support for non-syslog logging (Alexei)
-
- added parameter LogFile for zabbix_trapper (Alexei)
- added parameter LogFile for zabbix_trapperd (Alexei)
- added parameter LogFile for zabbix_agentd (Alexei)
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index 5c293de8..de5f3e88 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -196,7 +196,7 @@ CREATE TABLE history (
CREATE TABLE history_str (
itemid int(4) DEFAULT '0' NOT NULL,
clock int(4) DEFAULT '0' NOT NULL,
- value blob,
+ value varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (itemid,clock)
);
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index de224e93..51ea19ce 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -24,6 +24,7 @@ CREATE INDEX hosts_status on hosts (status);
CREATE TABLE items (
itemid serial,
type int4 NOT NULL,
+ value_type int4 DEFAULT '0' NOT NULL,
snmp_community varchar(64) DEFAULT '' NOT NULL,
snmp_oid varchar(255) DEFAULT '' NOT NULL,
hostid int4 NOT NULL,
@@ -202,6 +203,17 @@ CREATE TABLE history (
FOREIGN KEY (itemid) REFERENCES items
);
+--
+-- Table structure for table 'history_str'
+--
+
+CREATE TABLE history_str (
+ itemid int4 DEFAULT '0' NOT NULL,
+ clock int4 DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemid,clock),
+ FOREIGN KEY (itemid) REFERENCES items
+);
--
-- Table structure for table 'items_template'
diff --git a/include/cfg.c b/include/cfg.c
index 71037334..2a9ec77a 100644
--- a/include/cfg.c
+++ b/include/cfg.c
@@ -33,7 +33,7 @@ int parse_cfg_file(char *cfg_file,struct cfg_line *cfg)
int lineno;
int i,var;
int *pointer;
- char *c;
+ char **c;
file=fopen(cfg_file,"r");
@@ -65,7 +65,7 @@ int parse_cfg_file(char *cfg_file,struct cfg_line *cfg)
parameter[value-line-1]=0;
-// syslog( LOG_WARNING, "Parameter [%s] Value [%s]", parameter, value);
+/* syslog( LOG_WARNING, "Parameter [%s] Value [%s]", parameter, value);*/
i=0;
while(cfg[i].parameter != 0)
@@ -92,11 +92,8 @@ int parse_cfg_file(char *cfg_file,struct cfg_line *cfg)
else
{
/* Can this be done without "c" ? */
- /* c=(char *)cfg[i].variable;
- syslog( LOG_WARNING, "ZZZ [%d] [%s]", *c, *c);
- *c=strdup(value);
- syslog( LOG_WARNING, "ZZZ [%d] [%s]", c, *c);*/
-// syslog( LOG_WARNING, "Parameter [%s] [%s]", parameter, *c);
+ c=(char *)cfg[i].variable;
+ *c=(char *)strdup(value);
}
}
i++;
diff --git a/include/db.c b/include/db.c
index 03bccf1c..193e0f9a 100644
--- a/include/db.c
+++ b/include/db.c
@@ -57,7 +57,7 @@ int DBexecute(char *query)
#ifdef HAVE_MYSQL
zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s\n",query);
-// zabbix_log( LOG_LEVEL_WARNING, "Executing query:%s\n",query);
+/* zabbix_log( LOG_LEVEL_WARNING, "Executing query:%s\n",query)*/;
if( mysql_query(&mysql,query) != 0 )
{
@@ -98,7 +98,7 @@ DB_RESULT *DBselect(char *query)
{
#ifdef HAVE_MYSQL
zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s\n",query);
-// zabbix_log( LOG_LEVEL_WARNING, "Executing query:%s\n",query);
+/* zabbix_log( LOG_LEVEL_WARNING, "Executing query:%s\n",query);*/
if( mysql_query(&mysql,query) != 0 )
{
diff --git a/include/expression.c b/include/expression.c
index 3ffbd366..456f5c7a 100644
--- a/include/expression.c
+++ b/include/expression.c
@@ -476,7 +476,7 @@ int substitute_macros(char *exp)
sprintf(res,exp,value);
strncpy(exp,res, MAX_STRING_LEN);
-// delete_spaces(exp);
+/* delete_spaces(exp); */
zabbix_log( LOG_LEVEL_DEBUG, "Expression4:%s", exp );
}
diff --git a/src/zabbix_agent/Makefile.in b/src/zabbix_agent/Makefile.in
index 87882327..410e8fe9 100644
--- a/src/zabbix_agent/Makefile.in
+++ b/src/zabbix_agent/Makefile.in
@@ -2,8 +2,8 @@
all:
- @CC@ -o ../../bin/zabbix_agent @CFLAGS@ -I../../include zabbix_agent.c sysinfo.c -Wall @LIBS@
- @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c sysinfo.c ../../include/log.c -Wall @LIBS@
+ @CC@ -o ../../bin/zabbix_agent @CFLAGS@ -I../../include zabbix_agent.c sysinfo.c ../../include/cfg.c -Wall @LIBS@
+ @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c sysinfo.c ../../include/log.c ../../include/cfg.c -Wall @LIBS@
clean:
rm -fv *.o
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index e70de142..7c196606 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -570,13 +570,14 @@ float INODE(const char * mountPoint)
blocks_percent_used = (long)
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
-// printf(
-// "%7.0f %7.0f %7.0f %5ld%% %s\n"
-// ,s.f_blocks * (s.f_bsize / 1024.0)
-// ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
-// ,s.f_bavail * (s.f_bsize / 1024.0)
-// ,blocks_percent_used
-// ,mountPoint);
+/* printf(
+ "%7.0f %7.0f %7.0f %5ld%% %s\n"
+ ,s.f_blocks * (s.f_bsize / 1024.0)
+ ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
+ ,s.f_bavail * (s.f_bsize / 1024.0)
+ ,blocks_percent_used
+ ,mountPoint);
+*/
return s.f_ffree;
}
@@ -611,13 +612,14 @@ float DF(const char * mountPoint)
blocks_percent_used = (long)
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
-// printf(
-// "%7.0f %7.0f %7.0f %5ld%% %s\n"
-// ,s.f_blocks * (s.f_bsize / 1024.0)
-// ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
-// ,s.f_bavail * (s.f_bsize / 1024.0)
-// ,blocks_percent_used
-// ,mountPoint);
+/* printf(
+ "%7.0f %7.0f %7.0f %5ld%% %s\n"
+ ,s.f_blocks * (s.f_bsize / 1024.0)
+ ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
+ ,s.f_bavail * (s.f_bsize / 1024.0)
+ ,blocks_percent_used
+ ,mountPoint);
+*/
return s.f_bavail * (s.f_bsize / 1024.0);
}
@@ -811,7 +813,7 @@ float FREEMEM(void)
{
/* Get page size */
page = pst.page_size;
-// return pst.physical_memory;
+/* return pst.physical_memory;*/
if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
{
@@ -819,16 +821,18 @@ float FREEMEM(void)
}
else
{
-//cout<<"total virtual memory allocated is " << dyn.psd_vm << "
-//pages, " << dyn.psd_vm * page << " bytes" << endl;
-//cout<<"active virtual memory is " << dyn.psd_avm <<" pages, " <<
-//dyn.psd_avm * page << " bytes" << endl;
-//cout<<"total real memory is " << dyn.psd_rm << " pages, " <<
-//dyn.psd_rm * page << " bytes" << endl;
-//cout<<"active real memory is " << dyn.psd_arm << " pages, " <<
-//dyn.psd_arm * page << " bytes" << endl;
-//cout<<"free memory is " << dyn.psd_free << " pages, " <<
- /* Free memory in bytes */
+/* cout<<"total virtual memory allocated is " << dyn.psd_vm << "
+ pages, " << dyn.psd_vm * page << " bytes" << endl;
+ cout<<"active virtual memory is " << dyn.psd_avm <<" pages, " <<
+ dyn.psd_avm * page << " bytes" << endl;
+ cout<<"total real memory is " << dyn.psd_rm << " pages, " <<
+ dyn.psd_rm * page << " bytes" << endl;
+ cout<<"active real memory is " << dyn.psd_arm << " pages, " <<
+ dyn.psd_arm * page << " bytes" << endl;
+ cout<<"free memory is " << dyn.psd_free << " pages, " <<
+*/
+ /* Free memory in bytes */
+
return dyn.psd_free * page;
}
}
diff --git a/src/zabbix_agent/zabbix_agent.c b/src/zabbix_agent/zabbix_agent.c
index 23406225..6c268068 100644
--- a/src/zabbix_agent/zabbix_agent.c
+++ b/src/zabbix_agent/zabbix_agent.c
@@ -22,11 +22,12 @@
#include <fcntl.h>
#include "common.h"
+#include "cfg.h"
#include "sysinfo.h"
#include "zabbix_agent.h"
-static char *config_host_allowed=NULL;
-static int CONFIG_TIMEOUT=AGENT_TIMEOUT;
+static char *CONFIG_HOSTS_ALLOWED = NULL;
+static int CONFIG_TIMEOUT = AGENT_TIMEOUT;
void signal_handler( int sig )
{
@@ -41,6 +42,23 @@ void signal_handler( int sig )
exit( FAIL );
}
+void init_config(void)
+{
+ struct cfg_line cfg[]=
+ {
+/* PARAMETER ,VAR ,FUNC, TYPE(0i,1s),MANDATORY,MIN,MAX
+*/
+ {"Server",&CONFIG_HOSTS_ALLOWED,0,TYPE_STRING,PARM_OPT,0,0},
+ {"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30},
+
+ {0}
+ };
+
+ parse_cfg_file("/etc/zabbix/zabbix_agent.conf",cfg);
+
+}
+
+
void process_config_file(void)
{
FILE *file;
@@ -54,7 +72,7 @@ void process_config_file(void)
file=fopen("/etc/zabbix/zabbix_agent.conf","r");
if(NULL == file)
{
-// syslog( LOG_CRIT, "Cannot open /etc/zabbix/zabbix_agentd.conf");
+/* syslog( LOG_CRIT, "Cannot open /etc/zabbix/zabbix_agentd.conf");*/
exit(1);
}
@@ -72,7 +90,7 @@ void process_config_file(void)
if(NULL == value)
{
-// syslog( LOG_CRIT, "Error in line [%s] Line %d", line, lineno);
+/* syslog( LOG_CRIT, "Error in line [%s] Line %d", line, lineno);*/
fclose(file);
exit(1);
}
@@ -81,18 +99,18 @@ void process_config_file(void)
parameter[value-line-1]=0;
-// syslog( LOG_DEBUG, "Parameter [%s] Value [%s]", parameter, value);
+/* syslog( LOG_DEBUG, "Parameter [%s] Value [%s]", parameter, value);*/
if(strcmp(parameter,"Server")==0)
{
- config_host_allowed=strdup(value);
+ CONFIG_HOSTS_ALLOWED=strdup(value);
}
else if(strcmp(parameter,"Timeout")==0)
{
i=atoi(value);
if( (i<1) || (i>30) )
{
-// syslog( LOG_CRIT, "Wrong value of Timeout in line %d. Should be between 1 or 30.", lineno);
+/* syslog( LOG_CRIT, "Wrong value of Timeout in line %d. Should be between 1 or 30.", lineno);*/
fclose(file);
exit(1);
}
@@ -103,18 +121,18 @@ void process_config_file(void)
value2=strstr(value,",");
if(NULL == value2)
{
-// syslog( LOG_CRIT, "Error in line [%s] Line %d Symbol ',' expected", line, lineno);
+/* syslog( LOG_CRIT, "Error in line [%s] Line %d Symbol ',' expected", line, lineno);*/
fclose(file);
exit(1);
}
value2[0]=0;
value2++;
-// syslog( LOG_WARNING, "Added user-defined parameter [%s] Command [%s]", value, value2);
+/* syslog( LOG_WARNING, "Added user-defined parameter [%s] Command [%s]", value, value2);*/
add_user_parameter(value, value2);
}
else
{
-// syslog( LOG_CRIT, "Unsupported parameter [%s] Line %d", parameter, lineno);
+/* syslog( LOG_CRIT, "Unsupported parameter [%s] Line %d", parameter, lineno);*/
fclose(file);
exit(1);
}
@@ -134,15 +152,15 @@ int check_security(void)
i=sizeof(struct sockaddr_in);
sname=inet_ntoa(name.sin_addr);
- if(strcmp(sname,config_host_allowed)!=0)
+ if(strcmp(sname,CONFIG_HOSTS_ALLOWED)!=0)
{
return FAIL;
}
}
else
{
-// syslog( LOG_WARNING, "Error getpeername [%m]");
-// syslog( LOG_WARNING, "Connection rejected");
+/* syslog( LOG_WARNING, "Error getpeername [%m]");*/
+/* syslog( LOG_WARNING, "Connection rejected");*/
return FAIL;
}
return SUCCEED;
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index b4b2921c..87d7de09 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -34,6 +34,7 @@
#include "zabbix_agent.h"
#include "log.h"
+#include "cfg.h"
#define LISTENQ 1024
@@ -42,7 +43,7 @@ int parent=0;
/* Number of processed requests */
int stats_request=0;
-static char *CONFIG_HOST_ALLOWED = NULL;
+static char *CONFIG_HOSTS_ALLOWED = NULL;
static char *CONFIG_PID_FILE = NULL;
static char *CONFIG_LOG_FILE = NULL;
static int CONFIG_AGENTD_FORKS = AGENTD_FORKS;
@@ -196,6 +197,20 @@ void create_pid_file(void)
fclose(f);
}
+void init_config(void)
+{
+ struct cfg_line cfg[]=
+ {
+/* PARAMETER ,VAR ,FUNC, TYPE(0i,1s),MANDATORY,MIN,MAX
+*/
+ {"Server",&CONFIG_HOSTS_ALLOWED,0,TYPE_STRING,PARM_OPT,0,0},
+ {"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30},
+ {0}
+ };
+ parse_cfg_file("/etc/zabbix/zabbix_agentd.conf",cfg);
+}
+
+
void process_config_file(void)
{
FILE *file;
@@ -240,7 +255,7 @@ void process_config_file(void)
if(strcmp(parameter,"Server")==0)
{
- CONFIG_HOST_ALLOWED=strdup(value);
+ CONFIG_HOSTS_ALLOWED=strdup(value);
}
else if(strcmp(parameter,"PidFile")==0)
{
@@ -360,10 +375,10 @@ int check_security(int sockfd)
sname=inet_ntoa(name.sin_addr);
- zabbix_log( LOG_LEVEL_DEBUG, "Connection from [%s]. Allowed server is [%s] ",sname, CONFIG_HOST_ALLOWED);
- if(strcmp(sname, CONFIG_HOST_ALLOWED)!=0)
+ zabbix_log( LOG_LEVEL_DEBUG, "Connection from [%s]. Allowed server is [%s] ",sname, CONFIG_HOSTS_ALLOWED);
+ if(strcmp(sname, CONFIG_HOSTS_ALLOWED)!=0)
{
- zabbix_log( LOG_LEVEL_WARNING, "Connection from [%s] rejected. Allowed server is [%s] ",sname, CONFIG_HOST_ALLOWED);
+ zabbix_log( LOG_LEVEL_WARNING, "Connection from [%s] rejected. Allowed server is [%s] ",sname, CONFIG_HOSTS_ALLOWED);
return FAIL;
}
}
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index fdc7eeae..670760e5 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -156,11 +156,6 @@ void daemon_init(void)
{
close(i);
}
-
-/* openlog("zabbix_suckerd",LOG_PID,LOG_USER);
- setlogmask(LOG_UPTO(LOG_DEBUG));
- setlogmask(LOG_UPTO(LOG_WARNING));*/
-
}
void create_pid_file(void)
@@ -206,13 +201,19 @@ void init_config(void)
/* PARAMETER ,VAR ,FUNC, TYPE(0i,1s),MANDATORY,MIN,MAX */
{"StartSuckers",&CONFIG_SUCKERD_FORKS,0,TYPE_INT,PARM_OPT,2,255},
{"HousekeepingFrequency",&CONFIG_HOUSEKEEPING_FREQUENCY,0,TYPE_INT,PARM_OPT,1,24},
+ {"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30},
+ {"NoTimeWait",&CONFIG_NOTIMEWAIT,0,TYPE_INT,PARM_OPT,0,1},
+ {"DebugLevel",&CONFIG_LOG_LEVEL,0,TYPE_INT,PARM_OPT,1,3},
{"PidFile",&CONFIG_PID_FILE,0,TYPE_STRING,PARM_OPT,0,0},
+ {"LogFile",&CONFIG_LOG_FILE,0,TYPE_STRING,PARM_OPT,0,0},
{"DBName",&CONFIG_DBNAME,0,TYPE_STRING,PARM_OPT,0,0},
{"DBUser",&CONFIG_DBUSER,0,TYPE_STRING,PARM_OPT,0,0},
{"DBPassword",&CONFIG_DBPASSWORD,0,TYPE_STRING,PARM_OPT,0,0},
+ {"DBSocket",&CONFIG_DBSOCKET,0,TYPE_STRING,PARM_OPT,0,0},
{0}
};
parse_cfg_file("/etc/zabbix/zabbix_suckerd.conf",cfg);
+ printf("CONFIG_PID_FILE [%s]\n",CONFIG_PID_FILE);
/* zabbix_log( LOG_LEVEL_WARNING, "PidFile [%d]", CONFIG_PID_FILE);
zabbix_log( LOG_LEVEL_WARNING, "PidFile [%d]", &CONFIG_PID_FILE);
zabbix_log( LOG_LEVEL_WARNING, "PidFile [%s]", &CONFIG_PID_FILE);*/
@@ -1009,7 +1010,9 @@ int main(int argc, char **argv)
sigaction(SIGTERM, &phan, NULL);
sigaction(SIGCHLD, &phan, NULL);
- process_config_file();
+/* process_config_file();*/
+/* process_config_file to be removed */
+ init_config();
if(CONFIG_LOG_FILE == NULL)
{
@@ -1020,9 +1023,6 @@ int main(int argc, char **argv)
zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);
}
-/* process_config_file to be removed */
-/* init_config();*/
-
create_pid_file();
pids=calloc(CONFIG_SUCKERD_FORKS-1,sizeof(pid_t));
diff --git a/src/zabbix_trapper/zabbix_trapper.c b/src/zabbix_trapper/zabbix_trapper.c
index 475a3dfa..ab21ef7b 100644
--- a/src/zabbix_trapper/zabbix_trapper.c
+++ b/src/zabbix_trapper/zabbix_trapper.c
@@ -40,12 +40,12 @@ void signal_handler( int sig )
{
signal( SIGALRM, signal_handler );
-// fprintf(stderr,"Timeout while executing operation.");
+/* fprintf(stderr,"Timeout while executing operation.");*/
}
if( SIGQUIT == sig || SIGINT == sig || SIGTERM == sig )
{
-// fprintf(stderr,"\nGot QUIT or INT or TERM signal. Exiting..." );
+/* fprintf(stderr,"\nGot QUIT or INT or TERM signal. Exiting..." );*/
}
exit( FAIL );
}
@@ -108,7 +108,7 @@ void process_config_file(void)
}
else
{
-// zabbix_log( LOG_LEVEL_CRIT, "Wrong DebugLevel in line %d", lineno);
+/* zabbix_log( LOG_LEVEL_CRIT, "Wrong DebugLevel in line %d", lineno);*/
fclose(file);
exit(1);
}
@@ -176,10 +176,6 @@ int main()
alarm(CONFIG_TIMEOUT);
-// openlog("zabbix_trapper",LOG_PID,LOG_USER);
- // ret=setlogmask(LOG_UPTO(LOG_DEBUG));
-// ret=setlogmask(LOG_UPTO(LOG_WARNING));
-
if(CONFIG_LOG_FILE == NULL)
{
zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL);
@@ -212,8 +208,8 @@ int main()
{
return FAIL;
}
-// ???
-// value=atof(value_string);
+/* ???
+ value=atof(value_string);*/
DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
diff --git a/src/zabbix_trapper/zabbix_trapperd.c b/src/zabbix_trapper/zabbix_trapperd.c
index a726609a..24643df8 100644
--- a/src/zabbix_trapper/zabbix_trapperd.c
+++ b/src/zabbix_trapper/zabbix_trapperd.c
@@ -259,7 +259,7 @@ void process_config_file(void)
{
CONFIG_PID_FILE=strdup("/tmp/zabbix_trapperd.pid");
}
- // Check, if we are able to connect
+/* Check, if we are able to connect */
DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
}
@@ -290,8 +290,8 @@ int process(char *s)
{
return FAIL;
}
-// ???
-// value=atof(value_string);
+/* ???
+ value=atof(value_string);*/
ret=process_data(server,key,value_string);
diff --git a/upgrades/dbpatches/1.0beta2_to_1.0beta3/mysql/patch.sql b/upgrades/dbpatches/1.0beta2_to_1.0beta3/mysql/patch.sql
new file mode 100644
index 00000000..75f60653
--- /dev/null
+++ b/upgrades/dbpatches/1.0beta2_to_1.0beta3/mysql/patch.sql
@@ -0,0 +1,8 @@
+alter table items add value_type int(4) DEFAULT '0' NOT NULL;
+
+CREATE TABLE history_str (
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemid,clock)
+);
diff --git a/upgrades/dbpatches/1.0beta2_to_1.0beta3/postgresql/patch.sql b/upgrades/dbpatches/1.0beta2_to_1.0beta3/postgresql/patch.sql
new file mode 100644
index 00000000..b77de8d8
--- /dev/null
+++ b/upgrades/dbpatches/1.0beta2_to_1.0beta3/postgresql/patch.sql
@@ -0,0 +1,10 @@
+alter table items add value_type int4 DEFAULT '0' NOT NULL;
+
+CREATE TABLE history_str (
+ itemid int4 DEFAULT '0' NOT NULL,
+ clock int4 DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemid,clock),
+ FOREIGN KEY (itemid) REFERENCES items
+);
+