summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-11-09 21:54:54 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-11-09 21:54:54 +0000
commitea43b5989622a03c809ebd2aca8b9ea4e2f5a763 (patch)
tree3b2a856ce86ffde8a70e23ccd96baf9b75823fd4
parent12fb9a31a75ce2ba7a3c14fcc90eaf4344a7b437 (diff)
- added upgrades/dbpatches/1.0beta6_to_1.0beta7/ with patches (Alexei)
- added item type TRAPPER (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@564 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog2
-rw-r--r--TODO1
-rw-r--r--include/common.h3
-rw-r--r--include/db.c2
-rw-r--r--include/functions.c2
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c4
-rw-r--r--upgrades/dbpatches/1.0beta6_to_1.0beta7/mysql/patch.sql1
-rw-r--r--upgrades/dbpatches/1.0beta6_to_1.0beta7/postgresql/patch.sql1
8 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d9926451..c5822aa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
Changes for 1.0beta7:
+ - added upgrades/dbpatches/1.0beta6_to_1.0beta7/ with patches (Alexei)
+ - added item type TRAPPER (Alexei)
- fixes for PostgreSQL (Alexei)
- added validation of host name (Alexei)
- default value of StartSuckers is set to 4 (Alexei)
diff --git a/TODO b/TODO
index 0fbd547b..096a9716 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,6 @@
HIGH PRIORITY:
+ - add item type Zabbix trapper (PHP frontend)
- mass updates/inserts (add items and triggers for all hosts at once)
- support for net-snmp
- LDAP authorisation (should work with MSWindows LDAP)
diff --git a/include/common.h b/include/common.h
index 0562c541..82fbc7ab 100644
--- a/include/common.h
+++ b/include/common.h
@@ -17,6 +17,7 @@
/* Item types */
#define ITEM_TYPE_ZABBIX 0
#define ITEM_TYPE_SNMP 1
+#define ITEM_TYPE_TRAPPER 2
/* Item value types */
#define ITEM_VALUE_TYPE_FLOAT 0
@@ -31,7 +32,7 @@
/* Item statuses */
#define ITEM_STATUS_ACTIVE 0
#define ITEM_STATUS_DISABLED 1
-#define ITEM_STATUS_TRAPPED 2
+/*#define ITEM_STATUS_TRAPPED 2*/
#define ITEM_STATUS_NOTSUPPORTED 3
/* Host statuses */
diff --git a/include/db.c b/include/db.c
index 3e2f0248..ca38e331 100644
--- a/include/db.c
+++ b/include/db.c
@@ -519,7 +519,7 @@ void DBupdate_triggers_status_after_restart(void)
{
triggerid=atoi(DBget_field(result,i,0));
- sprintf(sql,"select min(i.nextcheck+i.delay) from hosts h,items i,triggers t,functions f where f.triggerid=t.triggerid and f.itemid=i.itemid and h.hostid=i.hostid and i.nextcheck<>0 and t.triggerid=%d and i.status<>%d",triggerid,ITEM_STATUS_TRAPPED);
+ sprintf(sql,"select min(i.nextcheck+i.delay) from hosts h,items i,triggers t,functions f where f.triggerid=t.triggerid and f.itemid=i.itemid and h.hostid=i.hostid and i.nextcheck<>0 and t.triggerid=%d and i.type<>%d",triggerid,ITEM_TYPE_TRAPPER);
zabbix_log(LOG_LEVEL_DEBUG,"SQL [%s]",sql);
result2 = DBselect(sql);
if( DBnum_rows(result2) == 0 )
diff --git a/include/functions.c b/include/functions.c
index 2f3a568c..3f25c599 100644
--- a/include/functions.c
+++ b/include/functions.c
@@ -885,7 +885,7 @@ int process_data(int sockfd,char *server,char *key,char *value)
zabbix_log( LOG_LEVEL_DEBUG, "In process_data()");
- sprintf(sql,"select i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.value_type,i.trapper_hosts from items i,hosts h where h.status in (0,2) and h.hostid=i.hostid and h.host='%s' and i.key_='%s' and i.status=%d", server, key, ITEM_STATUS_TRAPPED);
+ sprintf(sql,"select i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.value_type,i.trapper_hosts from items i,hosts h where h.status in (0,2) and h.hostid=i.hostid and h.host='%s' and i.key_='%s' and i.status=%d and i.type=%d", server, key, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER);
result = DBselect(sql);
if(DBnum_rows(result) == 0)
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index 8721ecba..78dd297d 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -996,9 +996,9 @@ int main_nodata_loop()
now=time(NULL);
#ifdef HAVE_PGSQL
- sprintf(sql,"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and (h.status=0 or (h.status=2 and h.disable_until<%d)) and i.itemid=f.itemid and f.function='nodata' and i.lastclock+f.parameter::text::integer<=%d and i.status in (%d,%d) and f.lastvalue<>1", now, now, ITEM_STATUS_ACTIVE, ITEM_STATUS_TRAPPED);
+ sprintf(sql,"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and (h.status=0 or (h.status=2 and h.disable_until<%d)) and i.itemid=f.itemid and f.function='nodata' and i.lastclock+f.parameter::text::integer<=%d and i.status=%d and i.type=%d and f.lastvalue<>1", now, now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER);
#else
- sprintf(sql,"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and (h.status=0 or (h.status=2 and h.disable_until<%d)) and i.itemid=f.itemid and f.function='nodata' and i.lastclock+f.parameter<=%d and i.status in (%d,%d) and f.lastvalue<>1", now, now, ITEM_STATUS_ACTIVE, ITEM_STATUS_TRAPPED);
+ sprintf(sql,"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and (h.status=0 or (h.status=2 and h.disable_until<%d)) and i.itemid=f.itemid and f.function='nodata' and i.lastclock+f.parameter<=%d and i.status=%d and i.type=%d and f.lastvalue<>1", now, now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER);
#endif
result = DBselect(sql);
diff --git a/upgrades/dbpatches/1.0beta6_to_1.0beta7/mysql/patch.sql b/upgrades/dbpatches/1.0beta6_to_1.0beta7/mysql/patch.sql
new file mode 100644
index 00000000..4017091c
--- /dev/null
+++ b/upgrades/dbpatches/1.0beta6_to_1.0beta7/mysql/patch.sql
@@ -0,0 +1 @@
+update items set status=0, type=2 where status=2;
diff --git a/upgrades/dbpatches/1.0beta6_to_1.0beta7/postgresql/patch.sql b/upgrades/dbpatches/1.0beta6_to_1.0beta7/postgresql/patch.sql
new file mode 100644
index 00000000..4017091c
--- /dev/null
+++ b/upgrades/dbpatches/1.0beta6_to_1.0beta7/postgresql/patch.sql
@@ -0,0 +1 @@
+update items set status=0, type=2 where status=2;