summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-12-01 17:27:57 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-12-01 17:27:57 +0000
commitd891cf94e0d947153725e558d5f3f7f55256a8df (patch)
tree3e72ac8b73fdba9f99a41008c9c1c4aea1128351
parent9a6c2b055631f727a6f599e709574455d7fc8b80 (diff)
downloadzabbix-d891cf94e0d947153725e558d5f3f7f55256a8df.tar.gz
zabbix-d891cf94e0d947153725e558d5f3f7f55256a8df.tar.xz
zabbix-d891cf94e0d947153725e558d5f3f7f55256a8df.zip
Minor fixes.
git-svn-id: svn://svn.zabbix.com/trunk@2382 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--frontends/php/include/classes/graph.inc.php4
-rw-r--r--frontends/php/include/defines.inc.php1
-rw-r--r--src/zabbix_server/functions.c12
3 files changed, 10 insertions, 7 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index 8848da1b..b5c8ed32 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -569,7 +569,9 @@
if($this->period<=24*3600)
{
- $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
+ if($this->items[0]["value_type"] == ITEM_VALUE_TYPE_UINT64) $table="history_uint";
+ else $table="history";
+ $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from $table where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
}
else
{
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 91d19e19..1b8bf426 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -82,6 +82,7 @@
define("ITEM_VALUE_TYPE_FLOAT",0);
define("ITEM_VALUE_TYPE_STR",1);
define("ITEM_VALUE_TYPE_LOG",2);
+ define("ITEM_VALUE_TYPE_UINT64",3);
define("ITEM_STATUS_ACTIVE",0);
define("ITEM_STATUS_DISABLED",1);
diff --git a/src/zabbix_server/functions.c b/src/zabbix_server/functions.c
index e3ae44e6..feb83ccc 100644
--- a/src/zabbix_server/functions.c
+++ b/src/zabbix_server/functions.c
@@ -589,11 +589,11 @@ static int add_history(DB_ITEM *item, AGENT_RESULT *value, int now)
/* Should we store delta or original value? */
if(item->delta == ITEM_STORE_AS_IS)
{
- if(value->type & AR_UINT64)
+ if( (item->value_type==ITEM_VALUE_TYPE_UINT64) && (value->type & AR_UINT64))
{
DBadd_history_uint(item->itemid,value->ui64,now);
}
- if(value->type & AR_DOUBLE)
+ if( (item->value_type==ITEM_VALUE_TYPE_FLOAT) && (value->type & AR_DOUBLE))
{
DBadd_history(item->itemid,value->dbl,now);
}
@@ -602,12 +602,12 @@ static int add_history(DB_ITEM *item, AGENT_RESULT *value, int now)
else if(item->delta == ITEM_STORE_SPEED_PER_SECOND)
{
/* Save delta */
- if(value->type & AR_DOUBLE)
+ if( (item->value_type==ITEM_VALUE_TYPE_FLOAT) && (value->type & AR_DOUBLE))
if((item->prevorgvalue_null == 0) && (item->prevorgvalue <= value->dbl))
{
DBadd_history(item->itemid, (value->dbl - item->prevorgvalue)/(now-item->lastclock), now);
}
- if(value->type & AR_UINT64)
+ if((item->value_type==ITEM_VALUE_TYPE_UINT64) && (value->type & AR_UINT64))
if((item->prevorgvalue_null == 0) && (item->prevorgvalue <= value->ui64))
{
DBadd_history_uint(item->itemid, (zbx_uint64_t)(value->ui64 - item->prevorgvalue)/(now-item->lastclock), now);
@@ -617,12 +617,12 @@ static int add_history(DB_ITEM *item, AGENT_RESULT *value, int now)
else if(item->delta == ITEM_STORE_SIMPLE_CHANGE)
{
/* Save delta */
- if(value->type & AR_DOUBLE)
+ if((item->value_type==ITEM_VALUE_TYPE_FLOAT) && (value->type & AR_DOUBLE))
if((item->prevorgvalue_null == 0) && (item->prevorgvalue <= value->dbl) )
{
DBadd_history(item->itemid, (value->dbl - item->prevorgvalue), now);
}
- if(value->type & AR_UINT64)
+ if((item->value_type==ITEM_VALUE_TYPE_UINT64) && (value->type & AR_UINT64))
if((item->prevorgvalue_null == 0) && (item->prevorgvalue <= value->ui64) )
{
DBadd_history_uint(item->itemid, (value->ui64 - item->prevorgvalue), now);