summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent_win32
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-09 14:21:35 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-09 14:21:35 +0000
commited003e5f8b456b57c9b10d6f1efa04f9a47b997b (patch)
treed10174b24bec895e130caccb3e904e1b57987578 /src/zabbix_agent_win32
parent93413bcea6a5b339606d2a8690a9f5c64be528bd (diff)
downloadzabbix-ed003e5f8b456b57c9b10d6f1efa04f9a47b997b.tar.gz
zabbix-ed003e5f8b456b57c9b10d6f1efa04f9a47b997b.tar.xz
zabbix-ed003e5f8b456b57c9b10d6f1efa04f9a47b997b.zip
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@1951 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_agent_win32')
-rwxr-xr-xsrc/zabbix_agent_win32/Debug/ZabbixW32.exebin331849 -> 331849 bytes
-rwxr-xr-xsrc/zabbix_agent_win32/Release/ZabbixW32.exebin102400 -> 102400 bytes
-rwxr-xr-xsrc/zabbix_agent_win32/active.cpp20
-rwxr-xr-xsrc/zabbix_agent_win32/eventlog.cpp9
-rwxr-xr-xsrc/zabbix_agent_win32/xml_comms.cpp21
-rw-r--r--src/zabbix_agent_win32/zabbixw32.h6
6 files changed, 37 insertions, 19 deletions
diff --git a/src/zabbix_agent_win32/Debug/ZabbixW32.exe b/src/zabbix_agent_win32/Debug/ZabbixW32.exe
index d830e89f..1cf1be0b 100755
--- a/src/zabbix_agent_win32/Debug/ZabbixW32.exe
+++ b/src/zabbix_agent_win32/Debug/ZabbixW32.exe
Binary files differ
diff --git a/src/zabbix_agent_win32/Release/ZabbixW32.exe b/src/zabbix_agent_win32/Release/ZabbixW32.exe
index 56952f8e..d7c7aca1 100755
--- a/src/zabbix_agent_win32/Release/ZabbixW32.exe
+++ b/src/zabbix_agent_win32/Release/ZabbixW32.exe
Binary files differ
diff --git a/src/zabbix_agent_win32/active.cpp b/src/zabbix_agent_win32/active.cpp
index 360524bb..66c5749d 100755
--- a/src/zabbix_agent_win32/active.cpp
+++ b/src/zabbix_agent_win32/active.cpp
@@ -392,7 +392,8 @@ int get_active_checks(char *server, int port, char *error, int max_error_len)
return SUCCEED;
}
-int send_value(char *server,int port,char *host, char *key,char *value,char *lastlogsize, char *timestamp)
+int send_value(char *server,int port,char *host, char *key,char *value,char *lastlogsize,
+ char *timestamp, char *source, char *severity)
{
int i,s;
char tosend[1024];
@@ -449,7 +450,7 @@ int send_value(char *server,int port,char *host, char *key,char *value,char *las
return FAIL;
}
- comms_create_request(host,key,value,lastlogsize,timestamp,tosend,sizeof(tosend)-1);
+ comms_create_request(host,key,value,lastlogsize,timestamp,source,severity,tosend,sizeof(tosend)-1);
// sprintf(tosend,"%s:%s\n",shortname,value);
WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"s",tosend);
@@ -505,6 +506,8 @@ int process_active_checks(char *server, int port)
char value[MAX_STRING_LEN];
char lastlogsize[MAX_STRING_LEN];
char timestamp[MAX_STRING_LEN];
+ char source[MAX_STRING_LEN];
+ char severity[MAX_STRING_LEN];
int i, now, count;
int ret = SUCCEED;
@@ -525,6 +528,8 @@ int process_active_checks(char *server, int port)
if(strncmp(metrics[i].key,"log[",4) == 0)
{
timestamp[0]=0;
+ source[0]=0;
+ severity[0]=0;
strscpy(c,metrics[i].key);
filename=strtok(c,"[]");
filename=strtok(NULL,"[]");
@@ -537,7 +542,7 @@ int process_active_checks(char *server, int port)
// WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"s",shortname);
sprintf(lastlogsize,"%d",metrics[i].lastlogsize);
- if(send_value(server,port,confHostname,metrics[i].key, value, lastlogsize,timestamp) == FAIL)
+ if(send_value(server,port,confHostname,metrics[i].key, value, lastlogsize,timestamp,source,severity) == FAIL)
{
ret = FAIL;
break;
@@ -561,7 +566,7 @@ int process_active_checks(char *server, int port)
filename=strtok(NULL,"[]");
count=0;
- while(process_eventlog_new(filename,&metrics[i].lastlogsize, timestamp, value) == 0)
+ while(process_eventlog_new(filename,&metrics[i].lastlogsize, timestamp, source, severity, value) == 0)
{
// sprintf(shortname, "%s:%s",confHostname,metrics[i].key);
// zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
@@ -570,7 +575,7 @@ int process_active_checks(char *server, int port)
// WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"s",value);
sprintf(lastlogsize,"%d",metrics[i].lastlogsize);
- if(send_value(server,port,confHostname,metrics[i].key,value,lastlogsize,timestamp) == FAIL)
+ if(send_value(server,port,confHostname,metrics[i].key,value,lastlogsize,timestamp,source,severity) == FAIL)
{
ret = FAIL;
break;
@@ -591,6 +596,9 @@ int process_active_checks(char *server, int port)
{
timestamp[0]=0;
lastlogsize[0]=0;
+ source[0]=0;
+ severity[0]=0;
+
strcpy(rq.cmd,metrics[i].key);
@@ -607,7 +615,7 @@ int process_active_checks(char *server, int port)
//sprintf(shortname,"%s:%s",confHostname,metrics[i].key);
// zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
- if(send_value(server,port,confHostname,metrics[i].key,rq.result,lastlogsize, timestamp) == FAIL)
+ if(send_value(server,port,confHostname,metrics[i].key,rq.result,lastlogsize,timestamp,source,severity) == FAIL)
{
ret = FAIL;
break;
diff --git a/src/zabbix_agent_win32/eventlog.cpp b/src/zabbix_agent_win32/eventlog.cpp
index 0828f70e..f575d0a6 100755
--- a/src/zabbix_agent_win32/eventlog.cpp
+++ b/src/zabbix_agent_win32/eventlog.cpp
@@ -12,7 +12,7 @@ DllExport long MyGetAEventLog(char *pAppName,HANDLE hAppLog,long
which,double *pTime,char *pSource,char *pMessage,long *pType,long
*pCategory, int *timestamp);
-int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *value)
+int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *src, char *severity, char *message)
{
HANDLE hAppLog;
@@ -20,7 +20,7 @@ int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *v
long i;
double time;
int t;
- char src[1024],msg[1024];
+ char msg[1024];
long type,category;
// open up event log
@@ -42,9 +42,10 @@ int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *v
// MyGetAEventLog("Application",hAppLog,Latest,&time,src,msg,&type,&category);
MyGetAEventLog(source,hAppLog,Latest,&time,src,msg,&type,&category,&t);
sprintf(timestamp,"%d",t);
- sprintf(value,"Src = %s, Msg = %s, type = %d, Category = %d\n",src,msg,type,category);
+ sprintf(severity,"%ld",type);
+ sprintf(message,"Src = %s, Msg = %s, type = %d, Category = %d\n",src,msg,type,category);
WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"d",Latest);
- WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"s",value);
+ WriteLog(MSG_ACTIVE_CHECKS,EVENTLOG_ERROR_TYPE,"s",message);
*lastlogsize = Latest;
MyCloseEventLog(hAppLog);
return 0;
diff --git a/src/zabbix_agent_win32/xml_comms.cpp b/src/zabbix_agent_win32/xml_comms.cpp
index 2e7c71a4..3ec10305 100755
--- a/src/zabbix_agent_win32/xml_comms.cpp
+++ b/src/zabbix_agent_win32/xml_comms.cpp
@@ -1,6 +1,7 @@
#include "zabbixw32.h"
-int comms_create_request(char *host, char *key, char *data, char *lastlogsize, char *timestamp, char *request,int maxlen)
+int comms_create_request(char *host, char *key, char *data, char *lastlogsize,
+ char *timestamp, char *source, char *severity, char *request,int maxlen)
{
int ret = SUCCEED;
char host_b64[MAX_STRING_LEN];
@@ -8,18 +9,24 @@ int comms_create_request(char *host, char *key, char *data, char *lastlogsize, c
char data_b64[MAX_STRING_LEN];
char lastlogsize_b64[MAX_STRING_LEN];
char timestamp_b64[MAX_STRING_LEN];
+ char source_b64[MAX_STRING_LEN];
+ char severity_b64[MAX_STRING_LEN];
memset(host_b64,0,sizeof(host_b64));
memset(key_b64,0,sizeof(key_b64));
memset(data_b64,0,sizeof(data_b64));
memset(lastlogsize_b64,0,sizeof(lastlogsize_b64));
memset(timestamp_b64,0,sizeof(timestamp_b64));
+ memset(source_b64,0,sizeof(source_b64));
+ memset(severity_b64,0,sizeof(severity_b64));
str_base64_encode(host, host_b64, strlen(host));
str_base64_encode(key, key_b64, strlen(key));
str_base64_encode(data, data_b64, strlen(data));
str_base64_encode(lastlogsize, lastlogsize_b64, strlen(lastlogsize));
str_base64_encode(timestamp, timestamp_b64, strlen(timestamp));
+ str_base64_encode(source, source_b64, strlen(source));
+ str_base64_encode(severity, severity_b64, strlen(severity));
if(lastlogsize[0]==0)
{
@@ -32,13 +39,13 @@ int comms_create_request(char *host, char *key, char *data, char *lastlogsize, c
{
sprintf(request,"<req><host>%s</host><key>%s</key><data>%s</data><lastlogsize>%s</lastlogsize></req>",
host_b64,key_b64,data_b64,lastlogsize_b64);
- }
- else
- {
- sprintf(request,"<req><host>%s</host><key>%s</key><data>%s</data><lastlogsize>%s</lastlogsize><timestamp>%s</timestamp></req>",
- host_b64,key_b64,data_b64,lastlogsize_b64,timestamp_b64);
- }
}
+ else
+ {
+ sprintf(request,"<req><host>%s</host><key>%s</key><data>%s</data><lastlogsize>%s</lastlogsize><timestamp>%s</timestamp><source>%s</source><severity>%s</severity></req>",
+ host_b64,key_b64,data_b64,lastlogsize_b64,timestamp_b64,source_b64,severity_b64);
+ }
+ }
return ret;
}
diff --git a/src/zabbix_agent_win32/zabbixw32.h b/src/zabbix_agent_win32/zabbixw32.h
index 465896b5..a101f460 100644
--- a/src/zabbix_agent_win32/zabbixw32.h
+++ b/src/zabbix_agent_win32/zabbixw32.h
@@ -213,12 +213,14 @@ void ExpandAlias(char *orig,char *expanded);
unsigned int __stdcall ProcessingThread(void *arg);
int process_log(char *filename,int *lastlogsize, char *value);
//int process_eventlog(char *source,int *lastlogsize, char *value);
-int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *value);
+int process_eventlog_new(char *source,int *lastlogsize, char *timestamp, char *src, char *severity, char *message);
void str_base64_encode(char *p_str, char *p_b64str, int in_size);
void str_base64_decode(char *p_b64str, char *p_str, int *p_out_size);
-int comms_create_request(char *host, char *key, char *data, char *lastlogsize, char *timestamp, char *request,int maxlen);
+int comms_create_request(char *host, char *key, char *data, char *lastlogsize,
+ char *timestamp, char *source, char *severity, char *request,int maxlen);
+
int xml_get_data(char *xml,char *tag, char *data, int maxlen);