summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-22 14:44:15 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-22 14:44:15 +0000
commit9a5879720db8f0c101623e9ae3c6a7e78199571f (patch)
treeb17f8a0b330651fce955698c5dd904860c165a6d /src/zabbix_agent
parent0f41b690e0f3f2db1b53b874ae42ec626b7d7096 (diff)
downloadzabbix-9a5879720db8f0c101623e9ae3c6a7e78199571f.tar.gz
zabbix-9a5879720db8f0c101623e9ae3c6a7e78199571f.tar.xz
zabbix-9a5879720db8f0c101623e9ae3c6a7e78199571f.zip
- [DEV-148] added support of DisablePassive parameter for agent (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@5646 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_agent')
-rw-r--r--src/zabbix_agent/zabbix_agentd.c15
-rw-r--r--src/zabbix_agent/zbxconf.c8
-rw-r--r--src/zabbix_agent/zbxconf.h1
3 files changed, 21 insertions, 3 deletions
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index 4f463f49..82e80c1e 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -243,16 +243,25 @@ int MAIN_ZABBIX_ENTRY(void)
zabbix_log(LOG_LEVEL_INFORMATION, "zabbix_agentd started. ZABBIX %s.", ZABBIX_VERSION);
- if( FAIL == zbx_tcp_listen(&listen_sock, CONFIG_LISTEN_IP, (unsigned short)CONFIG_LISTEN_PORT) )
+ if(0 == CONFIG_DISABLE_PASSIVE)
{
- zabbix_log(LOG_LEVEL_CRIT, "Listener failed with error: %s.", zbx_tcp_strerror());
- exit(1);
+ if( FAIL == zbx_tcp_listen(&listen_sock, CONFIG_LISTEN_IP, (unsigned short)CONFIG_LISTEN_PORT) )
+ {
+ zabbix_log(LOG_LEVEL_CRIT, "Listener failed with error: %s.", zbx_tcp_strerror());
+ exit(1);
+ }
}
init_collector_data();
/* --- START THREADS ---*/
+ if(1 == CONFIG_DISABLE_PASSIVE)
+ {
+ /* Only main process and active checks will be started */
+ CONFIG_ZABBIX_FORKS = 2;
+ }
+
threads = calloc(CONFIG_ZABBIX_FORKS, sizeof(ZBX_THREAD_HANDLE));
threads[i=0] = zbx_thread_start(collector_thread, NULL);
diff --git a/src/zabbix_agent/zbxconf.c b/src/zabbix_agent/zbxconf.c
index 805fc9f9..a55e3574 100644
--- a/src/zabbix_agent/zbxconf.c
+++ b/src/zabbix_agent/zbxconf.c
@@ -46,6 +46,7 @@ char *CONFIG_HOSTNAME = NULL;
int CONFIG_DISABLE_ACTIVE = 0;
+int CONFIG_DISABLE_PASSIVE = 0;
int CONFIG_ENABLE_REMOTE_COMMANDS = 0;
int CONFIG_LISTEN_PORT = 10050;
int CONFIG_SERVER_PORT = 10051;
@@ -75,6 +76,7 @@ void load_config()
{"LogFile", &CONFIG_LOG_FILE, 0,TYPE_STRING, PARM_OPT, 0,0},
{"LogFileSize", &CONFIG_LOG_FILE_SIZE, 0,TYPE_INT, PARM_OPT, 0,1024},
{"DisableActive", &CONFIG_DISABLE_ACTIVE, 0,TYPE_INT, PARM_OPT, 0,1},
+ {"DisablePassive", &CONFIG_DISABLE_PASSIVE,0,TYPE_INT, PARM_OPT, 0,1},
{"Timeout", &CONFIG_TIMEOUT, 0,TYPE_INT, PARM_OPT, 1,30},
{"ListenPort", &CONFIG_LISTEN_PORT, 0,TYPE_INT, PARM_OPT, 1024,32767},
{"ServerPort", &CONFIG_SERVER_PORT, 0,TYPE_INT, PARM_OPT, 1024,32767},
@@ -122,6 +124,12 @@ void load_config()
exit(1);
}
}
+
+ if(CONFIG_DISABLE_ACTIVE == 1 && CONFIG_DISABLE_PASSIVE == 1)
+ {
+ zabbix_log( LOG_LEVEL_CRIT, "Either active or passive checks must be enabled");
+ exit(1);
+ }
}
static int add_parameter(char *key)
diff --git a/src/zabbix_agent/zbxconf.h b/src/zabbix_agent/zbxconf.h
index a4d656bf..c0a39806 100644
--- a/src/zabbix_agent/zbxconf.h
+++ b/src/zabbix_agent/zbxconf.h
@@ -24,6 +24,7 @@ extern char *CONFIG_HOSTS_ALLOWED;
extern char *CONFIG_HOSTNAME;
/* extern int CONFIG_NOTIMEWAIT; */
extern int CONFIG_DISABLE_ACTIVE;
+extern int CONFIG_DISABLE_PASSIVE;
extern int CONFIG_ENABLE_REMOTE_COMMANDS;
extern int CONFIG_LISTEN_PORT;
extern int CONFIG_SERVER_PORT;