diff options
| author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-24 10:39:43 +0000 |
|---|---|---|
| committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-24 10:39:43 +0000 |
| commit | f41d50841de55c6e2a14d9c4df9bcc3d6830d887 (patch) | |
| tree | 39fd069054f81339faea67a25f5de33c54a9f801 /src | |
| parent | 196f05691a8b11aca754a36ce64421c34148f733 (diff) | |
- [DEV-48] Support of Ping and Traceroute in Status of Triggers screen
git-svn-id: svn://svn.zabbix.com/trunk@4908 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
| -rw-r--r-- | src/zabbix_server/trapper/nodecommand.c | 33 | ||||
| -rw-r--r-- | src/zabbix_server/trapper/nodeevents.c | 3 | ||||
| -rw-r--r-- | src/zabbix_server/trapper/nodesync.c | 2 |
3 files changed, 11 insertions, 27 deletions
diff --git a/src/zabbix_server/trapper/nodecommand.c b/src/zabbix_server/trapper/nodecommand.c index 002888c3..deb9b98d 100644 --- a/src/zabbix_server/trapper/nodecommand.c +++ b/src/zabbix_server/trapper/nodecommand.c @@ -61,7 +61,6 @@ int node_process_command(const char *data, char **result) char *tmp = NULL; int tmp_allocated = 64, result_allocated = 4*1024; int datalen; - zbx_uint64_t scriptid, hostid; int nodeid, result_offset = 0; zbx_sock_t sock; @@ -79,33 +78,17 @@ int node_process_command(const char *data, char **result) zabbix_log( LOG_LEVEL_DEBUG, "In node_process_command(datalen:%d)", data, datalen); r = data; - r = zbx_get_next_field(r, &tmp, &tmp_allocated, ZBX_DM_DELIMITER); /* Command */ + r = zbx_get_next_field(r, &tmp, &tmp_allocated, ZBX_DM_DELIMITER); /* Constant 'Command' */ + r = zbx_get_next_field(r, &tmp, &tmp_allocated, ZBX_DM_DELIMITER); /* NodeID */ + nodeid = atoi(tmp); r = zbx_get_next_field(r, &tmp, &tmp_allocated, ZBX_DM_DELIMITER); - sscanf(tmp,ZBX_FS_UI64,&scriptid); - r = zbx_get_next_field(r, &tmp, &tmp_allocated, ZBX_DM_DELIMITER); - sscanf(tmp,ZBX_FS_UI64,&hostid); + strscpy(command, tmp); - zabbix_log( LOG_LEVEL_WARNING, "NODE %d: Received command for host "ZBX_FS_UI64, + zabbix_log( LOG_LEVEL_WARNING, "NODE %d: Received command for nodeid "ZBX_FS_UI64, CONFIG_NODEID, - hostid); + nodeid); - nodeid = get_nodeid_by_id(hostid); if (nodeid == CONFIG_NODEID) { - dbresult = DBselect("select command from scripts where scriptid="ZBX_FS_UI64, - scriptid); - - if (NULL == (dbrow = DBfetch(dbresult))) { - DBfree_result(dbresult); - zbx_snprintf(*result, result_allocated, "1%cNODE %d: Script ["ZBX_FS_UI64"] is unknown", - ZBX_DM_DELIMITER, - CONFIG_NODEID, - scriptid); - goto exit; - } - - zbx_strlcpy(command, dbrow[0], sizeof(command)); - DBfree_result(dbresult); - if(0 == (f = popen(command, "r"))) { zbx_snprintf(*result, result_allocated, "1%cNODE %d: Cannot execute [%s] error:%s", ZBX_DM_DELIMITER, @@ -125,10 +108,10 @@ int node_process_command(const char *data, char **result) pclose(f); } else { - zabbix_log( LOG_LEVEL_WARNING, "NODE %d: Sending command for host "ZBX_FS_UI64 + zabbix_log( LOG_LEVEL_WARNING, "NODE %d: Sending command for nodeid "ZBX_FS_UI64 " to node %d", CONFIG_NODEID, - hostid, + nodeid, nodeid); dbresult = DBselect("select ip, port from nodes where nodeid=%d", diff --git a/src/zabbix_server/trapper/nodeevents.c b/src/zabbix_server/trapper/nodeevents.c index 07897ae7..10200ebf 100644 --- a/src/zabbix_server/trapper/nodeevents.c +++ b/src/zabbix_server/trapper/nodeevents.c @@ -74,12 +74,13 @@ static int process_record(int nodeid, char *record) zbx_get_field(record,tmp,0,ZBX_DM_DELIMITER); sscanf(tmp,ZBX_FS_UI64,&event.eventid); + ZBX_STR2UINT64(event.eventid, tmp); zbx_get_field(record,tmp,1,ZBX_DM_DELIMITER); event.source=atoi(tmp); zbx_get_field(record,tmp,2,ZBX_DM_DELIMITER); event.object=atoi(tmp); zbx_get_field(record,tmp,3,ZBX_DM_DELIMITER); - sscanf(tmp,ZBX_FS_UI64,&event.objectid); + ZBX_STR2UINT64(event.objectid, tmp); zbx_get_field(record,tmp,4,ZBX_DM_DELIMITER); event.clock=atoi(tmp); zbx_get_field(record,tmp,5,ZBX_DM_DELIMITER); diff --git a/src/zabbix_server/trapper/nodesync.c b/src/zabbix_server/trapper/nodesync.c index 82b3f3b1..e34ceb96 100644 --- a/src/zabbix_server/trapper/nodesync.c +++ b/src/zabbix_server/trapper/nodesync.c @@ -93,7 +93,7 @@ static int process_record(int nodeid, char *record, int sender_nodetype) strcpy(tablename, buffer); r = zbx_get_next_field(r, &buffer, &buffer_allocated, ZBX_DM_DELIMITER); - sscanf(buffer, ZBX_FS_UI64,&recid); + ZBX_STR2UINT64(recid, buffer); r = zbx_get_next_field(r, &buffer, &buffer_allocated, ZBX_DM_DELIMITER); op = atoi(buffer); |
