summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-03-19 15:31:25 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-03-19 15:31:25 +0000
commit76ec1efebc6bec7e46cebbb16db8b2a1cbb022a2 (patch)
tree0d9cc3ce18573f34ffc0c534b694f78a22f60f5b
parentee4b44e6016dee92acc86d610321856976da4249 (diff)
downloadzabbix-76ec1efebc6bec7e46cebbb16db8b2a1cbb022a2.tar.gz
zabbix-76ec1efebc6bec7e46cebbb16db8b2a1cbb022a2.tar.xz
zabbix-76ec1efebc6bec7e46cebbb16db8b2a1cbb022a2.zip
- correct handling of timeout situations for zabbix_agentd (Alexei)
- added support for non-syslog logging (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@336 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog12
-rw-r--r--include/db.c4
-rw-r--r--src/zabbix_agent/zabbix_agentd.c45
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c14
-rw-r--r--src/zabbix_trapper/zabbix_trapper.c11
-rw-r--r--src/zabbix_trapper/zabbix_trapperd.c24
6 files changed, 61 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 82d991c3..1f1e0c96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
Not ready yet:
+[ Update task status on SF ]
+
+[ Support for flexible permissions ]
[ Better validation of trigger expressions ]
-[ Support for nodata() ]
+[ Support for nodata(). Do we need it ? ]
[ Show diff instead of real values ]
[ Show triggers by userid ]
-[ syslog() to file ]
[ Add support for new trigger statuses: MODIFIED/NOTSUPORTED ]
-[ Something wrong with zabbix_agentd. Timeout while command execution ]
[ All parameters should contain section "How can be used" in the Manual ]
[ PHP to support non-numeric values ]
[ Support for system[proccount] on FreeBSD ]
@@ -15,12 +16,13 @@ Not ready yet:
Changes for 1.0beta3:
+ - 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)
- added parameter LogFile for zabbix_suckerd (Alexei)
-
- - added partial support for non-syslog logging (Alexei)
- added files include/log.h and include/log.c (Alexei)
- solved problem with getpeername() (Alexei)
- support for parameter Timeout for zabbix_trapper (Alexei)
diff --git a/include/db.c b/include/db.c
index a49b1d31..03bccf1c 100644
--- a/include/db.c
+++ b/include/db.c
@@ -56,8 +56,8 @@ 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_DEBUG, "Executing query:%s\n",query);
+// zabbix_log( LOG_LEVEL_WARNING, "Executing query:%s\n",query);
if( mysql_query(&mysql,query) != 0 )
{
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index e2e63580..b4b2921c 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -42,13 +42,14 @@ int parent=0;
/* Number of processed requests */
int stats_request=0;
-static char *CONFIG_HOST_ALLOWED=NULL;
-static char *CONFIG_PID_FILE=NULL;
-static char *CONFIG_LOG_FILE=NULL;
-static int CONFIG_AGENTD_FORKS=AGENTD_FORKS;
-static int CONFIG_NOTIMEWAIT=0;
-static int CONFIG_TIMEOUT=AGENT_TIMEOUT;
-static int CONFIG_LISTEN_PORT=10000;
+static char *CONFIG_HOST_ALLOWED = NULL;
+static char *CONFIG_PID_FILE = NULL;
+static char *CONFIG_LOG_FILE = NULL;
+static int CONFIG_AGENTD_FORKS = AGENTD_FORKS;
+static int CONFIG_NOTIMEWAIT = 0;
+static int CONFIG_TIMEOUT = AGENT_TIMEOUT;
+static int CONFIG_LISTEN_PORT = 10000;
+static int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
void uninit(void)
{
@@ -92,6 +93,10 @@ void signal_handler( int sig )
uninit();
exit( FAIL );
}
+ else if( SIGPIPE == sig)
+ {
+ zabbix_log( LOG_LEVEL_WARNING, "Got SIGPIPE. Where it came from???");
+ }
else
{
zabbix_log( LOG_LEVEL_WARNING, "Got signal [%d]. Ignoring ...", sig);
@@ -155,14 +160,6 @@ void daemon_init(void)
/* openlog("zabbix_agentd",LOG_LEVEL_PID,LOG_USER);
setlogmask(LOG_UPTO(LOG_WARNING));*/
- if(CONFIG_LOG_FILE == NULL)
- {
- zabbix_open_log(LOG_TYPE_SYSLOG,LOG_LEVEL_WARNING,NULL);
- }
- else
- {
- zabbix_open_log(LOG_TYPE_FILE,LOG_LEVEL_WARNING,CONFIG_LOG_FILE);
- }
if(setpriority(PRIO_PROCESS,0,5)!=0)
{
@@ -301,17 +298,15 @@ void process_config_file(void)
{
if(strcmp(value,"1") == 0)
{
-// setlogmask(LOG_LEVEL_UPTO(LOG_CRIT));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_CRIT;
}
else if(strcmp(value,"2") == 0)
{
-// setlogmask(LOG_UPTO(LOG_WARNING));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_WARNING;
}
else if(strcmp(value,"3") == 0)
{
-// setlogmask(LOG_UPTO(LOG_DEBUG));
- zabbix_log( LOG_LEVEL_WARNING, "DebugLevel -[%s]",value);
- zabbix_log( LOG_LEVEL_DEBUG, "DebugLevel --[%s]",value);
+ CONFIG_LOG_LEVEL=LOG_LEVEL_DEBUG;
}
else
{
@@ -535,9 +530,19 @@ int main()
sigaction(SIGINT, &phan, NULL);
sigaction(SIGQUIT, &phan, NULL);
sigaction(SIGTERM, &phan, NULL);
+ sigaction(SIGPIPE, &phan, NULL);
process_config_file();
+ if(CONFIG_LOG_FILE == NULL)
+ {
+ zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL);
+ }
+ else
+ {
+ zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);
+ }
+
create_pid_file();
zabbix_log( LOG_LEVEL_WARNING, "zabbix_agentd started");
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index e9131a8a..fdc7eeae 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -43,6 +43,7 @@ static int CONFIG_SUCKERD_FORKS =SUCKER_FORKS;
static int CONFIG_NOTIMEWAIT =0;
static int CONFIG_TIMEOUT =SUCKER_TIMEOUT;
static int CONFIG_HOUSEKEEPING_FREQUENCY = 1;
+static int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
static char *CONFIG_PID_FILE = NULL;
static char *CONFIG_LOG_FILE = NULL;
static char *CONFIG_DBNAME = NULL;
@@ -200,7 +201,7 @@ void create_pid_file(void)
void init_config(void)
{
- struct cfg_line cfg[]=
+ static struct cfg_line cfg[]=
{
/* PARAMETER ,VAR ,FUNC, TYPE(0i,1s),MANDATORY,MIN,MAX */
{"StartSuckers",&CONFIG_SUCKERD_FORKS,0,TYPE_INT,PARM_OPT,2,255},
@@ -310,15 +311,15 @@ void process_config_file(void)
{
if(strcmp(value,"1") == 0)
{
-// setlogmask(LOG_LEVEL_UPTO(LOG_CRIT));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_CRIT;
}
else if(strcmp(value,"2") == 0)
{
-// setlogmask(LOG_LEVEL_UPTO(LOG_WARNING));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_WARNING;
}
else if(strcmp(value,"3") == 0)
{
-// setlogmask(LOG_UPTO(LOG_DEBUG));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_DEBUG;
}
else
{
@@ -728,6 +729,7 @@ int get_values(void)
now = time(NULL);
sprintf(sql,"select i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.hostid,h.status,i.value_type from items i,hosts h where i.nextcheck<=%d and i.status=0 and (h.status=0 or (h.status=2 and h.disable_until<%d)) and h.hostid=i.hostid and i.itemid%%%d=%d order by i.nextcheck", now, now, CONFIG_SUCKERD_FORKS-1,sucker_num-1);
+
result = DBselect(sql);
rows = DBnum_rows(result);
@@ -1011,11 +1013,11 @@ int main(int argc, char **argv)
if(CONFIG_LOG_FILE == NULL)
{
- zabbix_open_log(LOG_TYPE_SYSLOG,LOG_LEVEL_WARNING,NULL);
+ zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL);
}
else
{
- zabbix_open_log(LOG_TYPE_FILE,LOG_LEVEL_WARNING,CONFIG_LOG_FILE);
+ zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);
}
/* process_config_file to be removed */
diff --git a/src/zabbix_trapper/zabbix_trapper.c b/src/zabbix_trapper/zabbix_trapper.c
index 1e964ffa..475a3dfa 100644
--- a/src/zabbix_trapper/zabbix_trapper.c
+++ b/src/zabbix_trapper/zabbix_trapper.c
@@ -27,6 +27,7 @@
#include "functions.h"
int CONFIG_TIMEOUT = TRAPPER_TIMEOUT;
+int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
char *CONFIG_LOG_FILE = NULL;
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
@@ -95,15 +96,15 @@ void process_config_file(void)
{
if(strcmp(value,"1") == 0)
{
-// setlogmask(LOG_UPTO(LOG_CRIT));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_CRIT;
}
else if(strcmp(value,"2") == 0)
{
-// setlogmask(LOG_UPTO(LOG_WARNING));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_WARNING;
}
else if(strcmp(value,"3") == 0)
{
-// setlogmask(LOG_UPTO(LOG_DEBUG));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_DEBUG;
}
else
{
@@ -181,11 +182,11 @@ int main()
if(CONFIG_LOG_FILE == NULL)
{
- zabbix_open_log(LOG_TYPE_SYSLOG,LOG_LEVEL_WARNING,NULL);
+ zabbix_open_log(LOG_TYPE_SYSLOG,CONFIG_LOG_LEVEL,NULL);
}
else
{
- zabbix_open_log(LOG_TYPE_FILE,LOG_LEVEL_WARNING,CONFIG_LOG_FILE);
+ zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);
}
process_config_file();
diff --git a/src/zabbix_trapper/zabbix_trapperd.c b/src/zabbix_trapper/zabbix_trapperd.c
index b9c190e9..a726609a 100644
--- a/src/zabbix_trapper/zabbix_trapperd.c
+++ b/src/zabbix_trapper/zabbix_trapperd.c
@@ -38,6 +38,7 @@ int parent=0;
int CONFIG_TRAPPERD_FORKS = TRAPPERD_FORKS;
int CONFIG_LISTEN_PORT = 10001;
int CONFIG_TIMEOUT = TRAPPER_TIMEOUT;
+int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
char *CONFIG_PID_FILE = NULL;
char *CONFIG_LOG_FILE = NULL;
char *CONFIG_DBNAME = NULL;
@@ -199,15 +200,15 @@ void process_config_file(void)
{
if(strcmp(value,"1") == 0)
{
-// setlogmask(LOG_LEVEL_UPTO(LOG_CRIT));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_CRIT;
}
else if(strcmp(value,"2") == 0)
{
-// setlogmask(LOG_UPTO(LOG_WARNING));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_WARNING;
}
else if(strcmp(value,"3") == 0)
{
-// setlogmask(LOG_UPTO(LOG_DEBUG));
+ CONFIG_LOG_LEVEL=LOG_LEVEL_DEBUG;
}
else
{
@@ -356,14 +357,6 @@ void daemon_init(void)
setlogmask(LOG_UPTO(LOG_DEBUG));*
setlogmask(LOG_UPTO(LOG_WARNING));*/
- if(CONFIG_LOG_FILE == NULL)
- {
- zabbix_open_log(LOG_TYPE_FILE,LOG_LEVEL_WARNING,NULL);
- }
- else
- {
- zabbix_open_log(LOG_TYPE_FILE,LOG_LEVEL_WARNING,CONFIG_LOG_FILE);
- }
}
@@ -507,6 +500,15 @@ int main()
process_config_file();
+ if(CONFIG_LOG_FILE == NULL)
+ {
+ zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,NULL);
+ }
+ else
+ {
+ zabbix_open_log(LOG_TYPE_FILE,CONFIG_LOG_LEVEL,CONFIG_LOG_FILE);
+ }
+
create_pid_file();
phan.sa_handler = &signal_handler;