summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-29 14:52:43 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-29 14:52:43 +0000
commit82fa1ec92fcead7db28d7a068d11da186ce46a5e (patch)
tree9a81ab93da0becafc9c985cb0c34b4c45e18afd4 /src
parent3a3842ee8b895e6bb12212dbd26d407b90295827 (diff)
- [DEV-86] DM: Synchronizing all history data with master node (Sasha)
git-svn-id: svn://svn.zabbix.com/trunk@5118 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_server/nodewatcher/history.c2
-rw-r--r--src/zabbix_server/trapper/Makefile.am1
-rw-r--r--src/zabbix_server/trapper/nodeevents.c156
-rw-r--r--src/zabbix_server/trapper/nodeevents.h26
-rw-r--r--src/zabbix_server/trapper/trapper.c1
5 files changed, 1 insertions, 185 deletions
diff --git a/src/zabbix_server/nodewatcher/history.c b/src/zabbix_server/nodewatcher/history.c
index 7cc9aa0f..22689d2c 100644
--- a/src/zabbix_server/nodewatcher/history.c
+++ b/src/zabbix_server/nodewatcher/history.c
@@ -296,7 +296,7 @@ static void process_history_tables(int master_nodeid, int nodeid)
zabbix_log(LOG_LEVEL_DEBUG, "In process_history_tables()");
for (t = 0; tables[t].table != 0; t++) {
- if (tables[t].flags & (/*ZBX_HISTORY | */ZBX_HISTORY_SYNC/* | ZBX_HISTORY_TRENDS*/))
+ if (tables[t].flags & (ZBX_HISTORY | ZBX_HISTORY_SYNC | ZBX_HISTORY_TRENDS))
process_history_table_data(&tables[t], master_nodeid, nodeid);
}
diff --git a/src/zabbix_server/trapper/Makefile.am b/src/zabbix_server/trapper/Makefile.am
index 7ae3de52..dc09025f 100644
--- a/src/zabbix_server/trapper/Makefile.am
+++ b/src/zabbix_server/trapper/Makefile.am
@@ -6,6 +6,5 @@ libzbxtrapper_a_SOURCES = \
active.c active.h \
trapper.c trapper.h \
nodesync.c nodesync.h \
- nodeevents.c nodeevents.h \
nodehistory.c nodehistory.h \
nodecommand.c nodecommand.h
diff --git a/src/zabbix_server/trapper/nodeevents.c b/src/zabbix_server/trapper/nodeevents.c
deleted file mode 100644
index 7fd21b3e..00000000
--- a/src/zabbix_server/trapper/nodeevents.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-** ZABBIX
-** Copyright (C) 2000-2005 SIA Zabbix
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#include <string.h>
-
-#include <time.h>
-
-#include <sys/socket.h>
-#include <errno.h>
-
-/* Functions: pow(), round() */
-#include <math.h>
-
-#include "common.h"
-#include "db.h"
-#include "log.h"
-#include "zlog.h"
-
-#include "../events.h"
-
-#include "nodeevents.h"
-
-/******************************************************************************
- * *
- * Function: process_record *
- * *
- * Purpose: process record update *
- * *
- * Parameters: *
- * *
- * Return value: SUCCEED - processed successfully *
- * FAIL - an error occured *
- * *
- * Author: Alexei Vladishev *
- * *
- * Comments: *
- * *
- ******************************************************************************/
-static int process_record(int nodeid, char *record)
-{
- char tmp[MAX_STRING_LEN];
-
- DB_EVENT event;
-
- zabbix_log( LOG_LEVEL_DEBUG, "In process_record [%s]",
- record);
-
- memset(&event,0,sizeof(DB_EVENT));
-
- zbx_get_field(record,tmp,0,ZBX_DM_DELIMITER);
- ZBX_STR2UINT64(event.eventid, tmp);
-
- zbx_get_field(record,tmp,1,ZBX_DM_DELIMITER);
- event.source=atoi(tmp);
-
- zbx_get_field(record,tmp,2,ZBX_DM_DELIMITER);
- event.object=atoi(tmp);
-
- zbx_get_field(record,tmp,3,ZBX_DM_DELIMITER);
- ZBX_STR2UINT64(event.objectid, tmp);
-
- zbx_get_field(record,tmp,4,ZBX_DM_DELIMITER);
- event.clock=atoi(tmp);
-
- zbx_get_field(record,tmp,5,ZBX_DM_DELIMITER);
- event.value=atoi(tmp);
-
- zbx_get_field(record,tmp,6,ZBX_DM_DELIMITER);
- event.acknowledged=atoi(tmp);
-
- return process_event(&event);
-}
-/******************************************************************************
- * *
- * Function: node_events *
- * *
- * Purpose: process new events received from a salve node *
- * *
- * Parameters: *
- * *
- * Return value: SUCCEED - processed successfully *
- * FAIL - an error occured *
- * *
- * Author: Alexei Vladishev *
- * *
- * Comments: *
- * *
- ******************************************************************************/
-int node_events(char *data)
-{
- char *s;
- int firstline=1;
- int nodeid=0;
- int sender_nodeid=0;
- char tmp[MAX_STRING_LEN];
- int datalen;
-
- datalen = strlen(data);
-
- zabbix_log( LOG_LEVEL_DEBUG, "In node_events(len:%d)",
- datalen);
-
- DBbegin();
- s=(char *)strtok(data,"\n");
- while(s!=NULL)
- {
- if(firstline == 1)
- {
-/* zabbix_log( LOG_LEVEL_WARNING, "First line [%s]", s); */
- zbx_get_field(s,tmp,1,ZBX_DM_DELIMITER);
- sender_nodeid=atoi(tmp);
- zbx_get_field(s,tmp,2,ZBX_DM_DELIMITER);
- nodeid=atoi(tmp);
- firstline=0;
- zabbix_log( LOG_LEVEL_WARNING, "NODE %d: Received events from node %d for node %d datalen %d",
- CONFIG_NODEID,
- sender_nodeid,
- nodeid,
- datalen);
- }
- else
- {
-/* zabbix_log( LOG_LEVEL_WARNING, "Got line [%s]", s); */
- process_record(nodeid, s);
- }
-
- s=(char *)strtok(NULL,"\n");
- }
- DBcommit();
- return SUCCEED;
-}
diff --git a/src/zabbix_server/trapper/nodeevents.h b/src/zabbix_server/trapper/nodeevents.h
deleted file mode 100644
index d990c9b0..00000000
--- a/src/zabbix_server/trapper/nodeevents.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-** ZABBIX
-** Copyright (C) 2000-2005 SIA Zabbix
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-
-
-#ifndef ZABBIX_NODEEVENTS_H
-#define ZABBIX_NODEEVENTS_H
-
-int node_events(char *data);
-
-#endif
diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c
index 09e43e56..4a47afac 100644
--- a/src/zabbix_server/trapper/trapper.c
+++ b/src/zabbix_server/trapper/trapper.c
@@ -32,7 +32,6 @@
#include "../nodewatcher/nodecomms.h"
#include "../nodewatcher/nodesender.h"
#include "nodesync.h"
-#include "nodeevents.h"
#include "nodehistory.h"
#include "trapper.h"
#include "active.h"