Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndris Mednis <Andris.Mednis@zabbix.com>2014-03-05 19:40:17 +0400
committerAndris Mednis <Andris.Mednis@zabbix.com>2014-03-05 19:40:17 +0400
commit785119d15160b9c28afa616bc28812a31998e37f (patch)
tree074d8bb336808f08a9e5c8f28e31d96b808f424e /include/zbxtypes.h
parentc53f714dba773e6c37ba69f5fbc6be294c39dd22 (diff)
...G...... [ZBX-7740] fixed agent crash if logrt and log items are not supported
...G...PS. [ZBX-6731] faster processing of log files by agent on Unix ...G...PS. [ZBX-6729] faster processing of log files by agent on Microsoft Windows The main goal of the change is to improve performance (less time, fewer system calls, less CPU usage) of active checks for log[] and logrt[] items. Platform specific methods like GNU/Linux "i-notify" are not used. Please note that this change does not modify limits on maximum number of log file records checked in one check and number of matching records sent to server in one check. Before this change: - new log file records were read record-by-record, reading of each record involved opening, seeking, reading and closing of the log file. - zbx_regexp() and regexp_sub() compiled a regular expression every time, - for logrt[] items file mask regular expression was compiled for every file in a check. The log files were selected first by regular expression (file mask), then by last mtime. - due to a bug the log[] item does not go into NOTSUPPORTED state when the log file is not accessible. After this change: - new log file records are read into 256 kB buffer in one operation, then a regular expression is applied to every record in the buffer and matching records are sent to Zabbix server. No repetitive file opening, seeking for every record. - zbx_regexp() and regexp_sub() compile a regular expresion and rememeber it. This increases performance if the same regular expression is used several times in a row (e.g. for matching log file records). This affects also server and proxy. - for logrt[] items file mask regular expression is compiled only once in a check. The log files are selected first by the last mtime, then by regular expression (file mask) to improve performance. - if the log file is not accessible, the log[] item goes into NOTSUPPORTED state. - Zabbix agent detects oversized log file records (longer than 256 kB). Only the first 256 kB are matched against the regular expression and the rest of the record is ignored. - a new Zabbix datatype "zbx_offset_t" and a new function "zbx_lseek()" is added to encapsulate "lseek()" differences between UNIX/GNU/Linux and Microsoft Windows, - The Make files for "zabbix_get" and "zabbix_sender" on Microsoft Windows do not include src/libs/zbxcommon/file.c anymore.
Diffstat (limited to 'include/zbxtypes.h')
-rw-r--r--include/zbxtypes.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index b3aaa71fe60..fa300cb9508 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -74,6 +74,9 @@
# define strcasecmp lstrcmpiA
+typedef __int64 zbx_offset_t;
+#define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence)
+
#else /* _WINDOWS */
# define zbx_stat(path, buf) stat(path, buf)
@@ -110,6 +113,9 @@
# define PATH_SEPARATOR '/'
#endif
+typedef off_t zbx_offset_t;
+#define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence)
+
#endif /* _WINDOWS */
#define ZBX_FS_SIZE_T ZBX_FS_UI64