summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-08 08:42:47 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-08 08:42:47 +0000
commitb1fc6cae9109aa8079bd54af6c9fa3afc3413483 (patch)
tree45525156d6ebb0593380d66ef1b0ef35111e7071 /src
parent7916f6dcd47e0398cdf32c74e33667a3e6595191 (diff)
downloadzabbix-b1fc6cae9109aa8079bd54af6c9fa3afc3413483.tar.gz
zabbix-b1fc6cae9109aa8079bd54af6c9fa3afc3413483.tar.xz
zabbix-b1fc6cae9109aa8079bd54af6c9fa3afc3413483.zip
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@1943 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rwxr-xr-xsrc/zabbix_agent_win32/Release/ZabbixW32.exebin98304 -> 102400 bytes
-rw-r--r--src/zabbix_agent_win32/ZabbixW32.dsp4
-rwxr-xr-xsrc/zabbix_agent_win32/active.cpp2
-rwxr-xr-xsrc/zabbix_agent_win32/eventlog.cpp41
-rw-r--r--src/zabbix_agent_win32/zabbixw32.h3
5 files changed, 35 insertions, 15 deletions
diff --git a/src/zabbix_agent_win32/Release/ZabbixW32.exe b/src/zabbix_agent_win32/Release/ZabbixW32.exe
index 4aba2445..538e3955 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/ZabbixW32.dsp b/src/zabbix_agent_win32/ZabbixW32.dsp
index 487d4e4c..c8997500 100644
--- a/src/zabbix_agent_win32/ZabbixW32.dsp
+++ b/src/zabbix_agent_win32/ZabbixW32.dsp
@@ -111,6 +111,10 @@ SOURCE=.\config.cpp
# End Source File
# Begin Source File
+SOURCE=.\eventlog.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\execute.cpp
# End Source File
# Begin Source File
diff --git a/src/zabbix_agent_win32/active.cpp b/src/zabbix_agent_win32/active.cpp
index 74e705bb..e0f6f316 100755
--- a/src/zabbix_agent_win32/active.cpp
+++ b/src/zabbix_agent_win32/active.cpp
@@ -557,7 +557,7 @@ int process_active_checks(char *server, int port)
filename=strtok(NULL,"[]");
count=0;
- while(process_eventlog(filename,&metrics[i].lastlogsize,value) == 0)
+ while(process_eventlog_new(filename,&metrics[i].lastlogsize,value) == 0)
{
// sprintf(shortname, "%s:%s",confHostname,metrics[i].key);
// zabbix_log( LOG_LEVEL_DEBUG, "%s",shortname);
diff --git a/src/zabbix_agent_win32/eventlog.cpp b/src/zabbix_agent_win32/eventlog.cpp
index 06cf5432..9d0113b7 100755
--- a/src/zabbix_agent_win32/eventlog.cpp
+++ b/src/zabbix_agent_win32/eventlog.cpp
@@ -1,5 +1,4 @@
-#include <Windows.h>
-#include <stdio.h>
+#include "zabbixw32.h"
#define DllExport __declspec( dllexport )
#define MAX_INSERT_STRS 8
@@ -13,30 +12,46 @@ DllExport long MyGetAEventLog(char *pAppName,HANDLE hAppLog,long
which,double *pTime,char *pSource,char *pMessage,long *pType,long
*pCategory);
-// test the calls
-void main()
+int process_eventlog_new(char *source,int *lastlogsize, char *value)
{
+
HANDLE hAppLog;
- long nRecords,Latest;
+ long nRecords,Latest=1;
long i;
double time;
char src[1024],msg[1024];
long type,category;
+ char zzz[1024];
// open up event log
- if (!MyOpenEventLog("Application",&hAppLog,&nRecords,&Latest))
+// if (!MyOpenEventLog("Application",&hAppLog,&nRecords,&Latest))
+ if (!MyOpenEventLog(source,&hAppLog,&nRecords,&Latest))
+
{
- for (i = nRecords + 1;--i;++Latest) // loop thruall records
+// for (i = nRecords + 1;--i;++Latest)
+ for (i = 0; i<nRecords;i++)
{
- if (Latest > nRecords) // need totreat as circular que
- Latest = 1;
-
-MyGetAEventLog("Application",hAppLog,Latest,&time,src,msg,&type,&category);
- printf("Src = %s, Msg = %s, type = %d, Category = %d\n",src,msg,type,category);
- }
+// if (Latest > nRecords) // need totreat as circular que
+// Latest = 1;
+
+ if(*lastlogsize <= i)
+ {
+
+// MyGetAEventLog("Application",hAppLog,Latest,&time,src,msg,&type,&category);
+ MyGetAEventLog(source,hAppLog,Latest,&time,src,msg,&type,&category);
+ sprintf(zzz,"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",zzz);
+ *lastlogsize = Latest;
+ MyCloseEventLog(hAppLog);
+ return 1;
+ }
+ Latest++;
+ }
MyCloseEventLog(hAppLog);
}
+ return 1;
}
// open event logger and return number of records
diff --git a/src/zabbix_agent_win32/zabbixw32.h b/src/zabbix_agent_win32/zabbixw32.h
index bdc7852f..be09b813 100644
--- a/src/zabbix_agent_win32/zabbixw32.h
+++ b/src/zabbix_agent_win32/zabbixw32.h
@@ -212,7 +212,8 @@ 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(char *source,int *lastlogsize, char *value);
+int process_eventlog_new(char *source,int *lastlogsize, char *value);
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);