summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server/poller
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-12 10:16:37 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-12 10:16:37 +0000
commita174657a08aa9db0197826859685befaa6b94886 (patch)
treec252587d65e65af0a8d59e20243a04d9f53b4a28 /src/zabbix_server/poller
parentdbbad4cae1ee7e9dc3dd18577b300d6ac98843c6 (diff)
downloadzabbix-a174657a08aa9db0197826859685befaa6b94886.tar.gz
zabbix-a174657a08aa9db0197826859685befaa6b94886.tar.xz
zabbix-a174657a08aa9db0197826859685befaa6b94886.zip
- [DEV-109] Server changes - Poller
git-svn-id: svn://svn.zabbix.com/trunk@5345 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/poller')
-rw-r--r--src/zabbix_server/poller/checks_agent.c1
-rw-r--r--src/zabbix_server/poller/checks_agent.h4
-rw-r--r--src/zabbix_server/poller/checks_aggregate.c8
-rw-r--r--src/zabbix_server/poller/checks_aggregate.h2
-rw-r--r--src/zabbix_server/poller/checks_external.c2
-rw-r--r--src/zabbix_server/poller/checks_external.h6
-rw-r--r--src/zabbix_server/poller/poller.c251
-rw-r--r--src/zabbix_server/poller/poller.h9
8 files changed, 170 insertions, 113 deletions
diff --git a/src/zabbix_server/poller/checks_agent.c b/src/zabbix_server/poller/checks_agent.c
index 99b5a7c6..1ae90662 100644
--- a/src/zabbix_server/poller/checks_agent.c
+++ b/src/zabbix_server/poller/checks_agent.c
@@ -18,6 +18,7 @@
**/
#include "common.h"
#include "comms.h"
+#include "log.h"
#include "checks_agent.h"
diff --git a/src/zabbix_server/poller/checks_agent.h b/src/zabbix_server/poller/checks_agent.h
index f890eee7..efb3d915 100644
--- a/src/zabbix_server/poller/checks_agent.h
+++ b/src/zabbix_server/poller/checks_agent.h
@@ -20,13 +20,9 @@
#ifndef ZABBIX_CHECKS_AGENT_H
#define ZABBIX_CHECKS_AGENT_H
-#include "common.h"
#include "db.h"
-#include "log.h"
#include "sysinfo.h"
-extern int CONFIG_NOTIMEWAIT;
-
extern int get_value_agent(DB_ITEM *item, AGENT_RESULT *result);
#endif
diff --git a/src/zabbix_server/poller/checks_aggregate.c b/src/zabbix_server/poller/checks_aggregate.c
index 29e56cb7..033e2991 100644
--- a/src/zabbix_server/poller/checks_aggregate.c
+++ b/src/zabbix_server/poller/checks_aggregate.c
@@ -18,6 +18,8 @@
**/
#include "common.h"
+#include "log.h"
+
#include "checks_aggregate.h"
static int evaluate_one(double *result, int *num, char *grpfunc, char const *value_str, int valuetype)
@@ -111,12 +113,14 @@ static int evaluate_aggregate(AGENT_RESULT *res,char *grpfunc, char *hostgroup,
DBescape_string(hostgroup,hostgroup_esc,MAX_STRING_LEN);
/* Get list of affected item IDs */
strscpy(items,"0");
- result = DBselect("select itemid from items i,hosts_groups hg,hosts h,groups g where hg.groupid=g.groupid and i.hostid=h.hostid and hg.hostid=h.hostid and g.name='%s' and i.key_='%s' and i.status=%d and h.status=%d and" ZBX_COND_NODEID,
+ result = DBselect("select i.itemid from items i,hosts_groups hg,hosts h,groups g"
+ " where hg.groupid=g.groupid and i.hostid=h.hostid and hg.hostid=h.hostid"
+ " and g.name='%s' and i.key_='%s' and i.status=%d and h.status=%d" DB_NODE,
hostgroup_esc,
itemkey_esc,
ITEM_STATUS_ACTIVE,
HOST_STATUS_MONITORED,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
while((row=DBfetch(result)))
{
diff --git a/src/zabbix_server/poller/checks_aggregate.h b/src/zabbix_server/poller/checks_aggregate.h
index 0d42b2bd..3c170a3a 100644
--- a/src/zabbix_server/poller/checks_aggregate.h
+++ b/src/zabbix_server/poller/checks_aggregate.h
@@ -20,9 +20,7 @@
#ifndef ZABBIX_CHECKS_AGGREGATE_H
#define ZABBIX_CHECKS_AGGREGATE_H
-#include "common.h"
#include "db.h"
-#include "log.h"
#include "sysinfo.h"
extern int get_value_aggregate(DB_ITEM *item, AGENT_RESULT *result);
diff --git a/src/zabbix_server/poller/checks_external.c b/src/zabbix_server/poller/checks_external.c
index a4a164b7..58346ebb 100644
--- a/src/zabbix_server/poller/checks_external.c
+++ b/src/zabbix_server/poller/checks_external.c
@@ -18,6 +18,8 @@
**/
#include "common.h"
+#include "log.h"
+
#include "checks_external.h"
/******************************************************************************
diff --git a/src/zabbix_server/poller/checks_external.h b/src/zabbix_server/poller/checks_external.h
index cdabbaab..1016e6b3 100644
--- a/src/zabbix_server/poller/checks_external.h
+++ b/src/zabbix_server/poller/checks_external.h
@@ -20,13 +20,7 @@
#ifndef ZABBIX_CHECKS_EXTERNAL_H
#define ZABBIX_CHECKS_EXTERNAL_H
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "common.h"
#include "db.h"
-#include "log.h"
#include "sysinfo.h"
extern char *CONFIG_EXTERNALSCRIPTS;
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index c5700cd2..1c4cd3d4 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -20,14 +20,14 @@
#include "common.h"
#include "zlog.h"
+#include "db.h"
+#include "sysinfo.h"
+#include "daemon.h"
#include "../functions.h"
#include "../expression.h"
#include "poller.h"
-#include "db.h"
-#include "sysinfo.h"
-
#include "checks_agent.h"
#include "checks_aggregate.h"
#include "checks_external.h"
@@ -36,12 +36,12 @@
#include "checks_snmp.h"
#include "checks_db.h"
-#include "daemon.h"
-
AGENT_RESULT result;
-int poller_type;
-int poller_num;
+static zbx_process_t zbx_process;
+int poller_type;
+int poller_num;
+
int get_value(DB_ITEM *item, AGENT_RESULT *result)
{
@@ -121,7 +121,11 @@ static int get_minnextcheck(int now)
2 == UNREACHABLE */
if(poller_type == ZBX_POLLER_TYPE_UNREACHABLE)
{
- result = DBselect("select count(*),min(nextcheck) as nextcheck from items i,hosts h where " ZBX_SQL_MOD(h.hostid,%d) "=%d and i.nextcheck<=%d and i.status in (%d) and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d and h.errors_from!=0 and h.hostid=i.hostid and i.key_ not in ('%s','%s','%s','%s') and " ZBX_COND_NODEID "order by nextcheck",
+ result = DBselect("select count(*),min(nextcheck) as nextcheck from items i,hosts h"
+ " where " ZBX_SQL_MOD(h.hostid,%d) "=%d and i.nextcheck<=%d and i.status in (%d)"
+ " and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d"
+ " and h.errors_from!=0 and h.hostid=i.hostid and i.key_ not in ('%s','%s','%s','%s')"
+ DB_NODE " order by nextcheck",
CONFIG_UNREACHABLE_POLLER_FORKS,
poller_num-1,
now,
@@ -130,13 +134,16 @@ static int get_minnextcheck(int now)
HOST_STATUS_MONITORED,
now,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
else
{
if(CONFIG_REFRESH_UNSUPPORTED != 0)
{
- result = DBselect("select count(*),min(nextcheck) from items i,hosts h where h.status=%d and h.disable_until<%d and h.errors_from=0 and h.hostid=i.hostid and i.status in (%d,%d) and i.type not in (%d,%d,%d) and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s') and" ZBX_COND_NODEID,
+ result = DBselect("select count(*),min(nextcheck) from items i,hosts h"
+ " where h.status=%d and h.disable_until<%d and h.errors_from=0"
+ " and h.hostid=i.hostid and i.status in (%d,%d) and i.type not in (%d,%d,%d)"
+ " and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s')" DB_NODE,
HOST_STATUS_MONITORED,
now,
ITEM_STATUS_ACTIVE, ITEM_STATUS_NOTSUPPORTED,
@@ -144,11 +151,14 @@ static int get_minnextcheck(int now)
CONFIG_POLLER_FORKS,
poller_num-1,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
else
{
- result = DBselect("select count(*),min(nextcheck) from items i,hosts h where h.status=%d and h.disable_until<%d and h.errors_from=0 and h.hostid=i.hostid and i.status in (%d) and i.type not in (%d,%d,%d) and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s') and" ZBX_COND_NODEID,
+ result = DBselect("select count(*),min(nextcheck) from items i,hosts h"
+ " where h.status=%d and h.disable_until<%d and h.errors_from=0"
+ " and h.hostid=i.hostid and i.status in (%d) and i.type not in (%d,%d,%d)"
+ " and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s')" DB_NODE,
HOST_STATUS_MONITORED,
now,
ITEM_STATUS_ACTIVE,
@@ -156,7 +166,7 @@ static int get_minnextcheck(int now)
CONFIG_POLLER_FORKS,
poller_num-1,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
}
@@ -199,15 +209,12 @@ static void update_key_status(zbx_uint64_t hostid,int host_status)
hostid,
host_status);
- result = DBselect("select %s where h.hostid=i.hostid and h.hostid=" ZBX_FS_UI64 " and i.key_='%s'",
+ result = DBselect("select %s where h.hostid=i.hostid and h.proxyid=0 and h.hostid=" ZBX_FS_UI64 " and i.key_='%s'",
ZBX_SQL_ITEM_SELECT,
hostid,
SERVER_STATUS_KEY);
- row = DBfetch(result);
-
- if(row)
- {
+ while (NULL != (row = DBfetch(result))) {
DBget_item_from_db(&item,row);
/* Do not process new value for status, if previous status is the same */
@@ -215,24 +222,77 @@ static void update_key_status(zbx_uint64_t hostid,int host_status)
update = update || ((item.value_type == ITEM_VALUE_TYPE_FLOAT) &&(cmp_double(item.lastvalue_dbl, (double)host_status) == 1));
update = update || ((item.value_type == ITEM_VALUE_TYPE_UINT64) &&(item.lastvalue_uint64 != host_status));
- if(update)
- {
+ if (update) {
init_result(&agent);
SET_UI64_RESULT(&agent, host_status);
- process_new_value(&item,&agent);
- free_result(&agent);
- update_triggers(item.itemid);
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ process_new_value(&item, &agent);
+ update_triggers(item.itemid);
+ break;
+ case ZBX_PROCESS_PROXY:
+ proxy_process_new_value(&item, &agent);
+ break;
+ }
+
+ free_result(&agent);
}
}
- else
- {
- zabbix_log( LOG_LEVEL_DEBUG, "No items to update.");
- }
DBfree_result(result);
}
+static void enable_host(DB_ITEM *item, time_t now, char *error)
+{
+ assert(item);
+
+ zabbix_log(LOG_LEVEL_WARNING, "Enabling host [%s]",
+ item->host_name);
+ zabbix_syslog("Enabling host [%s]",
+ item->host_name);
+
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ DBupdate_host_availability(item->hostid, HOST_AVAILABLE_TRUE, now, error);
+ update_key_status(item->hostid, HOST_STATUS_MONITORED); /* 0 */
+ break;
+ case ZBX_PROCESS_PROXY:
+ DBproxy_update_host_availability(item->hostid, HOST_AVAILABLE_TRUE, now);
+ break;
+ }
+
+ item->host_available = HOST_AVAILABLE_TRUE;
+}
+
+static void disable_host(DB_ITEM *item, time_t now, char *error)
+{
+ assert(item);
+
+ zabbix_log(LOG_LEVEL_WARNING, "Host [%s] will be checked after %d seconds",
+ item->host_name,
+ CONFIG_UNAVAILABLE_DELAY);
+ zabbix_syslog("Host [%s] will be checked after %d seconds",
+ item->host_name,
+ CONFIG_UNAVAILABLE_DELAY);
+
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ DBupdate_host_availability(item->hostid, HOST_AVAILABLE_FALSE, now, error);
+ update_key_status(item->hostid, HOST_AVAILABLE_FALSE); /* 2 */
+ break;
+ case ZBX_PROCESS_PROXY:
+ DBproxy_update_host_availability(item->hostid, HOST_AVAILABLE_FALSE, now);
+ break;
+ }
+
+ item->host_available = HOST_AVAILABLE_FALSE;
+
+ DBexecute("update hosts set disable_until=%d where hostid=" ZBX_FS_UI64,
+ now + CONFIG_UNAVAILABLE_DELAY,
+ item->hostid);
+}
+
/******************************************************************************
* *
* Function: get_values *
@@ -275,7 +335,11 @@ int get_values(void)
/* Poller for unreachable hosts */
if(poller_type == ZBX_POLLER_TYPE_UNREACHABLE)
{
- result = DBselect("select h.hostid,min(i.itemid) from hosts h,items i where " ZBX_SQL_MOD(h.hostid,%d) "=%d and i.nextcheck<=%d and i.status in (%d) and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d and h.errors_from!=0 and h.hostid=i.hostid and i.key_ not in ('%s','%s','%s','%s') and " ZBX_COND_NODEID " group by h.hostid",
+ result = DBselect("select h.hostid,min(i.itemid) from hosts h,items i"
+ " where " ZBX_SQL_MOD(h.hostid,%d) "=%d and i.nextcheck<=%d and i.status in (%d)"
+ " and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d"
+ " and h.errors_from!=0 and h.hostid=i.hostid and h.proxyid=0"
+ " and i.key_ not in ('%s','%s','%s','%s')" DB_NODE " group by h.hostid",
CONFIG_UNREACHABLE_POLLER_FORKS,
poller_num-1,
now,
@@ -284,13 +348,17 @@ int get_values(void)
HOST_STATUS_MONITORED,
now,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
else
{
if(CONFIG_REFRESH_UNSUPPORTED != 0)
{
- result = DBselect("select %s where i.nextcheck<=%d and i.status in (%d,%d) and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d and h.errors_from=0 and h.hostid=i.hostid and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s') and " ZBX_COND_NODEID " order by i.nextcheck",
+ result = DBselect("select %s where i.nextcheck<=%d and i.status in (%d,%d)"
+ " and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d"
+ " and h.errors_from=0 and h.hostid=i.hostid and h.proxyid=0"
+ " and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s')"
+ DB_NODE " order by i.nextcheck",
ZBX_SQL_ITEM_SELECT,
now,
ITEM_STATUS_ACTIVE, ITEM_STATUS_NOTSUPPORTED,
@@ -300,11 +368,15 @@ int get_values(void)
CONFIG_POLLER_FORKS,
poller_num-1,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
else
{
- result = DBselect("select %s where i.nextcheck<=%d and i.status in (%d) and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d and h.errors_from=0 and h.hostid=i.hostid and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s') and " ZBX_COND_NODEID " order by i.nextcheck",
+ result = DBselect("select %s where i.nextcheck<=%d and i.status in (%d)"
+ " and i.type not in (%d,%d,%d) and h.status=%d and h.disable_until<=%d"
+ " and h.errors_from=0 and h.hostid=i.hostid and h.proxyid=0"
+ " and " ZBX_SQL_MOD(i.itemid,%d) "=%d and i.key_ not in ('%s','%s','%s','%s')"
+ DB_NODE " order by i.nextcheck",
ZBX_SQL_ITEM_SELECT,
now,
ITEM_STATUS_ACTIVE,
@@ -314,7 +386,7 @@ int get_values(void)
CONFIG_POLLER_FORKS,
poller_num-1,
SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY,
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
}
}
@@ -328,10 +400,10 @@ int get_values(void)
/* Poller for unreachable hosts */
if(poller_type == ZBX_POLLER_TYPE_UNREACHABLE)
{
- result2 = DBselect("select %s where h.hostid=i.hostid and i.itemid=%s and" ZBX_COND_NODEID,
+ result2 = DBselect("select %s where h.hostid=i.hostid and h.proxyid=0 and i.itemid=%s" DB_NODE,
ZBX_SQL_ITEM_SELECT,
row[1],
- LOCAL_NODE("h.hostid"));
+ DBnode_local("h.hostid"));
row2 = DBfetch(result2);
@@ -361,32 +433,33 @@ int get_values(void)
if(res == SUCCEED )
{
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ process_new_value(&item, &agent);
+ break;
+ case ZBX_PROCESS_PROXY:
+ proxy_process_new_value(&item, &agent);
+ break;
+ }
- process_new_value(&item,&agent);
-
- if(HOST_AVAILABLE_TRUE != item.host_available)
- {
- zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]",
- item.host_name);
- zabbix_syslog("Enabling host [%s]",
- item.host_name);
-
- now = time(NULL);
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg);
-
- update_key_status(item.hostid, HOST_STATUS_MONITORED); /* 0 */
- item.host_available=HOST_AVAILABLE_TRUE;
-
- stop=1;
+ if (HOST_AVAILABLE_TRUE != item.host_available) {
+ enable_host(&item, now, agent.msg);
+ stop = 1;
}
- if(item.host_errors_from!=0)
- {
+ if (item.host_errors_from != 0) {
DBexecute("update hosts set errors_from=0 where hostid=" ZBX_FS_UI64,
- item.hostid);
+ item.hostid);
+ stop = 1;
+ }
- stop=1;
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ update_triggers(item.itemid);
+ break;
+ default:
+ /* nothing */;
}
- update_triggers(item.itemid);
+
}
else if(res == NOTSUPPORTED || res == AGENT_ERROR)
{
@@ -402,26 +475,27 @@ int get_values(void)
}
else
{
- zabbix_log( LOG_LEVEL_WARNING, "Parameter [%s] is not supported by agent on host [%s] Old status [%d]",
- item.key,
- item.host_name,
- item.status);
+ zabbix_log(LOG_LEVEL_WARNING, "Parameter [%s] is not supported by agent on host [%s] Old status [%d]",
+ item.key,
+ item.host_name,
+ item.status);
zabbix_syslog("Parameter [%s] is not supported by agent on host [%s]",
- item.key,
- item.host_name);
- DBupdate_item_status_to_notsupported(item.itemid, agent.msg);
- /* if(HOST_STATUS_UNREACHABLE == item.host_status)*/
- if(HOST_AVAILABLE_TRUE != item.host_available)
- {
- zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]",
+ item.key,
item.host_name);
- zabbix_syslog("Enabling host [%s]",
- item.host_name);
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg);
- update_key_status(item.hostid, HOST_STATUS_MONITORED); /* 0 */
- item.host_available=HOST_AVAILABLE_TRUE;
-
- stop=1;
+
+ switch (zbx_process) {
+ case ZBX_PROCESS_SERVER:
+ DBupdate_item_status_to_notsupported(item.itemid, agent.msg);
+ break;
+ case ZBX_PROCESS_PROXY:
+ DBproxy_update_item_status_to_notsupported(item.itemid);
+ break;
+ }
+
+ /* if(HOST_STATUS_UNREACHABLE == item.host_status)*/
+ if (HOST_AVAILABLE_TRUE != item.host_available) {
+ enable_host(&item, now, agent.msg);
+ stop = 1;
}
}
}
@@ -456,22 +530,8 @@ int get_values(void)
}
else
{
- if(now-item.host_errors_from>CONFIG_UNREACHABLE_PERIOD)
- {
- zabbix_log( LOG_LEVEL_WARNING, "Host [%s] will be checked after %d seconds",
- item.host_name,
- CONFIG_UNAVAILABLE_DELAY);
- zabbix_syslog("Host [%s] will be checked after %d seconds",
- item.host_name,
- CONFIG_UNAVAILABLE_DELAY);
-
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_FALSE,now,agent.msg);
- update_key_status(item.hostid,HOST_AVAILABLE_FALSE); /* 2 */
- item.host_available=HOST_AVAILABLE_FALSE;
-
- DBexecute("update hosts set disable_until=%d where hostid=" ZBX_FS_UI64,
- now+CONFIG_UNAVAILABLE_DELAY,
- item.hostid);
+ if (now - item.host_errors_from > CONFIG_UNREACHABLE_PERIOD) {
+ disable_host(&item, now, agent.msg);
}
/* Still unavailable, but won't change status to UNAVAILABLE yet */
else
@@ -516,23 +576,24 @@ int get_values(void)
return SUCCEED;
}
-void main_poller_loop(int type, int num)
+void main_poller_loop(zbx_process_t p, int type, int num)
{
struct sigaction phan;
int now;
int nextcheck,sleeptime;
zabbix_log( LOG_LEVEL_DEBUG, "In main_poller_loop(type:%d,num:%d)",
- type,
- num);
+ type,
+ num);
phan.sa_handler = child_signal_handler;
sigemptyset(&phan.sa_mask);
phan.sa_flags = 0;
sigaction(SIGALRM, &phan, NULL);
- poller_type = type;
- poller_num = num;
+ zbx_process = p;
+ poller_type = type;
+ poller_num = num;
DBconnect(ZBX_DB_CONNECT_NORMAL);
diff --git a/src/zabbix_server/poller/poller.h b/src/zabbix_server/poller/poller.h
index 6f08111c..28fe277a 100644
--- a/src/zabbix_server/poller/poller.h
+++ b/src/zabbix_server/poller/poller.h
@@ -20,6 +20,10 @@
#ifndef ZABBIX_POLLER_H
#define ZABBIX_POLLER_H
+#include "common.h"
+#include "db.h"
+#include "sysinfo.h"
+
extern void signal_handler(int);
extern int server_num;
@@ -30,10 +34,7 @@ extern int CONFIG_UNAVAILABLE_DELAY;
extern int CONFIG_UNREACHABLE_PERIOD;
extern int CONFIG_UNREACHABLE_DELAY;
-void main_poller_loop(int type, int num);
-
-#include "db.h"
-#include "sysinfo.h"
+void main_poller_loop(zbx_process_t p, int type, int num);
int get_value(DB_ITEM *item, AGENT_RESULT *result);