summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-14 19:16:56 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-14 19:16:56 +0000
commitb4ebcb38fdaac5c102fd0a9eef8f4be7e2e4e693 (patch)
tree4959e54ad3c998496731e8236c5401a601f634c1 /src
parent8b3a821222ec9fb5437828f598063a29b8706a36 (diff)
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2315 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxdbhigh/db.c18
-rw-r--r--src/zabbix_server/functions.c11
-rw-r--r--src/zabbix_server/poller/checks_agent.c1
-rw-r--r--src/zabbix_server/poller/checks_internal.c4
-rw-r--r--src/zabbix_server/poller/poller.c23
5 files changed, 39 insertions, 18 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 243d4d35..1c9bb702 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -867,7 +867,14 @@ void DBupdate_host_availability(int hostid,int available,int clock, char *error)
zabbix_log(LOG_LEVEL_DEBUG,"In update_host_availability()");
- DBescape_string(error,error_esc,MAX_STRING_LEN);
+ if(error!=NULL)
+ {
+ DBescape_string(error,error_esc,MAX_STRING_LEN);
+ }
+ else
+ {
+ strscpy(error_esc,"");
+ }
snprintf(sql,sizeof(sql)-1,"select available,disable_until from hosts where hostid=%d",hostid);
zabbix_log(LOG_LEVEL_DEBUG,"SQL [%s]",sql);
@@ -938,7 +945,14 @@ int DBupdate_item_status_to_notsupported(int itemid, char *error)
zabbix_log(LOG_LEVEL_DEBUG,"In DBupdate_item_status_to_notsupported()");
- DBescape_string(error,error_esc,MAX_STRING_LEN);
+ if(error!=NULL)
+ {
+ DBescape_string(error,error_esc,MAX_STRING_LEN);
+ }
+ else
+ {
+ strscpy(error_esc,"");
+ }
snprintf(sql,sizeof(sql)-1,"update items set status=%d,error='%s' where itemid=%d",ITEM_STATUS_NOTSUPPORTED,error_esc,itemid);
zabbix_log(LOG_LEVEL_DEBUG,"SQL [%s]",sql);
diff --git a/src/zabbix_server/functions.c b/src/zabbix_server/functions.c
index 0fd65829..f2a44298 100644
--- a/src/zabbix_server/functions.c
+++ b/src/zabbix_server/functions.c
@@ -577,17 +577,18 @@ void process_new_value(DB_ITEM *item,char *value)
time_t now;
char sql[MAX_STRING_LEN];
char value_esc[MAX_STRING_LEN];
- char value_str[MAX_STRING_LEN];
- double value_double;
+/* char value_str[MAX_STRING_LEN];
+ double value_double;*/
double multiplier;
char *e;
+ zabbix_log( LOG_LEVEL_DEBUG, "In process_new_value()");
+
now = time(NULL);
- strscpy(value_str, value);
+/* strscpy(value_str, value);*/
- zabbix_log( LOG_LEVEL_DEBUG, "In process_new_value()");
- value_double=strtod(value_str,&e);
+/* value_double=strtod(value_str,&e);*/
if( (item->value_type==ITEM_VALUE_TYPE_FLOAT) && (item->multiplier == ITEM_MULTIPLIER_USE))
{
diff --git a/src/zabbix_server/poller/checks_agent.c b/src/zabbix_server/poller/checks_agent.c
index 35f1499f..c3624b69 100644
--- a/src/zabbix_server/poller/checks_agent.c
+++ b/src/zabbix_server/poller/checks_agent.c
@@ -45,7 +45,6 @@ int get_value_agent(DB_ITEM *item, AGENT_RESULT *result)
int len;
char c[MAX_STRING_LEN];
char error[MAX_STRING_LEN];
- char *e;
struct hostent *hp;
diff --git a/src/zabbix_server/poller/checks_internal.c b/src/zabbix_server/poller/checks_internal.c
index df193b50..50a77b28 100644
--- a/src/zabbix_server/poller/checks_internal.c
+++ b/src/zabbix_server/poller/checks_internal.c
@@ -53,8 +53,8 @@ int get_value_internal(DB_ITEM *item, AGENT_RESULT *result)
else if(strcmp(item->key,"zabbix[items]")==0)
{
i = (zbx_uint64_t)DBget_items_count();
- result->type != AR_UINT64;
- result->ui64 != i;
+ result->type |= AR_UINT64;
+ result->ui64 |= i;
}
else if(strcmp(item->key,"zabbix[items_unsupported]")==0)
{
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index 3e5372eb..44663353 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -139,7 +139,8 @@ static int get_minnextcheck(int now)
static void update_key_status(int hostid,int host_status)
{
char sql[MAX_STRING_LEN];
- char value_str[MAX_STRING_LEN];
+/* char value_str[MAX_STRING_LEN];*/
+ AGENT_RESULT agent;
DB_ITEM item;
DB_RESULT *result;
@@ -157,9 +158,15 @@ static void update_key_status(int hostid,int host_status)
{
DBget_item_from_db(&item,result,0);
- snprintf(value_str,sizeof(value_str)-1,"%d",host_status);
+/* snprintf(value_str,sizeof(value_str)-1,"%d",host_status);*/
+
+ init_result(&agent);
+ agent.type |= AR_UINT64;
+ agent.ui64=(zbx_uint64_t)host_status;
+ process_new_value(&item,&agent);
+/* process_new_value(&item,value_str);*/
+ free_result(&agent);
- process_new_value(&item,value_str);
update_triggers(item.itemid);
}
@@ -223,7 +230,7 @@ int get_values(void)
item.host_available=HOST_AVAILABLE_TRUE;
zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]", item.host );
zabbix_syslog("Enabling host [%s]", item.host );
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,error);
+ DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg);
update_key_status(item.hostid,HOST_STATUS_MONITORED);
/* Why this break??? Trigger needs to be updated anyway!
@@ -235,14 +242,14 @@ int get_values(void)
{
zabbix_log( LOG_LEVEL_WARNING, "Parameter [%s] is not supported by agent on host [%s]", item.key, item.host );
zabbix_syslog("Parameter [%s] is not supported by agent on host [%s]", item.key, item.host );
- DBupdate_item_status_to_notsupported(item.itemid, error);
+ DBupdate_item_status_to_notsupported(item.itemid, agent.str);
/* if(HOST_STATUS_UNREACHABLE == item.host_status)*/
if(HOST_AVAILABLE_TRUE != item.host_available)
{
item.host_available=HOST_AVAILABLE_TRUE;
zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]", item.host );
zabbix_syslog("Enabling host [%s]", item.host );
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,error);
+ DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg);
update_key_status(item.hostid,HOST_STATUS_MONITORED);
stop=1;
@@ -255,7 +262,7 @@ int get_values(void)
{
zabbix_log( LOG_LEVEL_WARNING, "Host [%s] will be checked after [%d] seconds", item.host, DELAY_ON_NETWORK_FAILURE );
zabbix_syslog("Host [%s] will be checked after [%d] seconds", item.host, DELAY_ON_NETWORK_FAILURE );
- DBupdate_host_availability(item.hostid,HOST_AVAILABLE_FALSE,now,error);
+ DBupdate_host_availability(item.hostid,HOST_AVAILABLE_FALSE,now,agent.msg);
update_key_status(item.hostid,HOST_AVAILABLE_FALSE);
snprintf(sql,sizeof(sql)-1,"update hosts set network_errors=3 where hostid=%d", item.hostid);
@@ -284,7 +291,7 @@ int get_values(void)
zabbix_syslog("Getting value of [%s] from host [%s] failed", item.key, item.host );
zabbix_log( LOG_LEVEL_WARNING, "The value is not stored in database.");
}
- free(result(&agent));
+ free_result(&agent);
}
DBfree_result(result);