summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-24 12:58:16 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-24 12:58:16 +0000
commit70d2cd50abf74c0347875986e2cb53152a0de089 (patch)
tree35aa2ae55270fe70b1fcf519773b433fddb4aebf /src
parent5108ff1c2043cea3539e2f8ab7016609b5bb7f2f (diff)
Minor fixes.
git-svn-id: svn://svn.zabbix.com/trunk@2353 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxcommon/misc.c9
-rw-r--r--src/libs/zbxdbhigh/db.c2
-rw-r--r--src/zabbix_server/functions.c17
3 files changed, 25 insertions, 3 deletions
diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c
index 6dd91d97..0cb14d76 100644
--- a/src/libs/zbxcommon/misc.c
+++ b/src/libs/zbxcommon/misc.c
@@ -156,11 +156,20 @@ void set_result_type(AGENT_RESULT *result, char *c)
{
result->type |= AR_UINT64;
result->ui64 = (zbx_uint64_t)atoll(c);
+
+ result->type |= AR_DOUBLE;
+ result->dbl = (double)atof(c);
+
+ result->type |= AR_STRING;
+ result->str = strdup(c);
}
else if(is_double(c) == SUCCEED)
{
result->type |= AR_DOUBLE;
result->dbl = (double)atof(c);
+
+ result->type |= AR_STRING;
+ result->str = strdup(c);
}
else
{
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 0c8151c3..c306f36e 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -1022,7 +1022,7 @@ int DBadd_history_uint(int itemid, zbx_uint64_t value, int clock)
zabbix_log(LOG_LEVEL_DEBUG,"In add_history_uint()");
- snprintf(sql,sizeof(sql)-1,"insert into history (clock,itemid,value) values (%d,%d," ZBX_FS_UI64 ")",clock,itemid,value);
+ snprintf(sql,sizeof(sql)-1,"insert into history_uint (clock,itemid,value) values (%d,%d," ZBX_FS_UI64 ")",clock,itemid,value);
DBexecute(sql);
DBadd_trend(itemid, (double)value, clock);
diff --git a/src/zabbix_server/functions.c b/src/zabbix_server/functions.c
index e39f136b..730c7621 100644
--- a/src/zabbix_server/functions.c
+++ b/src/zabbix_server/functions.c
@@ -575,6 +575,13 @@ static int add_history(DB_ITEM *item, AGENT_RESULT *value, int now)
zabbix_log( LOG_LEVEL_WARNING, "In add_history(%d,%X)", item->itemid, value->type);
+ if(value->type & AR_UINT64)
+ zabbix_log( LOG_LEVEL_WARNING, "In add_history(%d,UINT64:" ZBX_FS_UI64 ")", item->itemid, value->ui64);
+ if(value->type & AR_STRING)
+ zabbix_log( LOG_LEVEL_WARNING, "In add_history(%d,STRING:%s)", item->itemid, value->str);
+ if(value->type & AR_DOUBLE)
+ zabbix_log( LOG_LEVEL_WARNING, "In add_history(%d,DOUBLE:" ZBX_FS_DBL ")", item->itemid, value->dbl);
+
if(item->history>0)
{
zabbix_log( LOG_LEVEL_WARNING, "history>0");
@@ -636,11 +643,15 @@ zabbix_log( LOG_LEVEL_WARNING, "6");
}
else if(item->value_type==ITEM_VALUE_TYPE_STR)
{
- DBadd_history_str(item->itemid,value->str,now);
+ zabbix_log( LOG_LEVEL_WARNING, "7");
+ if(value->type & AR_STRING)
+ DBadd_history_str(item->itemid,value->str,now);
}
else if(item->value_type==ITEM_VALUE_TYPE_LOG)
{
- DBadd_history_log(item->itemid,value->str,now,item->timestamp,item->eventlog_source,item->eventlog_severity);
+ zabbix_log( LOG_LEVEL_WARNING, "8");
+ if(value->type & AR_STRING)
+ DBadd_history_log(item->itemid,value->str,now,item->timestamp,item->eventlog_source,item->eventlog_severity);
snprintf(sql,sizeof(sql)-1,"update items set lastlogsize=%d where itemid=%d",item->lastlogsize,item->itemid);
DBexecute(sql);
}
@@ -650,6 +661,8 @@ zabbix_log( LOG_LEVEL_WARNING, "6");
}
}
+ zabbix_log( LOG_LEVEL_WARNING, "End of add_history");
+
return ret;
}