diff options
Diffstat (limited to 'src/zabbix_server/server.c')
-rw-r--r-- | src/zabbix_server/server.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index 97c57c4e..1ad2fe76 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -32,6 +32,7 @@ #include "daemon.h" #include "alerter/alerter.h" +#include "discoverer/discoverer.h" #include "httppoller/httppoller.h" #include "housekeeper/housekeeper.h" #include "pinger/pinger.h" @@ -82,6 +83,7 @@ struct option longopts[] = pid_t *threads=NULL; int CONFIG_ALERTER_FORKS = 1; +int CONFIG_DISCOVERER_FORKS = 1; int CONFIG_HOUSEKEEPER_FORKS = 1; int CONFIG_NODEWATCHER_FORKS = 1; int CONFIG_PINGER_FORKS = 1; @@ -144,6 +146,7 @@ void init_config(void) static struct cfg_line cfg[]= { /* PARAMETER ,VAR ,FUNC, TYPE(0i,1s),MANDATORY,MIN,MAX */ + {"StartDiscoverers",&CONFIG_DISCOVERER_FORKS,0,TYPE_INT,PARM_OPT,0,255}, {"StartHTTPPollers",&CONFIG_HTTPPOLLER_FORKS,0,TYPE_INT,PARM_OPT,0,255}, {"StartPingers",&CONFIG_PINGER_FORKS,0,TYPE_INT,PARM_OPT,0,255}, {"StartPollers",&CONFIG_POLLER_FORKS,0,TYPE_INT,PARM_OPT,0,255}, @@ -508,14 +511,17 @@ int MAIN_ZABBIX_ENTRY(void) #endif threads = calloc(1+CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS +CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS - +CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS,sizeof(pid_t)); + +CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS+CONFIG_DISCOVERER_FORKS, + sizeof(pid_t)); if(CONFIG_TRAPPERD_FORKS > 0) { listenfd = tcp_listen(host,CONFIG_LISTEN_PORT,&addrlen); } - for(i=1; i<=CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS+CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS+CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS; i++) + for( i=1; + i<=CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS+CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS+CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS+CONFIG_DISCOVERER_FORKS; + i++) { if((pid = zbx_fork()) == 0) { @@ -616,6 +622,16 @@ int MAIN_ZABBIX_ENTRY(void) - CONFIG_ALERTER_FORKS - CONFIG_HOUSEKEEPER_FORKS - CONFIG_TIMER_FORKS - CONFIG_UNREACHABLE_POLLER_FORKS - CONFIG_NODEWATCHER_FORKS); } + else if(server_num <= CONFIG_POLLER_FORKS + CONFIG_TRAPPERD_FORKS + CONFIG_PINGER_FORKS + CONFIG_ALERTER_FORKS + + CONFIG_HOUSEKEEPER_FORKS + CONFIG_TIMER_FORKS + CONFIG_UNREACHABLE_POLLER_FORKS + + CONFIG_NODEWATCHER_FORKS + CONFIG_HTTPPOLLER_FORKS + CONFIG_DISCOVERER_FORKS) + { + zabbix_log( LOG_LEVEL_WARNING, "server #%d started [Discoverer]", + server_num); + main_discoverer_loop(server_num - CONFIG_POLLER_FORKS - CONFIG_TRAPPERD_FORKS -CONFIG_PINGER_FORKS + - CONFIG_ALERTER_FORKS - CONFIG_HOUSEKEEPER_FORKS - CONFIG_TIMER_FORKS + - CONFIG_UNREACHABLE_POLLER_FORKS - CONFIG_NODEWATCHER_FORKS - CONFIG_HTTPPOLLER_FORKS); + } return SUCCEED; /* @@ -702,7 +718,7 @@ void zbx_on_exit() if(threads != NULL) { - for(i = 1; i <= CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS+CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS+CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS; i++) + for(i = 1; i <= CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS+CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS+CONFIG_NODEWATCHER_FORKS+CONFIG_HTTPPOLLER_FORKS+CONFIG_DISCOVERER_FORKS; i++) { if(threads[i]) { kill(threads[i],SIGTERM); |