diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-12-22 16:19:37 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-12-22 16:19:37 +0000 |
commit | 6b0187666de3cd7ed8d66548312ceeefdd3eb0b5 (patch) | |
tree | ddfe25b069a6eeadaeef8889b62e3faa82d31b0e /include | |
parent | af2b9c7db4646361d0b759d6f7252fc353d67ef9 (diff) | |
download | zabbix-6b0187666de3cd7ed8d66548312ceeefdd3eb0b5.tar.gz zabbix-6b0187666de3cd7ed8d66548312ceeefdd3eb0b5.tar.xz zabbix-6b0187666de3cd7ed8d66548312ceeefdd3eb0b5.zip |
More calls of zabbix_syslog().
git-svn-id: svn://svn.zabbix.com/trunk@1554 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
-rw-r--r-- | include/expression.c | 41 | ||||
-rw-r--r-- | include/functions.c | 27 |
2 files changed, 57 insertions, 11 deletions
diff --git a/include/expression.c b/include/expression.c index 137e7112..076bf022 100644 --- a/include/expression.c +++ b/include/expression.c @@ -27,6 +27,7 @@ #include "common.h" #include "db.h" #include "log.h" +#include "zlog.h" /* * Delete all right spaces from given string @@ -234,6 +235,7 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( value1 == 1) @@ -244,6 +246,7 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( value2 == 1) @@ -272,11 +275,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( (value1 == 1) && (value2 == 1) ) @@ -306,11 +311,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( value1 > value2 ) @@ -341,11 +348,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( value1 < value2 ) @@ -376,11 +385,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } *result=value1*value2; @@ -403,16 +414,19 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if(cmp_double(value2,0) == 0) { zabbix_log(LOG_LEVEL_WARNING, "Division by zero. Cannot evaluate expression [%s/%s]", first,second ); + zabbix_syslog("Division by zero. Cannot evaluate expression [%s/%s]", first,second ); return FAIL; } else @@ -438,11 +452,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } *result=value1+value2; @@ -465,11 +481,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } *result=value1-value2; @@ -492,11 +510,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( cmp_double(value1,value2) ==0 ) @@ -526,11 +546,13 @@ int evaluate_simple (double *result,char *exp) if( evaluate_simple(&value1,first) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", first ); + zabbix_syslog("Cannot evaluate expression [%s]", first ); return FAIL; } if( evaluate_simple(&value2,second) == FAIL ) { zabbix_log(LOG_LEVEL_DEBUG, "Cannot evaluate expression [%s]", second ); + zabbix_syslog("Cannot evaluate expression [%s]", second ); return FAIL; } if( cmp_double(value1,value2) != 0 ) @@ -580,6 +602,7 @@ int evaluate(int *result,char *exp) if( r == -1 ) { zabbix_log(LOG_LEVEL_WARNING, "Cannot find left bracket [(]. Expression:[%s]", exp ); + zabbix_syslog("Cannot find left bracket [(]. Expression:[%s]", exp ); return FAIL; } for(i=l+1;i<r;i++) @@ -592,6 +615,7 @@ int evaluate(int *result,char *exp) { /* Changed to LOG_LEVEL_DEBUG */ zabbix_log( LOG_LEVEL_DEBUG, "Unable to evaluate simple expression1 [%s]", simple ); + zabbix_syslog("Unable to evaluate simple expression1 [%s]", simple ); return FAIL; } @@ -614,6 +638,7 @@ int evaluate(int *result,char *exp) if( evaluate_simple( &value, res ) != SUCCEED ) { zabbix_log(LOG_LEVEL_WARNING, "Unable to evaluate simple expression2 [%s]", simple ); + zabbix_syslog("Unable to evaluate simple expression2 [%s]", simple ); return FAIL; } zabbix_log( LOG_LEVEL_DEBUG, "Evaluate end:[%lf]", value ); @@ -653,6 +678,7 @@ void substitute_simple_macros_thread(MYSQL *database, DB_TRIGGER *trigger, DB_AC if(DBnum_rows(result) == 0) { zabbix_log( LOG_LEVEL_ERR, "No hostname in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); + zabbix_syslog("No hostname in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); strscpy(tmp, "*UNKNOWN*"); DBfree_result(result); } @@ -678,6 +704,7 @@ void substitute_simple_macros_thread(MYSQL *database, DB_TRIGGER *trigger, DB_AC if(DBnum_rows(result) == 0) { zabbix_log( LOG_LEVEL_ERR, "No IP address in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); + zabbix_syslog("No IP address in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); strscpy(tmp, "*UNKNOWN IP*"); DBfree_result(result); } @@ -781,6 +808,7 @@ void substitute_simple_macros(DB_TRIGGER *trigger, DB_ACTION *action, char *exp) if(DBnum_rows(result) == 0) { zabbix_log( LOG_LEVEL_ERR, "No hostname in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); + zabbix_syslog("No hostname in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); strscpy(tmp, "*UNKNOWN*"); DBfree_result(result); } @@ -806,6 +834,7 @@ void substitute_simple_macros(DB_TRIGGER *trigger, DB_ACTION *action, char *exp) if(DBnum_rows(result) == 0) { zabbix_log( LOG_LEVEL_ERR, "No IP address in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); + zabbix_syslog("No IP address in substitute_simple_macros. Triggerid [%d]", trigger->triggerid); strscpy(tmp, "*UNKNOWN IP*"); DBfree_result(result); } @@ -909,12 +938,14 @@ int substitute_macros_thread(MYSQL *database, DB_TRIGGER *trigger, DB_ACTION *ac if( r == FAIL ) { zabbix_log( LOG_LEVEL_WARNING, "Cannot find right bracket. Expression:[%s]", exp ); + zabbix_syslog("Cannot find right bracket. Expression:[%s]", exp ); return FAIL; } if( r < l ) { zabbix_log( LOG_LEVEL_WARNING, "Right bracket is before left one. Expression:[%s]", exp ); + zabbix_syslog("Right bracket is before left one. Expression:[%s]", exp ); return FAIL; } @@ -1035,12 +1066,14 @@ int substitute_macros(DB_TRIGGER *trigger, DB_ACTION *action, char *exp) if( r == FAIL ) { zabbix_log( LOG_LEVEL_WARNING, "Cannot find right bracket. Expression:[%s]", exp ); + zabbix_syslog("Cannot find right bracket. Expression:[%s]", exp ); return FAIL; } if( r < l ) { zabbix_log( LOG_LEVEL_WARNING, "Right bracket is before left one. Expression:[%s]", exp ); + zabbix_syslog("Right bracket is before left one. Expression:[%s]", exp ); return FAIL; } @@ -1149,11 +1182,13 @@ int substitute_functions_thread(MYSQL *database, char *exp) if( r == FAIL ) { zabbix_log( LOG_LEVEL_WARNING, "Cannot find right bracket. Expression:[%s]", exp ); + zabbix_syslog("Cannot find right bracket. Expression:[%s]", exp ); return FAIL; } if( r < l ) { zabbix_log( LOG_LEVEL_WARNING, "Right bracket is before left one. Expression:[%s]", exp ); + zabbix_syslog("Right bracket is before left one. Expression:[%s]", exp ); return FAIL; } @@ -1167,6 +1202,7 @@ int substitute_functions_thread(MYSQL *database, char *exp) { /* 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 ); + zabbix_syslog("Unable to get value for functionid [%s]", functionid ); return FAIL; } @@ -1216,11 +1252,13 @@ int substitute_functions(char *exp) if( r == FAIL ) { zabbix_log( LOG_LEVEL_WARNING, "Cannot find right bracket. Expression:[%s]", exp ); + zabbix_syslog("Cannot find right bracket. Expression:[%s]", exp ); return FAIL; } if( r < l ) { zabbix_log( LOG_LEVEL_WARNING, "Right bracket is before left one. Expression:[%s]", exp ); + zabbix_syslog("Right bracket is before left one. Expression:[%s]", exp ); return FAIL; } @@ -1234,6 +1272,7 @@ int substitute_functions(char *exp) { /* 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 ); + zabbix_syslog("Unable to get value for functionid [%s]", functionid ); return FAIL; } @@ -1281,6 +1320,7 @@ int evaluate_expression_thread(MYSQL *database, int *result,char *expression) } } zabbix_log(LOG_LEVEL_WARNING, "Evaluation of expression [%s] failed", expression ); + zabbix_syslog("Evaluation of expression [%s] failed", expression ); return FAIL; } #endif @@ -1301,6 +1341,7 @@ int evaluate_expression(int *result,char *expression) } } zabbix_log(LOG_LEVEL_WARNING, "Evaluation of expression [%s] failed", expression ); + zabbix_syslog("Evaluation of expression [%s] failed", expression ); return FAIL; } diff --git a/include/functions.c b/include/functions.c index 11311b99..8305c8c4 100644 --- a/include/functions.c +++ b/include/functions.c @@ -41,6 +41,7 @@ #include "common.h" #include "db.h" #include "log.h" +#include "zlog.h" #include "security.h" #include "functions.h" @@ -739,6 +740,7 @@ int evaluate_FUNCTION_thread(MYSQL *database, char *value,DB_ITEM *item,char *fu else { zabbix_log( LOG_LEVEL_WARNING, "Unsupported function:%s",function); + zabbix_syslog("Unsupported function:%s",function); ret = FAIL; } @@ -784,11 +786,6 @@ int evaluate_FUNCTION_thread(MYSQL *database, char *value,DB_ITEM *item,char *fu snprintf(value, MAX_STRING_LEN-1, "%.2f %s%s", value_float, suffix, item->units); } } - else - { - if( (EVALUATE_FUNCTION_SUFFIX == flag)) - zabbix_log( LOG_LEVEL_WARNING, "Hmm [%d] [%d] [%d] [%s]", flag, item->value_type, ret, item->units); - } zabbix_log( LOG_LEVEL_DEBUG, "End of evaluate_FUNCTION. Result [%s]",value); return ret; @@ -1004,6 +1001,7 @@ int evaluate_FUNCTION(char *value,DB_ITEM *item,char *function,char *parameter, else { zabbix_log( LOG_LEVEL_WARNING, "Unsupported function:%s",function); + zabbix_syslog("Unsupported function:%s",function); ret = FAIL; } @@ -1057,11 +1055,6 @@ int evaluate_FUNCTION(char *value,DB_ITEM *item,char *function,char *parameter, snprintf(value, MAX_STRING_LEN-1, "%.2f %s%s", value_float, suffix, item->units); } } - else - { - if( (EVALUATE_FUNCTION_SUFFIX == flag)) - zabbix_log( LOG_LEVEL_WARNING, "Hmm [%d] [%d] [%d] [%s]", flag, item->value_type, ret, item->units); - } zabbix_log( LOG_LEVEL_DEBUG, "End of evaluate_FUNCTION. Result [%s]",value); return ret; @@ -1251,6 +1244,7 @@ void send_to_user_thread(MYSQL *database, DB_TRIGGER *trigger,DB_ACTION *action) else { zabbix_log( LOG_LEVEL_WARNING, "Unknown recipient type [%d] for actionid [%d]",action->recipient,action->actionid); + zabbix_syslog("Unknown recipient type [%d] for actionid [%d]",action->recipient,action->actionid); } } #endif @@ -1282,6 +1276,7 @@ void send_to_user(DB_TRIGGER *trigger,DB_ACTION *action) else { zabbix_log( LOG_LEVEL_WARNING, "Unknown recipient type [%d] for actionid [%d]",action->recipient,action->actionid); + zabbix_syslog("Unknown recipient type [%d] for actionid [%d]",action->recipient,action->actionid); } } @@ -1453,6 +1448,7 @@ void apply_actions_thread(MYSQL *database, DB_TRIGGER *trigger,int trigger_value else { zabbix_log( LOG_LEVEL_WARNING, "Unsupported scope [%d] for actionid [%d]", action.scope, action.actionid); + zabbix_syslog("Unsupported scope [%d] for actionid [%d]", action.scope, action.actionid); } } @@ -1628,6 +1624,7 @@ void apply_actions(DB_TRIGGER *trigger,int trigger_value) else { zabbix_log( LOG_LEVEL_WARNING, "Unsupported scope [%d] for actionid [%d]", action.scope, action.actionid); + zabbix_syslog("Unsupported scope [%d] for actionid [%d]", action.scope, action.actionid); } } @@ -1700,6 +1697,7 @@ void update_serv_thread(MYSQL *database,int serviceid) else { zabbix_log( LOG_LEVEL_ERR, "Unknown calculation algorithm of service status [%d]", algorithm); + zabbix_syslog("Unknown calculation algorithm of service status [%d]", algorithm); } } DBfree_result(result); @@ -1779,6 +1777,7 @@ void update_serv(int serviceid) else { zabbix_log( LOG_LEVEL_ERR, "Unknown calculation algorithm of service status [%d]", algorithm); + zabbix_syslog("Unknown calculation algorithm of service status [%d]", algorithm); } } DBfree_result(result); @@ -1879,6 +1878,7 @@ void update_triggers_thread(MYSQL *database, int itemid) if( evaluate_expression_thread(database, &b, exp) != 0 ) { zabbix_log( LOG_LEVEL_WARNING, "Expression [%s] cannot be evaluated.",trigger.expression); + zabbix_syslog("Expression [%s] cannot be evaluated.",trigger.expression); continue; } @@ -1982,6 +1982,7 @@ void update_triggers(int itemid) if( evaluate_expression(&b, exp) != 0 ) { zabbix_log( LOG_LEVEL_WARNING, "Expression [%s] cannot be evaluated.",trigger.expression); + zabbix_syslog("Expression [%s] cannot be evaluated.",trigger.expression); continue; } @@ -2069,6 +2070,7 @@ int get_lastvalue_thread(MYSQL *database, char *value,char *host,char *key,char { DBfree_result(result); zabbix_log(LOG_LEVEL_WARNING, "Query [%s] returned empty result", sql ); + zabbix_syslog("Query [%s] returned empty result", sql ); return FAIL; } @@ -2133,7 +2135,8 @@ int get_lastvalue(char *value,char *host,char *key,char *function,char *paramete { DBfree_result(result); zabbix_log(LOG_LEVEL_WARNING, "Query [%s] returned empty result", sql ); - return FAIL; + zabbix_syslog("Query [%s] returned empty result", sql ); + return FAIL; } item.itemid=atoi(DBget_field(result,0,0)); @@ -2308,6 +2311,7 @@ void process_new_value_thread(MYSQL *database, DB_ITEM *item,char *value) else { zabbix_log(LOG_LEVEL_ERR, "Value not stored for itemid [%d]. Unknown delta [%d]", item->itemid, item->delta); + zabbix_syslog("Value not stored for itemid [%d]. Unknown delta [%d]", item->itemid, item->delta); return; } } @@ -2443,6 +2447,7 @@ void process_new_value(DB_ITEM *item,char *value) else { zabbix_log(LOG_LEVEL_ERR, "Value not stored for itemid [%d]. Unknown delta [%d]", item->itemid, item->delta); + zabbix_syslog("Value not stored for itemid [%d]. Unknown delta [%d]", item->itemid, item->delta); return; } } |