diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-08-06 08:47:24 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-08-06 08:47:24 +0000 |
| commit | 150ed6cf4a06893d5ab64eb31c7efc06c4e05744 (patch) | |
| tree | a32e8553a9ae7bd94e8751908cbd6492c69eec43 /include | |
| parent | cbbc6165657ee31b43b8e1090cce51140ec7f345 (diff) | |
- changed definition of functions.lastvalue to allow NULL (Alexei)
- added upgrades/dbpatches/1.0beta5_to_1.0beta6/ with patches (Alexei)
- added misc/init.d/debian/zabbix_agent (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@449 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
| -rw-r--r-- | include/db.c | 12 | ||||
| -rw-r--r-- | include/expression.c | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/db.c b/include/db.c index 11de117b..90e6451b 100644 --- a/include/db.c +++ b/include/db.c @@ -235,17 +235,23 @@ int DBget_function_result(float *result,char *functionid) char sql[MAX_STRING_LEN+1]; - sprintf( sql, "select lastvalue from functions where functionid=%s", functionid ); +/* 0 is added to distinguish between lastvalue==NULL and empty result */ + sprintf( sql, "select 0,lastvalue from functions where functionid=%s", functionid ); dbresult = DBselect(sql); if(DBnum_rows(dbresult) == 0) { - zabbix_log(LOG_LEVEL_WARNING, "Query failed for functionid:[%s]", functionid ); + zabbix_log(LOG_LEVEL_WARNING, "No function for functionid:[%s]", functionid ); + res = FAIL; + } + else if(DBget_field(dbresult,0,1) == NULL) + { + zabbix_log(LOG_LEVEL_DEBUG, "function.lastvalue==NULL [%s]", functionid ); res = FAIL; } else { - *result=atof(DBget_field(dbresult,0,0)); + *result=atof(DBget_field(dbresult,0,1)); } DBfree_result(dbresult); diff --git a/include/expression.c b/include/expression.c index 89b912d4..9e1314de 100644 --- a/include/expression.c +++ b/include/expression.c @@ -628,7 +628,8 @@ int substitute_functions(char *exp) if( DBget_function_result( &value, functionid ) != SUCCEED ) { - zabbix_log( LOG_LEVEL_WARNING, "Unable to get value by functionid [%s]", functionid ); +/* It may happen because of functions.lastvalue is NULL, so this is not warning */ + zabbix_log( LOG_LEVEL_DEBUG, "Unable to get value for functionid [%s]", functionid ); return FAIL; } |
