summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-15 18:53:33 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-15 18:53:33 +0000
commit20ff0332e4cebfb212300f3d9496f14e400a6234 (patch)
tree2e0cabe69c9bbc7ffca7d3b9783f788334f3cff2 /src
parentf11bd43692bbd9c13e94cccad81eea4a92b7b06f (diff)
downloadzabbix-20ff0332e4cebfb212300f3d9496f14e400a6234.tar.gz
zabbix-20ff0332e4cebfb212300f3d9496f14e400a6234.tar.xz
zabbix-20ff0332e4cebfb212300f3d9496f14e400a6234.zip
- change copyright to SIA Zabbix (Alexei)
- added basic support for log[*] (Alexei) - fixed processing of traps having character ':' (Alexei) - added logfiles.h and logfiles.c (Alexei) - group level start/stop monitoring (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@1774 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_agent/Makefile.in2
-rw-r--r--src/zabbix_agent/active.c100
-rw-r--r--src/zabbix_agent/active.h7
-rw-r--r--src/zabbix_agent/cpustat.c4
-rw-r--r--src/zabbix_agent/cpustat.h4
-rw-r--r--src/zabbix_agent/diskdevices.c4
-rw-r--r--src/zabbix_agent/diskdevices.h4
-rw-r--r--src/zabbix_agent/interfaces.c4
-rw-r--r--src/zabbix_agent/interfaces.h4
-rw-r--r--src/zabbix_agent/logfiles.c83
-rw-r--r--src/zabbix_agent/logfiles.h25
-rw-r--r--src/zabbix_agent/stats.c4
-rw-r--r--src/zabbix_agent/stats.h4
-rw-r--r--src/zabbix_agent/sysinfo.c4
-rw-r--r--src/zabbix_agent/sysinfo.h4
-rw-r--r--src/zabbix_agent/zabbix_agent.c4
-rw-r--r--src/zabbix_agent/zabbix_agent.h4
-rw-r--r--src/zabbix_agent/zabbix_agentd.c4
-rw-r--r--src/zabbix_sender/zabbix_sender.c4
-rw-r--r--src/zabbix_server/alerter.c4
-rw-r--r--src/zabbix_server/alerter.h4
-rw-r--r--src/zabbix_server/calculator.c4
-rw-r--r--src/zabbix_server/calculator.h4
-rw-r--r--src/zabbix_server/checks_agent.c4
-rw-r--r--src/zabbix_server/checks_agent.h4
-rw-r--r--src/zabbix_server/checks_internal.c4
-rw-r--r--src/zabbix_server/checks_internal.h6
-rw-r--r--src/zabbix_server/checks_simple.c4
-rw-r--r--src/zabbix_server/checks_simple.h4
-rw-r--r--src/zabbix_server/checks_snmp.c4
-rw-r--r--src/zabbix_server/checks_snmp.h4
-rw-r--r--src/zabbix_server/housekeeper.c4
-rw-r--r--src/zabbix_server/housekeeper.h4
-rw-r--r--src/zabbix_server/pinger.c4
-rw-r--r--src/zabbix_server/pinger.h4
-rw-r--r--src/zabbix_server/server.c4
-rw-r--r--src/zabbix_server/trapper.c18
-rw-r--r--src/zabbix_server/trapper.h4
38 files changed, 261 insertions, 104 deletions
diff --git a/src/zabbix_agent/Makefile.in b/src/zabbix_agent/Makefile.in
index f7f20890..39425ce3 100644
--- a/src/zabbix_agent/Makefile.in
+++ b/src/zabbix_agent/Makefile.in
@@ -5,7 +5,7 @@ LIBS = @LIBS@ @LDAP_LFLAGS@
all:
@CC@ -o ../../bin/zabbix_agent @CFLAGS@ -I../../include zabbix_agent.c sysinfo.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/snprintf.c ../../include/md5.c -Wall $(LIBS)
- @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c sysinfo.c stats.c interfaces.c diskdevices.c cpustat.c active.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/pid.c ../../include/snprintf.c ../../include/md5.c -Wall $(LIBS)
+ @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c logfiles.c sysinfo.c stats.c interfaces.c diskdevices.c cpustat.c active.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/pid.c ../../include/snprintf.c ../../include/md5.c -Wall $(LIBS)
clean:
rm -f *.o
diff --git a/src/zabbix_agent/active.c b/src/zabbix_agent/active.c
index 80998249..bf81a4fa 100644
--- a/src/zabbix_agent/active.c
+++ b/src/zabbix_agent/active.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@
#include "cfg.h"
#include "stats.h"
#include "active.h"
+#include "logfiles.h"
METRIC *metrics=NULL;
@@ -72,29 +73,20 @@ void init_list()
}
else
{
- zabbix_log( LOG_LEVEL_DEBUG, "Metrics are already initialised");
+ zabbix_log( LOG_LEVEL_WARNING, "Metrics are already initialised");
}
}
-void delete_all_metrics()
+void disable_all_metrics()
{
- int i,count=0;
+ int i;
zabbix_log( LOG_LEVEL_DEBUG, "In delete_all_metrics()");
for(i=0;;i++)
{
if(metrics[i].key == NULL) break;
- count++;
+ metrics[i].status = ITEM_STATUS_NOTSUPPORTED;
}
-
- for(i=count-1;i>=0;i--)
- {
- free(metrics[i].key);
- }
- free(metrics);
-
- metrics=NULL;
- init_list();
}
int get_min_nextcheck()
@@ -123,23 +115,34 @@ int get_min_nextcheck()
void add_check(char *key, int refresh)
{
-
int i;
+ zabbix_log( LOG_LEVEL_DEBUG, "In add check [%s]", key);
+
for(i=0;;i++)
{
if(metrics[i].key == NULL)
{
-
metrics[i].key=strdup(key);
metrics[i].refresh=refresh;
metrics[i].nextcheck=0;
metrics[i].status=ITEM_STATUS_ACTIVE;
+ metrics[i].lastlogsize=0;
metrics=realloc(metrics,(i+2)*sizeof(METRIC));
metrics[i+1].key=NULL;
break;
}
+ else if(strcmp(metrics[i].key,key)==0)
+ {
+ if(metrics[i].refresh!=refresh)
+ {
+ metrics[i].nextcheck=0;
+ }
+ metrics[i].refresh=refresh;
+ metrics[i].status=ITEM_STATUS_ACTIVE;
+ break;
+ }
}
}
@@ -150,8 +153,7 @@ int parse_list_of_checks(char *str)
char *key, *refresh;
char *s1, *s2;
- init_list();
- delete_all_metrics();
+ disable_all_metrics();
line=(char *)strtok_r(str,"\n",&s1);
while(line!=NULL)
@@ -377,10 +379,12 @@ int send_value(char *server,int port,char *shortname,char *value)
int process_active_checks(char *server, int port)
{
char value[MAX_STRING_LEN];
- int i, now;
+ int i, now, count;
int ret = SUCCEED;
char shortname[MAX_STRING_LEN];
+ char c[MAX_STRING_LEN];
+ char *filename;
now=time(NULL);
@@ -390,20 +394,52 @@ int process_active_checks(char *server, int port)
if(metrics[i].nextcheck>now) continue;
if(metrics[i].status!=ITEM_STATUS_ACTIVE) continue;
- process(metrics[i].key, value);
-
- snprintf(shortname, MAX_STRING_LEN-1,"%s:%s",CONFIG_HOSTNAME,metrics[i].key);
- zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
- if(send_value(server,port,shortname,value) == FAIL)
+ /* Special processing for log files */
+ if(strncmp(metrics[i].key,"log[",4) == 0)
{
- ret = FAIL;
- break;
- }
+ strscpy(c,metrics[i].key);
+ filename=strtok(c,"[]");
+ filename=strtok(NULL,"[]");
- if(strcmp(value,"ZBX_NOTSUPPORTED\n")==0)
+ count=0;
+ while(process_log(filename,metrics[i].lastlogsize,value) == 0)
+ {
+ snprintf(shortname, MAX_STRING_LEN-1,"%s:%s",CONFIG_HOSTNAME,metrics[i].key);
+ zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
+ if(send_value(server,port,shortname,value) == FAIL)
+ {
+ ret = FAIL;
+ break;
+ }
+ if(strcmp(value,"ZBX_NOTSUPPORTED\n")==0)
+ {
+ metrics[i].status=ITEM_STATUS_NOTSUPPORTED;
+ zabbix_log( LOG_LEVEL_WARNING, "Active check [%s] is not supported. Disabled.", metrics[i].key);
+ break;
+ }
+ metrics[i].lastlogsize+=strlen(value);
+ count++;
+ /* Do not flood ZABBIX server if file grows too fast */
+ if(count >= MAX_LINES_PER_SECOND*metrics[i].refresh) break;
+ }
+ }
+ else
{
- metrics[i].status=ITEM_STATUS_NOTSUPPORTED;
- zabbix_log( LOG_LEVEL_WARNING, "Active check [%s] is not supported. Disabled.", metrics[i].key);
+ process(metrics[i].key, value);
+
+ snprintf(shortname, MAX_STRING_LEN-1,"%s:%s",CONFIG_HOSTNAME,metrics[i].key);
+ zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
+ if(send_value(server,port,shortname,value) == FAIL)
+ {
+ ret = FAIL;
+ break;
+ }
+
+ if(strcmp(value,"ZBX_NOTSUPPORTED\n")==0)
+ {
+ metrics[i].status=ITEM_STATUS_NOTSUPPORTED;
+ zabbix_log( LOG_LEVEL_WARNING, "Active check [%s] is not supported. Disabled.", metrics[i].key);
+ }
}
metrics[i].nextcheck=time(NULL)+metrics[i].refresh;
@@ -437,6 +473,8 @@ void child_active_main(int i,char *server, int port)
setproctitle("getting list of active checks");
#endif
+ init_list();
+
refresh_metrics(server, port, error, sizeof(error));
nextrefresh=time(NULL)+CONFIG_REFRESH_ACTIVE_CHECKS;
diff --git a/src/zabbix_agent/active.h b/src/zabbix_agent/active.h
index dd2729e9..39e33dcf 100644
--- a/src/zabbix_agent/active.h
+++ b/src/zabbix_agent/active.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@
extern char *CONFIG_HOSTNAME;
extern int CONFIG_REFRESH_ACTIVE_CHECKS;
+#define MAX_LINES_PER_SECOND 10
+
#define METRIC struct metric_type
METRIC
{
@@ -30,6 +32,7 @@ METRIC
int refresh;
int nextcheck;
int status;
+ int lastlogsize;
};
pid_t child_active_make(int i,char *server, int port);
diff --git a/src/zabbix_agent/cpustat.c b/src/zabbix_agent/cpustat.c
index 0579fd33..ec4980f2 100644
--- a/src/zabbix_agent/cpustat.c
+++ b/src/zabbix_agent/cpustat.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/cpustat.h b/src/zabbix_agent/cpustat.h
index a6da0c85..af2a72b1 100644
--- a/src/zabbix_agent/cpustat.h
+++ b/src/zabbix_agent/cpustat.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/diskdevices.c b/src/zabbix_agent/diskdevices.c
index 452cf211..3f80543b 100644
--- a/src/zabbix_agent/diskdevices.c
+++ b/src/zabbix_agent/diskdevices.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/diskdevices.h b/src/zabbix_agent/diskdevices.h
index 0a873bbb..a8d28704 100644
--- a/src/zabbix_agent/diskdevices.h
+++ b/src/zabbix_agent/diskdevices.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/interfaces.c b/src/zabbix_agent/interfaces.c
index 1ed74d96..f4748415 100644
--- a/src/zabbix_agent/interfaces.c
+++ b/src/zabbix_agent/interfaces.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/interfaces.h b/src/zabbix_agent/interfaces.h
index 800b3c50..75eb723f 100644
--- a/src/zabbix_agent/interfaces.h
+++ b/src/zabbix_agent/interfaces.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/logfiles.c b/src/zabbix_agent/logfiles.c
new file mode 100644
index 00000000..a71c97cf
--- /dev/null
+++ b/src/zabbix_agent/logfiles.c
@@ -0,0 +1,83 @@
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+
+#include "config.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "common.h"
+
+#include "log.h"
+#include "logfiles.h"
+
+int process_log(char *filename,int lastlogsize, char *value)
+{
+ FILE *f;
+ struct stat buf;
+
+ zabbix_log( LOG_LEVEL_WARNING, "In process log (%s,%d)", filename, lastlogsize);
+
+ /* Handling of file shrinking */
+ if(stat(filename,&buf) == 0)
+ {
+ NOT SUPPORTED YET
+ if(buf.st_size<lastlogsize)
+ {
+ lastlogsize=0;
+ }
+ }
+ else
+ {
+ zabbix_log( LOG_LEVEL_WARNING, "Cannot open [%s] [%s]", filename, strerror(errno));
+ snprintf(value,MAX_STRING_LEN-1,"%s","ZBX_NOTSUPPORTED\n");
+ return 1;
+ }
+
+ f=fopen(filename,"r");
+ if(NULL == f)
+ {
+ zabbix_log( LOG_LEVEL_WARNING, "Cannot open [%s] [%s]", filename, strerror(errno));
+ snprintf(value,MAX_STRING_LEN-1,"%s","ZBX_NOTSUPPORTED\n");
+ return 1;
+ }
+
+ if(-1 == fseek(f,lastlogsize,SEEK_SET))
+ {
+ zabbix_log( LOG_LEVEL_WARNING, "Cannot set postition to [%d] for [%s] [%s]", lastlogsize, filename, strerror(errno));
+ snprintf(value,MAX_STRING_LEN-1,"%s","ZBX_NOTSUPPORTED\n");
+ fclose(f);
+ return 1;
+ }
+
+ if(NULL == fgets(value, MAX_STRING_LEN-1, f))
+ {
+ /* EOF */
+ fclose(f);
+ return 1;
+ }
+ fclose(f);
+
+ return 0;
+}
diff --git a/src/zabbix_agent/logfiles.h b/src/zabbix_agent/logfiles.h
new file mode 100644
index 00000000..dc4381d2
--- /dev/null
+++ b/src/zabbix_agent/logfiles.h
@@ -0,0 +1,25 @@
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+
+#ifndef ZABBIX_LOGFILES_H
+#define ZABBIX_LOGFILES_H
+
+int process_log(char *filename,int lastlogsize, char *value);
+
+#endif
diff --git a/src/zabbix_agent/stats.c b/src/zabbix_agent/stats.c
index a18dfb27..b5be51fb 100644
--- a/src/zabbix_agent/stats.c
+++ b/src/zabbix_agent/stats.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/stats.h b/src/zabbix_agent/stats.h
index b449c5c0..ddd01bab 100644
--- a/src/zabbix_agent/stats.h
+++ b/src/zabbix_agent/stats.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index 99c57465..9a220ac9 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/sysinfo.h b/src/zabbix_agent/sysinfo.h
index 89034389..ed118bd7 100644
--- a/src/zabbix_agent/sysinfo.h
+++ b/src/zabbix_agent/sysinfo.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/zabbix_agent.c b/src/zabbix_agent/zabbix_agent.c
index f72b3a2b..437e7b6b 100644
--- a/src/zabbix_agent/zabbix_agent.c
+++ b/src/zabbix_agent/zabbix_agent.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/zabbix_agent.h b/src/zabbix_agent/zabbix_agent.h
index 28a942d6..3f5ab9c9 100644
--- a/src/zabbix_agent/zabbix_agent.h
+++ b/src/zabbix_agent/zabbix_agent.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index e7911aaf..f16c38e4 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_sender/zabbix_sender.c b/src/zabbix_sender/zabbix_sender.c
index 4d6e2847..5c8d700b 100644
--- a/src/zabbix_sender/zabbix_sender.c
+++ b/src/zabbix_sender/zabbix_sender.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/alerter.c b/src/zabbix_server/alerter.c
index 0fbb3da7..5b1ffb58 100644
--- a/src/zabbix_server/alerter.c
+++ b/src/zabbix_server/alerter.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/alerter.h b/src/zabbix_server/alerter.h
index 272a78aa..52a0a621 100644
--- a/src/zabbix_server/alerter.h
+++ b/src/zabbix_server/alerter.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/calculator.c b/src/zabbix_server/calculator.c
index 29ffdc5f..0433b7c4 100644
--- a/src/zabbix_server/calculator.c
+++ b/src/zabbix_server/calculator.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/calculator.h b/src/zabbix_server/calculator.h
index 53c04ea8..5dad8723 100644
--- a/src/zabbix_server/calculator.h
+++ b/src/zabbix_server/calculator.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_agent.c b/src/zabbix_server/checks_agent.c
index 593ef977..d279e1e4 100644
--- a/src/zabbix_server/checks_agent.c
+++ b/src/zabbix_server/checks_agent.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_agent.h b/src/zabbix_server/checks_agent.h
index ffe3270b..0d7bae18 100644
--- a/src/zabbix_server/checks_agent.h
+++ b/src/zabbix_server/checks_agent.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_internal.c b/src/zabbix_server/checks_internal.c
index a7b4f5ff..0140f795 100644
--- a/src/zabbix_server/checks_internal.c
+++ b/src/zabbix_server/checks_internal.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_internal.h b/src/zabbix_server/checks_internal.h
index 0afc3a9e..469076bd 100644
--- a/src/zabbix_server/checks_internal.h
+++ b/src/zabbix_server/checks_internal.h
@@ -1,6 +1,6 @@
-/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_simple.c b/src/zabbix_server/checks_simple.c
index 2040c925..8c687a48 100644
--- a/src/zabbix_server/checks_simple.c
+++ b/src/zabbix_server/checks_simple.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_simple.h b/src/zabbix_server/checks_simple.h
index 39102ca1..1099f4b0 100644
--- a/src/zabbix_server/checks_simple.h
+++ b/src/zabbix_server/checks_simple.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_snmp.c b/src/zabbix_server/checks_snmp.c
index 2c6a0710..1d8c5bb3 100644
--- a/src/zabbix_server/checks_snmp.c
+++ b/src/zabbix_server/checks_snmp.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/checks_snmp.h b/src/zabbix_server/checks_snmp.h
index 34ba01b4..05269998 100644
--- a/src/zabbix_server/checks_snmp.h
+++ b/src/zabbix_server/checks_snmp.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/housekeeper.c b/src/zabbix_server/housekeeper.c
index 2550752a..20cf905a 100644
--- a/src/zabbix_server/housekeeper.c
+++ b/src/zabbix_server/housekeeper.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/housekeeper.h b/src/zabbix_server/housekeeper.h
index d0b5a88c..07c5d008 100644
--- a/src/zabbix_server/housekeeper.h
+++ b/src/zabbix_server/housekeeper.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/pinger.c b/src/zabbix_server/pinger.c
index 6506a115..810d144f 100644
--- a/src/zabbix_server/pinger.c
+++ b/src/zabbix_server/pinger.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/pinger.h b/src/zabbix_server/pinger.h
index 34407835..c0727fd2 100644
--- a/src/zabbix_server/pinger.h
+++ b/src/zabbix_server/pinger.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index 717ed213..6ba49103 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/src/zabbix_server/trapper.c b/src/zabbix_server/trapper.c
index 06745511..ef1e07f6 100644
--- a/src/zabbix_server/trapper.c
+++ b/src/zabbix_server/trapper.c
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -55,10 +55,11 @@
#include "trapper.h"
-int process_trap(int sockfd,char *s)
+int process_trap(int sockfd,char *s, int max_len)
{
char *p,*line,*host;
char *server,*key,*value_string;
+ char copy[MAX_STRING_LEN];
char result[MAX_STRING_LEN];
int ret=SUCCEED;
@@ -78,6 +79,8 @@ int process_trap(int sockfd,char *s)
/* Process information sent by zabbix_sender */
else
{
+ strscpy(copy,s);
+
server=(char *)strtok(s,":");
if(NULL == server)
{
@@ -90,11 +93,16 @@ int process_trap(int sockfd,char *s)
return FAIL;
}
- value_string=(char *)strtok(NULL,":");
+ value_string=strchr(copy,':');
+ value_string=strchr(value_string+1,':');
+
+/* value_string=(char *)strtok(NULL,":");*/
if(NULL == value_string)
{
return FAIL;
}
+ /* It points to ':', so have to increment */
+ value_string++;
ret=process_data(sockfd,server,key,value_string);
if( SUCCEED == ret)
@@ -156,7 +164,7 @@ void process_trapper_child(int sockfd)
zabbix_log( LOG_LEVEL_DEBUG, "Got line:%s", line);
- process_trap(sockfd,line);
+ process_trap(sockfd,line, MAX_STRING_LEN);
alarm(0);
}
diff --git a/src/zabbix_server/trapper.h b/src/zabbix_server/trapper.h
index 5d6d0c93..ac987262 100644
--- a/src/zabbix_server/trapper.h
+++ b/src/zabbix_server/trapper.h
@@ -1,6 +1,6 @@
/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by