summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-08-10 17:59:24 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-08-10 17:59:24 +0000
commita00be6b72f85d6fe57de4fbb4dbf92c67bc6976a (patch)
tree4793307e384e3ef3a21c5ccfe5ab85daa1114a69 /src
parentdd063ef23a40693a5b9bbef6e0f36e444aae94b6 (diff)
downloadzabbix-a00be6b72f85d6fe57de4fbb4dbf92c67bc6976a.tar.gz
zabbix-a00be6b72f85d6fe57de4fbb4dbf92c67bc6976a.tar.xz
zabbix-a00be6b72f85d6fe57de4fbb4dbf92c67bc6976a.zip
- [DEV-137] Misc bugs and improvements
git-svn-id: svn://svn.zabbix.com/trunk@5891 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_server/poller/poller.c4
-rw-r--r--src/zabbix_server/trapper/proxyconfig.c29
2 files changed, 26 insertions, 7 deletions
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index 666014b5..5ac355f5 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -318,7 +318,7 @@ static int get_values(int now)
" and i.key_ not in ('%s','%s','%s','%s')" DB_NODE " group by h.hostid",
CONFIG_UNREACHABLE_POLLER_FORKS,
poller_num-1,
- now + POLLER_DELAY,
+ now,
ITEM_STATUS_ACTIVE,
ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_HTTPTEST,
HOST_STATUS_MONITORED,
@@ -343,7 +343,7 @@ static int get_values(int now)
" 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 + POLLER_DELAY,
+ now,
istatus,
ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_HTTPTEST,
HOST_STATUS_MONITORED,
diff --git a/src/zabbix_server/trapper/proxyconfig.c b/src/zabbix_server/trapper/proxyconfig.c
index d850987d..6f8bd184 100644
--- a/src/zabbix_server/trapper/proxyconfig.c
+++ b/src/zabbix_server/trapper/proxyconfig.c
@@ -40,7 +40,8 @@
* Comments: *
* *
******************************************************************************/
-static int get_proxyconfig_table(zbx_uint64_t proxy_hostid, struct zbx_json *j, ZBX_TABLE *table, const char *reltable, const char *relfield)
+static int get_proxyconfig_table(zbx_uint64_t proxy_hostid, struct zbx_json *j, ZBX_TABLE *table,
+ const char *reltable, const char *relfield)
{
char sql[MAX_STRING_LEN];
int offset = 0, f, fld;
@@ -78,11 +79,28 @@ static int get_proxyconfig_table(zbx_uint64_t proxy_hostid, struct zbx_json *j,
offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " where t.proxy_hostid=" ZBX_FS_UI64,
proxy_hostid);
else
- offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, ", %1$s r where t.%2$s=r.%2$s and r.proxy_hostid="ZBX_FS_UI64_NO(3),
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, ", %1$s r where t.%2$s=r.%2$s"
+ " and r.proxy_hostid="ZBX_FS_UI64_NO(3),
reltable,
relfield,
proxy_hostid);
+ if (0 == strcmp(table->table, "hosts"))
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " and t.status=%d",
+ HOST_STATUS_MONITORED);
+ if (NULL != reltable && 0 == strcmp(reltable, "hosts"))
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " and r.status=%d",
+ HOST_STATUS_MONITORED);
+ if (0 == strcmp(table->table, "items"))
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " and t.status in (%d,%d)",
+ ITEM_STATUS_ACTIVE, ITEM_STATUS_NOTSUPPORTED);
+ if (0 == strcmp(table->table, "drules"))
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " and t.status=%d",
+ DRULE_STATUS_MONITORED);
+ if (NULL != reltable && 0 == strcmp(reltable, "drules"))
+ offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " and r.status=%d",
+ DRULE_STATUS_MONITORED);
+
offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " order by t.%s",
table->recid);
@@ -156,8 +174,10 @@ static int get_proxyconfig_data(zbx_uint64_t proxy_hostid, struct zbx_json *j)
zabbix_log(LOG_LEVEL_DEBUG, "In get_proxyconfig_data() [proxy_hostid:" ZBX_FS_UI64 "]",
proxy_hostid);
- for (t = 0; tables[t].table != 0; t++) {
- for (p = 0; pt[p].table != NULL; p++) {
+ for (t = 0; tables[t].table != 0; t++)
+ {
+ for (p = 0; pt[p].table != NULL; p++)
+ {
if (0 != strcmp(tables[t].table, pt[p].table))
continue;
@@ -165,7 +185,6 @@ static int get_proxyconfig_data(zbx_uint64_t proxy_hostid, struct zbx_json *j)
}
}
-/* fprintf(stderr, "----- [%zd]\n", strlen(j->buffer));*/
return ret;
}