[-]
[+]
|
Changed |
monit.changes
|
|
[-]
[+]
|
Changed |
monit.spec
^
|
|
[-]
[+]
|
Deleted |
monit-5.3.1-hz.patch
^
|
@@ -1,13 +0,0 @@
---- src/process/sysdep_LINUX.c
-+++ src/process/sysdep_LINUX.c
-@@ -78,6 +78,10 @@
- #include "process.h"
- #include "process_sysdep.h"
-
-+#ifndef HZ
-+# define HZ sysconf(_SC_CLK_TCK)
-+#endif
-+
- /**
- * System dependent resource gathering code for Linux.
- *
|
[-]
[+]
|
Added |
monit-5.3.2-hz.patch
^
|
@@ -0,0 +1,13 @@
+--- src/process/sysdep_LINUX.c
++++ src/process/sysdep_LINUX.c
+@@ -78,6 +78,10 @@
+ #include "process.h"
+ #include "process_sysdep.h"
+
++#ifndef HZ
++# define HZ sysconf(_SC_CLK_TCK)
++#endif
++
+ /**
+ * System dependent resource gathering code for Linux.
+ *
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/CHANGES
^
|
@@ -1,4 +1,4 @@
- CHANGES version 5.3.1
+ CHANGES version 5.3.2
This file summarizes changes made since 5.0
@@ -7,6 +7,29 @@
https://savannah.nongnu.org/bugs/?group=monit
+Version 5.3.2
+
+BUGFIXES:
+
+* Fix bug #34801: The file content match test did reset of the
+ read position in the case that the unmonitor or stop action
+ was done. When the file monitoring was enabled again, the
+ content match test was applied to the content which was
+ tested already.
+
+* Log error details in the case that the name resolving failed.
+
+* Fix the system cpu usage statistics when pattern based process
+ check is used and the service is restarted. Thanks to Wayne
+ Lawrence for report.
+
+* AIX 6.1 compile fix. Thanks to Benedikt Wegmann for patch.
+
+* Debian Bug#652715: "include files not found" warning. Do not
+ display the warning if the include directory is empty.
+
+
+
Version 5.3.1
IMPROVEMENTS:
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/Makefile.am
^
|
@@ -18,7 +18,7 @@
AM_CPPFLAGS = $(CPPFLAGS) $(EXTCPPFLAGS) -D@ARCH@ -DSYSCONFDIR="\"@sysconfdir@\""
AM_LDFLAGS = $(LDFLAGS) $(EXTLDFLAGS) -L./lib/
INCLUDES = -I./src -I./src/device -I./src/http -I./src/process -I./src/protocols
-INCLUDES += -I./libmonit/src -I./libmonit/src/io
+INCLUDES += -I./libmonit/src
bin_PROGRAMS = monit
monit_SOURCES = src/y.tab.c \
@@ -106,6 +106,7 @@
-rm -rf `find $(distdir) -name ".DS_Store"`
-rm -rf `find $(distdir) -name ".libs"`
-rm -rf `find $(distdir) -name ".svn"`
+ -rm -rf `find $(distdir) -name ".dirstamp"`
-rm -rf $(distdir)/libmonit/libmonit.xcodeproj
-rm -rf $(distdir)/libmonit/config.log
-rm -rf $(distdir)/libmonit/config.status
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/Makefile.in
^
|
@@ -310,7 +310,7 @@
AM_CPPFLAGS = $(CPPFLAGS) $(EXTCPPFLAGS) -D@ARCH@ -DSYSCONFDIR="\"@sysconfdir@\""
AM_LDFLAGS = $(LDFLAGS) $(EXTLDFLAGS) -L./lib/
INCLUDES = -I./src -I./src/device -I./src/http -I./src/process \
- -I./src/protocols -I./libmonit/src -I./libmonit/src/io
+ -I./src/protocols -I./libmonit/src
monit_SOURCES = src/y.tab.c \
src/lex.yy.c \
src/monit.c \
@@ -1167,6 +1167,7 @@
-rm -rf `find $(distdir) -name ".DS_Store"`
-rm -rf `find $(distdir) -name ".libs"`
-rm -rf `find $(distdir) -name ".svn"`
+ -rm -rf `find $(distdir) -name ".dirstamp"`
-rm -rf $(distdir)/libmonit/libmonit.xcodeproj
-rm -rf $(distdir)/libmonit/config.log
-rm -rf $(distdir)/libmonit/config.status
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/configure
^
|
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for monit 5.3.1.
+# Generated by GNU Autoconf 2.65 for monit 5.3.2.
#
# Report bugs to <monit-general@nongnu.org>.
#
@@ -701,8 +701,8 @@
# Identity of this package.
PACKAGE_NAME='monit'
PACKAGE_TARNAME='monit'
-PACKAGE_VERSION='5.3.1'
-PACKAGE_STRING='monit 5.3.1'
+PACKAGE_VERSION='5.3.2'
+PACKAGE_STRING='monit 5.3.2'
PACKAGE_BUGREPORT='monit-general@nongnu.org'
PACKAGE_URL=''
@@ -1431,7 +1431,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures monit 5.3.1 to adapt to many kinds of systems.
+\`configure' configures monit 5.3.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1501,7 +1501,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of monit 5.3.1:";;
+ short | recursive ) echo "Configuration of monit 5.3.2:";;
esac
cat <<\_ACEOF
@@ -1609,7 +1609,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-monit configure 5.3.1
+monit configure 5.3.2
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2091,7 +2091,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by monit $as_me 5.3.1, which was
+It was created by monit $as_me 5.3.2, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2900,7 +2900,7 @@
# Define the identity of the package.
PACKAGE='monit'
- VERSION='5.3.1'
+ VERSION='5.3.2'
cat >>confdefs.h <<_ACEOF
@@ -11348,7 +11348,7 @@
kvm.h \
paths.h \
kstat.h \
- libperfstat.h \
+ sys/protosw.h \
limits.h \
loadavg.h \
locale.h \
@@ -11425,6 +11425,28 @@
for ac_header in \
+ libperfstat.h \
+
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+ #ifdef HAVE_SYS_PROTOSW_H
+ #include <sys/protosw.h>
+ #endif
+
+"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in \
netinet/ip.h \
do :
@@ -13347,7 +13369,7 @@
else
if test -z "$sslincldir"; then
- for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw; do
+ for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do
for dir in "$maindir/include"\
"$maindir/include/openssl"\
"$maindir/include/ssl"\
@@ -13391,7 +13413,8 @@
/var \
/opt \
/usr/sfw \
- /opt/csw; do
+ /opt/csw \
+ /opt/freeware; do
for dir in $maindir \
$maindir/openssl \
$maindir/ssl \
@@ -13985,7 +14008,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by monit $as_me 5.3.1, which was
+This file was extended by monit $as_me 5.3.2, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14051,7 +14074,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-monit config.status 5.3.1
+monit config.status 5.3.2
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/configure.ac
^
|
@@ -6,7 +6,7 @@
# Note: in case of beta subversion, use underscore "_" rather then dash "-"
# since RPM doesn't allow dash in Version
# Example: 5.0_beta2
-AC_INIT([monit], [5.3.1], [monit-general@nongnu.org])
+AC_INIT([monit], [5.3.2], [monit-general@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
@@ -121,7 +121,7 @@
kvm.h \
paths.h \
kstat.h \
- libperfstat.h \
+ sys/protosw.h \
limits.h \
loadavg.h \
locale.h \
@@ -185,6 +185,17 @@
])
AC_CHECK_HEADERS([ \
+ libperfstat.h \
+ ],
+ [],
+ [],
+ [
+ #ifdef HAVE_SYS_PROTOSW_H
+ #include <sys/protosw.h>
+ #endif
+ ])
+
+AC_CHECK_HEADERS([ \
netinet/ip.h \
],
[],
@@ -708,7 +719,7 @@
[
if test -z "$sslincldir"; then
dnl Search default locations of SSL includes
- for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw; do
+ for maindir in /usr /usr/local /usr/lib /usr/pkg /var /opt /usr/sfw /opt/csw /opt/freeware; do
for dir in "$maindir/include"\
"$maindir/include/openssl"\
"$maindir/include/ssl"\
@@ -747,7 +758,8 @@
/var \
/opt \
/usr/sfw \
- /opt/csw; do
+ /opt/csw \
+ /opt/freeware; do
for dir in $maindir \
$maindir/openssl \
$maindir/ssl \
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/contrib/packages/redhat/monit.spec
^
|
@@ -1,6 +1,6 @@
Name: monit
Summary: Process monitor and restart utility
-Version: 5.3.1
+Version: 5.3.2
Release: 1
Source: http://www.mmonit.com/monit/dist/%{name}-%{version}.tar.gz
Group: Utilities/Console
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/doc/monit.pod
^
|
@@ -664,6 +664,7 @@
permission
pid
ppid
+ resource
size
status
timeout
@@ -1025,10 +1026,10 @@
=head1 SERVICE TESTS
-Monit provides several tests you can use in a service entry to
-test a service. There are two classes of tests: variable and
-constant tests. That is, the condition we test is either constant
-e.g. a number or it can vary.
+Monit provides several tests you can use in a 'check service'
+entry to test a service. There are two classes of tests:
+variable and constant tests. That is, the condition we test
+is either constant e.g. a number or it can vary.
A constant test has this general format:
@@ -1439,9 +1440,9 @@
=head2 FILE SIZE TESTING
-The size statement may only be used in a file service entry. If
-specified in the control file, Monit will compute a size for a
-file.
+The size statement may only be used in a check file service
+entry. If specified in the control file, Monit will compute
+a size for a file.
The size test in constant form is used to verify various size
conditions. Syntax (keywords are in capital):
@@ -1634,9 +1635,9 @@
=head2 SPACE TESTING
-Monit can test file systems for space usage. This test may only
-be used within a filesystem service entry in the Monit control
-file.
+Monit can test file systems for space usage. This test may
+only be used within a check filesystem service entry in the
+Monit control file.
Monit will check a filesystem's total space usage. If you only
want to check available space for non-superuser, you must set the
@@ -1673,9 +1674,9 @@
=head2 INODE TESTING
-If supported by the file-system, you can use Monit to test for
-inodes usage. This test may only be used within a filesystem
-service entry in the Monit control file.
+If supported by the file-system, you can use Monit to test
+for inodes usage. This test may only be used within a check
+filesystem service entry in the Monit control file.
If the filesystem becomes unavailable, Monit will call the
service's registered start method, if it is defined and if Monit
@@ -1749,9 +1750,10 @@
=head2 UID TESTING
-Monit can monitor the owner user id (uid) of a file object. This
-test may only be used within a file, fifo, directory or
-filesystem service entry in the Monit control file.
+Monit can monitor the owner user id (uid) of a file object.
+This test may only be used within a check - file, fifo,
+directory or filesystem service entry in the Monit control
+file.
The syntax for the uid statement is:
@@ -1891,9 +1893,10 @@
=head2 CONNECTION TESTING
-Monit is able to perform connection testing via networked ports
-or via Unix sockets. A connection test may only be used within a
-process or within a host service entry in the Monit control file.
+Monit is able to perform connection testing via networked
+ports or via Unix sockets. A connection test may only be
+used within a check process or within a check host service
+entry in the Monit control file.
If a service listens on one or more sockets, Monit can connect to
the port (using either tcp or udp) and verify that the service
@@ -2500,7 +2503,7 @@
=head2 PROGRAM STATUS TESTING
You can check the exit status of a program or a script. This test
-may only be used within a program service entry in the Monit
+may only be used within a check program service entry in the Monit
control file.
An example:
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/io/File.c
^
|
@@ -109,6 +109,11 @@
}
+int File_rewind(int fd) {
+ return (lseek(fd, 0, SEEK_SET) >=0);
+}
+
+
time_t File_mtime(const char *file) {
if (file) {
struct stat buf;
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/io/File.h
^
|
@@ -104,6 +104,15 @@
/**
+ * Move the <code>read</code> position in the file to the beginning
+ * of input.
+ * @param fd An open file descriptor
+ * @return true if success otherwise false and errno is set accordingly
+ */
+int File_rewind(int fd);
+
+
+/**
* Returns the last modified time stamp for the given <code>file</code>.
* A file's mtime is changed by a file write operation
* @param file An absolute file path
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/io/InputStream.c
^
|
@@ -75,10 +75,12 @@
static inline int fill(T S) {
if (S->isclosed)
return -1;
+ S->length = 0;
+ S->offset = 0;
errno = 0;
- int n = (int)Net_read(S->fd, S->buffer + S->length, BUFFER_SIZE - S->length, S->timeout);
+ int n = (int)Net_read(S->fd, S->buffer, BUFFER_SIZE, S->timeout);
if (n > 0)
- S->length += n;
+ S->length = n;
else if (n < 0) {
n = -1;
S->isclosed = true;
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/io/OutputStream.c
^
|
@@ -113,28 +113,28 @@
#define pad(n,c) do { int nn = (n); while (nn-- > 0) write_byte(S, (c)); } while (0)
static void putd(T S, const char *str, int len, unsigned char flags[], int width, int precision) {
- int sign;
- assert(str);
- assert(len >= 0);
- assert(flags);
- if (width == INT_MIN)
- width = 0;
- if (width < 0) {
- flags['-'] = 1;
- width = -width;
- }
- if (precision >= 0)
- flags['0'] = 0;
- if (len > 0 && (*str == '-' || *str == '+')) {
- sign = *str++;
- len--;
- } else if (flags['+'])
- sign = '+';
- else if (flags[' '])
- sign = ' ';
- else
- sign = 0;
- { int n;
+ int sign;
+ assert(str);
+ assert(len >= 0);
+ assert(flags);
+ if (width == INT_MIN)
+ width = 0;
+ if (width < 0) {
+ flags['-'] = 1;
+ width = -width;
+ }
+ if (precision >= 0)
+ flags['0'] = 0;
+ if (len > 0 && (*str == '-' || *str == '+')) {
+ sign = *str++;
+ len--;
+ } else if (flags['+'])
+ sign = '+';
+ else if (flags[' '])
+ sign = ' ';
+ else
+ sign = 0;
+ { int n;
if (precision < 0)
precision = 1;
if (len < precision)
@@ -167,145 +167,145 @@
static void cvt_s(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- uchar_t *str = va_arg(box->ap, uchar_t *);
+ uchar_t *str = va_arg(box->ap, uchar_t *);
assert(str);
int len = (int)strlen((char*)str);
- assert(len >= 0);
- assert(flags);
- if (width == INT_MIN)
- width = 0;
- if (width < 0) {
- flags['-'] = 1;
- width = -width;
- }
- if (precision >= 0)
- flags['0'] = 0;
- if (precision >= 0 && precision < len)
- len = precision;
- if (!flags['-'])
- pad(width - len, ' ');
+ assert(len >= 0);
+ assert(flags);
+ if (width == INT_MIN)
+ width = 0;
+ if (width < 0) {
+ flags['-'] = 1;
+ width = -width;
+ }
+ if (precision >= 0)
+ flags['0'] = 0;
+ if (precision >= 0 && precision < len)
+ len = precision;
+ if (!flags['-'])
+ pad(width - len, ' ');
for (int i = 0; i < len; i++)
write_byte(S, *str++);
- if (flags['-'])
- pad(width - len, ' ');
+ if (flags['-'])
+ pad(width - len, ' ');
}
static void cvt_d(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- int val = va_arg(box->ap, int);
- unsigned int m;
- char buf[43];
- char *p = buf + sizeof buf;
- if (val == INT_MIN)
- m = INT_MAX + 1UL;
- else if (val < 0)
- m = -val;
- else
- m = val;
- do
- *--p = m%10 + '0';
- while ((m /= 10) > 0);
- if (val < 0)
- *--p = '-';
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ int val = va_arg(box->ap, int);
+ unsigned int m;
+ char buf[43];
+ char *p = buf + sizeof buf;
+ if (val == INT_MIN)
+ m = INT_MAX + 1UL;
+ else if (val < 0)
+ m = -val;
+ else
+ m = val;
+ do
+ *--p = m%10 + '0';
+ while ((m /= 10) > 0);
+ if (val < 0)
+ *--p = '-';
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_l(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- long val = va_arg(box->ap, long);
- unsigned long m;
- char buf[43];
- char *p = buf + sizeof buf;
- if (val == LONG_MIN)
- m = LONG_MAX + 1UL;
- else if (val < 0)
- m = -val;
- else
- m = val;
- do
- *--p = m%10 + '0';
- while ((m /= 10) > 0);
- if (val < 0)
- *--p = '-';
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ long val = va_arg(box->ap, long);
+ unsigned long m;
+ char buf[43];
+ char *p = buf + sizeof buf;
+ if (val == LONG_MIN)
+ m = LONG_MAX + 1UL;
+ else if (val < 0)
+ m = -val;
+ else
+ m = val;
+ do
+ *--p = m%10 + '0';
+ while ((m /= 10) > 0);
+ if (val < 0)
+ *--p = '-';
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_u(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- unsigned long m = va_arg(box->ap, unsigned long);
- char buf[43];
- char *p = buf + sizeof buf;
- do
- *--p = m%10 + '0';
- while ((m /= 10) > 0);
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ unsigned long m = va_arg(box->ap, unsigned long);
+ char buf[43];
+ char *p = buf + sizeof buf;
+ do
+ *--p = m%10 + '0';
+ while ((m /= 10) > 0);
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_o(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- unsigned long m = va_arg(box->ap, unsigned long);
- char buf[43];
- char *p = buf + sizeof buf;
- do
- *--p = (m&0x7) + '0';
- while ((m>>= 3) != 0);
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ unsigned long m = va_arg(box->ap, unsigned long);
+ char buf[43];
+ char *p = buf + sizeof buf;
+ do
+ *--p = (m&0x7) + '0';
+ while ((m>>= 3) != 0);
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_x(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- unsigned long m = va_arg(box->ap, unsigned long);
- char buf[43];
- char *p = buf + sizeof buf;
- do
- *--p = "0123456789abcdef"[m&0xf];
- while ((m>>= 4) != 0);
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ unsigned long m = va_arg(box->ap, unsigned long);
+ char buf[43];
+ char *p = buf + sizeof buf;
+ do
+ *--p = "0123456789abcdef"[m&0xf];
+ while ((m>>= 4) != 0);
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_p(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- unsigned long m = (unsigned long)va_arg(box->ap, void*);
- char buf[43];
- char *p = buf + sizeof buf;
- precision = INT_MIN;
- do
- *--p = "0123456789abcdef"[m&0xf];
- while ((m>>= 4) != 0);
- putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
+ unsigned long m = (unsigned long)va_arg(box->ap, void*);
+ char buf[43];
+ char *p = buf + sizeof buf;
+ precision = INT_MIN;
+ do
+ *--p = "0123456789abcdef"[m&0xf];
+ while ((m>>= 4) != 0);
+ putd(S, p, (int)((buf + sizeof buf) - p), flags, width, precision);
}
static void cvt_c(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- if (width == INT_MIN)
- width = 0;
- if (width < 0) {
- flags['-'] = 1;
- width = -width;
- }
- if (!flags['-'])
- pad(width - 1, ' ');
- write_byte(S, va_arg(box->ap, int));
- if (flags['-'])
- pad(width - 1, ' ');
+ if (width == INT_MIN)
+ width = 0;
+ if (width < 0) {
+ flags['-'] = 1;
+ width = -width;
+ }
+ if (!flags['-'])
+ pad(width - 1, ' ');
+ write_byte(S, va_arg(box->ap, int));
+ if (flags['-'])
+ pad(width - 1, ' ');
}
static void cvt_f(T S, int code, va_list_box *box, unsigned char flags[], int width, int precision) {
- char buf[DBL_MAX_10_EXP+1+1+99+1];
- if (precision < 0)
- precision = 6;
- if (code == 'g' && precision == 0)
- precision = 1;
- {
- char fmt[] = "%.dd?";
- assert(precision <= 99);
- fmt[4] = code;
- fmt[3] = precision%10 + '0';
- fmt[2] = (precision/10)%10 + '0';
- sprintf(buf, fmt, va_arg(box->ap, double));
- }
- putd(S, buf, (int)strlen(buf), flags, width, precision);
+ char buf[DBL_MAX_10_EXP+1+1+99+1];
+ if (precision < 0)
+ precision = 6;
+ if (code == 'g' && precision == 0)
+ precision = 1;
+ {
+ char fmt[] = "%.dd?";
+ assert(precision <= 99);
+ fmt[4] = code;
+ fmt[3] = precision%10 + '0';
+ fmt[2] = (precision/10)%10 + '0';
+ sprintf(buf, fmt, va_arg(box->ap, double));
+ }
+ putd(S, buf, (int)strlen(buf), flags, width, precision);
}
@@ -412,8 +412,8 @@
va_copy(box.ap, ap);
S->sessionWritten = 0;
while (*fmt) {
- if (*fmt != '%' || *++fmt == '%')
- write_byte(S, *fmt++);
+ if (*fmt != '%' || *++fmt == '%')
+ write_byte(S, *fmt++);
else {
uchar_t c, flags[256] = {0};
int width = INT_MIN, precision = INT_MIN;
@@ -456,7 +456,7 @@
c = 'l';
}
assert(cvt[c]);
- (*cvt[c])(S, c, &box, flags, width, precision);
+ cvt[c](S, c, &box, flags, width, precision);
}
}
va_end(box.ap);
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/system/Time.c
^
|
@@ -420,7 +420,7 @@
}
-time_t Time_now() {
+time_t Time_now(void) {
struct timeval t;
if (gettimeofday(&t, NULL) != 0)
THROW(AssertException, "%s", System_getLastError());
@@ -428,7 +428,7 @@
}
-long long int Time_milli() {
+long long int Time_milli(void) {
struct timeval t;
if (gettimeofday(&t, NULL) != 0)
THROW(AssertException, "%s", System_getLastError());
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/thread/Thread.h
^
|
@@ -25,6 +25,13 @@
#ifndef THREAD_INCLUDED
#define THREAD_INCLUDED
+#include <stdio.h>
+#include <errno.h>
+#include <assert.h>
+#include <string.h>
+#include <pthread.h>
+#include "system/System.h"
+
/**
* General purpose <b>Thread</b> abstractions. This interface defines object
@@ -35,16 +42,10 @@
*/
-/* -------------------------------------------- Thread interface for POSIX */
-#include <stdio.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-#include <pthread.h>
/** @cond hidden */
#define wrapper(F) do { \
int status= F; if (! (status == 0 || status==ETIMEDOUT)) \
- Exception_throw(&AssertException, __func__, __FILE__, __LINE__, "%s -- %s", #F, strerror(status)); \
+ THROW(AssertException, "%s -- %s", #F, System_getError(status)); \
} while (0)
/** @endcond */
/** @name Abstract Data Types */
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/src/util/Str.c
^
|
@@ -203,11 +203,11 @@
int Str_startsWith(const char *a, const char *b) {
- if (a && b) {
- const char *s = a;
- while (*a && *b)
- if (toupper(*a++) != toupper(*b++)) return false;
- return ((*a == *b) || (a != s && *b == 0));
+ if (a && b) {
+ do
+ if (*a++ != *b++) return false;
+ while (*b);
+ return true;
}
return false;
}
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/test/CommandTest.c
^
|
@@ -22,7 +22,7 @@
static void onExec(Process_T P) {
assert(P);
- char buf[STRLEN + 1];
+ char buf[STRLEN];
// Child process info
printf("\tSubprocess ((pid=%d) created with cwd (%s)\n", Process_getPid(P), Process_getDir(P));
InputStream_T in = Process_getInputStream(P);
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/libmonit/test/InputStreamTest.c
^
|
@@ -11,6 +11,7 @@
#include "InputStream.h"
#include "File.h"
#include "Str.h"
+#include "system/System.h"
/**
* InputStream.c unit tests.
@@ -97,18 +98,41 @@
}
printf("=> Test4: OK\n\n");
- printf("=> Test5: wrong descriptor - expecting read fail\n");
+ printf("=> Test5: read a large file\n");
+ {
+ if ((fd = File_open("/usr/share/dict/words", "r")) >= 0) {
+ int n = 0;
+ char array[2][STRLEN + 1];
+ in = InputStream_new(fd);
+ for (int i = 0; ((n = InputStream_readBytes(in, array[i], STRLEN)) > 0); i = i ? 0 : 1)
+ assert(strncmp(array[0], array[1], STRLEN/2) != 0); // ensure that InputStream buffer is filled anew
+ File_rewind(fd);
+ // Test read data larger than InputStream's internal buffer
+ int filesize = (int)File_size("/usr/share/dict/words");
+ char *bigarray = CALLOC(1, filesize + 1);
+ n = InputStream_readBytes(in, bigarray, filesize);
+ assert(n == filesize);
+ File_close(fd);
+ InputStream_free(&in);
+ FREE(bigarray);
+ } else
+ ERROR("\t/usr/share/dict/words not available -- skipping test\n");
+ }
+ printf("=> Test5: OK\n\n");
+
+ printf("=> Test6: wrong descriptor - expecting read fail\n");
{
in = InputStream_new(999);
TRY
- assert(InputStream_read(in) != -1);
- assert(false); // Should not come here
+ assert(InputStream_read(in) != -1);
+ assert(false); // Should not come here
CATCH(AssertException)
- // Passed
+ // Passed
END_TRY;
InputStream_free(&in);
}
- printf("=> Test5: OK\n\n");
+ printf("=> Test6: OK\n\n");
+
printf("============> InputStream Tests: OK\n\n");
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/monit.1
^
|
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "MONIT 1"
-.TH MONIT 1 "www.mmonit.com" "October 25. 2011" "User Commands"
+.TH MONIT 1 "www.mmonit.com" "December 20. 2011" "User Commands"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -771,6 +771,7 @@
\& permission
\& pid
\& ppid
+\& resource
\& size
\& status
\& timeout
@@ -1151,10 +1152,10 @@
.Ve
.SH "SERVICE TESTS"
.IX Header "SERVICE TESTS"
-Monit provides several tests you can use in a service entry to
-test a service. There are two classes of tests: variable and
-constant tests. That is, the condition we test is either constant
-e.g. a number or it can vary.
+Monit provides several tests you can use in a 'check service'
+entry to test a service. There are two classes of tests:
+variable and constant tests. That is, the condition we test
+is either constant e.g. a number or it can vary.
.PP
A constant test has this general format:
.IP "\s-1IF\s0 <\s-1TEST\s0> [[<X>] [\s-1TIMES\s0 \s-1WITHIN\s0] <Y> \s-1CYCLES\s0] \s-1THEN\s0 \s-1ACTION\s0 [\s-1ELSE\s0 \s-1IF\s0 \s-1SUCCEEDED\s0 [[<X>] [\s-1TIMES\s0 \s-1WITHIN\s0] <Y> \s-1CYCLES\s0] \s-1THEN\s0 \s-1ACTION\s0]" 4
@@ -1515,9 +1516,9 @@
.Ve
.SS "\s-1FILE\s0 \s-1SIZE\s0 \s-1TESTING\s0"
.IX Subsection "FILE SIZE TESTING"
-The size statement may only be used in a file service entry. If
-specified in the control file, Monit will compute a size for a
-file.
+The size statement may only be used in a check file service
+entry. If specified in the control file, Monit will compute
+a size for a file.
.PP
The size test in constant form is used to verify various size
conditions. Syntax (keywords are in capital):
@@ -1694,9 +1695,9 @@
.Ve
.SS "\s-1SPACE\s0 \s-1TESTING\s0"
.IX Subsection "SPACE TESTING"
-Monit can test file systems for space usage. This test may only
-be used within a filesystem service entry in the Monit control
-file.
+Monit can test file systems for space usage. This test may
+only be used within a check filesystem service entry in the
+Monit control file.
.PP
Monit will check a filesystem's total space usage. If you only
want to check available space for non-superuser, you must set the
@@ -1726,9 +1727,9 @@
\&\*(L"\s-1EXEC\s0\*(R" or \*(L"\s-1UNMONITOR\s0\*(R".
.SS "\s-1INODE\s0 \s-1TESTING\s0"
.IX Subsection "INODE TESTING"
-If supported by the file-system, you can use Monit to test for
-inodes usage. This test may only be used within a filesystem
-service entry in the Monit control file.
+If supported by the file-system, you can use Monit to test
+for inodes usage. This test may only be used within a check
+filesystem service entry in the Monit control file.
.PP
If the filesystem becomes unavailable, Monit will call the
service's registered start method, if it is defined and if Monit
@@ -1787,9 +1788,10 @@
a depend tree.
.SS "\s-1UID\s0 \s-1TESTING\s0"
.IX Subsection "UID TESTING"
-Monit can monitor the owner user id (uid) of a file object. This
-test may only be used within a file, fifo, directory or
-filesystem service entry in the Monit control file.
+Monit can monitor the owner user id (uid) of a file object.
+This test may only be used within a check \- file, fifo,
+directory or filesystem service entry in the Monit control
+file.
.PP
The syntax for the uid statement is:
.IP "\s-1IF\s0 \s-1FAILED\s0 \s-1UID\s0 user [[<X>] <Y> \s-1CYCLES\s0] \s-1THEN\s0 action [\s-1ELSE\s0 \s-1IF\s0 \s-1SUCCEEDED\s0 [[<X>] <Y> \s-1CYCLES\s0] \s-1THEN\s0 action]" 4
@@ -1905,9 +1907,10 @@
.Ve
.SS "\s-1CONNECTION\s0 \s-1TESTING\s0"
.IX Subsection "CONNECTION TESTING"
-Monit is able to perform connection testing via networked ports
-or via Unix sockets. A connection test may only be used within a
-process or within a host service entry in the Monit control file.
+Monit is able to perform connection testing via networked
+ports or via Unix sockets. A connection test may only be
+used within a check process or within a check host service
+entry in the Monit control file.
.PP
If a service listens on one or more sockets, Monit can connect to
the port (using either tcp or udp) and verify that the service
@@ -2552,7 +2555,7 @@
.SS "\s-1PROGRAM\s0 \s-1STATUS\s0 \s-1TESTING\s0"
.IX Subsection "PROGRAM STATUS TESTING"
You can check the exit status of a program or a script. This test
-may only be used within a program service entry in the Monit
+may only be used within a check program service entry in the Monit
control file.
.PP
An example:
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/monitrc
^
|
@@ -76,21 +76,21 @@
# # and register without credentials # Don't register credentials
#
#
-## Monit by default uses the following alert mail format:
-##
+## Monit by default uses the following format for alerts if the the mail-format
+## statement is missing::
## --8<--
-## From: monit@$HOST # sender
-## Subject: monit alert -- $EVENT $SERVICE # subject
+## set mail-format {
+## from: monit@$HOST
+## subject: monit alert -- $EVENT $SERVICE
+## message: $EVENT Service $SERVICE
+## Date: $DATE
+## Action: $ACTION
+## Host: $HOST
+## Description: $DESCRIPTION
##
-## $EVENT Service $SERVICE #
-## #
-## Date: $DATE #
-## Action: $ACTION #
-## Host: $HOST # body
-## Description: $DESCRIPTION #
-## #
-## Your faithful employee, #
-## Monit #
+## Your faithful employee,
+## Monit
+## }
## --8<--
##
## You can override this message format or parts of it, such as subject
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/config.h.in
^
|
@@ -283,6 +283,9 @@
/* Define to 1 if you have the <sys/proc.h> header file. */
#undef HAVE_SYS_PROC_H
+/* Define to 1 if you have the <sys/protosw.h> header file. */
+#undef HAVE_SYS_PROTOSW_H
+
/* Define to 1 if you have the <sys/pstat.h> header file. */
#undef HAVE_SYS_PSTAT_H
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/l.l
^
|
@@ -76,7 +76,7 @@
/* Prototypes */
extern void yyerror(const char*,...);
- extern void yywarning(const char *,...);
+ extern void yywarning(const char *,...);
static void steplinenobycr(char *);
static void save_arg(void);
static void include_file(char *);
@@ -734,60 +734,35 @@
static char *handle_quoted_string(char *string) {
-
char *buf= Str_dup(string);
-
Str_unquote(buf);
Util_handleEscapes(buf);
-
return buf;
-
}
static void include_file(char *pattern) {
-
glob_t globbuf;
int i;
- if ( glob(pattern, GLOB_MARK, NULL, &globbuf) != 0 ) {
-
- yywarning("include files not found");
-
- return;
-
- }
+ if (glob(pattern, GLOB_MARK, NULL, &globbuf) != 0)
+ return; // no include files found
for (i = 0; i < globbuf.gl_pathc; i++) {
-
FILE *yyin;
size_t filename_length = strlen(globbuf.gl_pathv[i]);
- /* check whenever we have caught a directory
- * or file backup copy */
-
- if ((filename_length == 0) ||
- (globbuf.gl_pathv[i][filename_length-1] == '~' ) ||
- (globbuf.gl_pathv[i][filename_length-1] == '/' )) {
-
+ /* check whenever we have caught a directory or file backup copy */
+ if ((filename_length == 0) || (globbuf.gl_pathv[i][filename_length-1] == '~' ) || (globbuf.gl_pathv[i][filename_length-1] == '/' ))
continue;
- }
-
yyin = fopen( globbuf.gl_pathv[i], "r" );
- if ( ! yyin ) {
-
+ if (! yyin)
yyerror( "failed to include file" );
-
- } else {
-
+ else
push_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ), globbuf.gl_pathv[i]);
-
- }
-
}
-
globfree(&globbuf);
}
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/lex.yy.c
^
|
@@ -2770,7 +2770,7 @@
/* Prototypes */
extern void yyerror(const char*,...);
- extern void yywarning(const char *,...);
+ extern void yywarning(const char *,...);
static void steplinenobycr(char *);
static void save_arg(void);
static void include_file(char *);
@@ -5691,60 +5691,35 @@
static char *handle_quoted_string(char *string) {
-
char *buf= Str_dup(string);
-
Str_unquote(buf);
Util_handleEscapes(buf);
-
return buf;
-
}
static void include_file(char *pattern) {
-
glob_t globbuf;
int i;
- if ( glob(pattern, GLOB_MARK, NULL, &globbuf) != 0 ) {
-
- yywarning("include files not found");
-
- return;
-
- }
+ if (glob(pattern, GLOB_MARK, NULL, &globbuf) != 0)
+ return; // no include files found
for (i = 0; i < globbuf.gl_pathc; i++) {
-
FILE *yyin;
size_t filename_length = strlen(globbuf.gl_pathv[i]);
- /* check whenever we have caught a directory
- * or file backup copy */
-
- if ((filename_length == 0) ||
- (globbuf.gl_pathv[i][filename_length-1] == '~' ) ||
- (globbuf.gl_pathv[i][filename_length-1] == '/' )) {
-
+ /* check whenever we have caught a directory or file backup copy */
+ if ((filename_length == 0) || (globbuf.gl_pathv[i][filename_length-1] == '~' ) || (globbuf.gl_pathv[i][filename_length-1] == '/' ))
continue;
- }
-
yyin = fopen( globbuf.gl_pathv[i], "r" );
- if ( ! yyin ) {
-
+ if (! yyin)
yyerror( "failed to include file" );
-
- } else {
-
+ else
push_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE ), globbuf.gl_pathv[i]);
-
- }
-
}
-
globfree(&globbuf);
}
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/net.c
^
|
@@ -440,9 +440,7 @@
* @return The socket ready for accept, or -1 if an error occured.
*/
int create_server_socket(int port, int backlog, const char *bindAddr) {
- int s;
- int status;
- int flag = 1;
+ int s, status, flag = 1;
struct sockaddr_in myaddr;
if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
@@ -460,7 +458,7 @@
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET;
if((status = getaddrinfo(bindAddr, NULL, &hints, &result)) != 0) {
- LogError("%s: Cannot translate '%s' to IP address -- %s\n", prog, bindAddr, gai_strerror(status));
+ LogError("%s: Cannot translate '%s' to IP address -- %s\n", prog, bindAddr, status == EAI_SYSTEM ? STRERROR : gai_strerror(status));
goto error;
}
sa = (struct sockaddr_in *)result->ai_addr;
@@ -724,7 +722,7 @@
struct icmp *icmpin = NULL;
struct icmp *icmpout = NULL;
uint16_t id_in, id_out, seq_in;
- int r, i, s, n = 0, read_timeout;
+ int r, i, s, n = 0, status, read_timeout;
struct timeval t_in, t_out;
char buf[STRLEN];
double response = -1.;
@@ -738,8 +736,8 @@
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET;
- if (getaddrinfo(hostname, NULL, &hints, &result) != 0) {
- LogError("ICMP echo for %s -- getaddrinfo failed: %s\n", hostname, STRERROR);
+ if ((status = getaddrinfo(hostname, NULL, &hints, &result)) != 0) {
+ LogError("ICMP echo for %s -- getaddrinfo failed: %s\n", hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status));
return response;
}
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/process.c
^
|
@@ -147,7 +147,7 @@
* Updates the system wide statistic
* @return TRUE if successful, otherwise FALSE
*/
-int update_system_load(ProcessTree_T *pt, int treesize) {
+int update_system_load() {
if (Run.doprocess) {
@@ -280,7 +280,6 @@
}
fillprocesstree(pt, root);
- update_system_load(*pt_r, *size_r);
return *size_r;
}
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/process.h
^
|
@@ -35,7 +35,7 @@
int update_process_data(Service_T s, ProcessTree_T *, int treesize, pid_t pid);
int init_process_info(void);
-int update_system_load(ProcessTree_T *, int);
+int update_system_load();
int findprocess(int, ProcessTree_T *, int);
int initprocesstree(ProcessTree_T **, int *, ProcessTree_T **, int *);
void delprocesstree(ProcessTree_T **, int *);
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/process/sysdep_AIX.c
^
|
@@ -101,11 +101,15 @@
#include <sys/proc.h>
#endif
+#ifdef HAVE_SYS_PROTOSW_H
+#include <sys/protosw.h>
+#endif
+
#ifdef HAVE_LIBPERFSTAT_H
+#include <sys/protosw.h>
#include <libperfstat.h>
#endif
-
#include "process.h"
#include "process_sysdep.h"
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/util.c
^
|
@@ -1678,17 +1678,48 @@
void Util_resetInfo(Service_T s) {
- memset(s->inf, 0, sizeof *(s->inf));
+ s->inf->st_mode = 0;
+ s->inf->st_uid = 0;
+ s->inf->st_gid = 0;
+ s->inf->timestamp = 0;
switch (s->type) {
+ case TYPE_FILESYSTEM:
+ s->inf->priv.filesystem.f_bsize = 0L;
+ s->inf->priv.filesystem.f_blocks = 0L;
+ s->inf->priv.filesystem.f_blocksfree = 0L;
+ s->inf->priv.filesystem.f_blocksfreetotal = 0L;
+ s->inf->priv.filesystem.f_files = 0L;
+ s->inf->priv.filesystem.f_filesfree = 0L;
+ FREE(s->inf->priv.filesystem.mntpath);
+ s->inf->priv.filesystem.inode_percent = 0;
+ s->inf->priv.filesystem.inode_total = 0L;
+ s->inf->priv.filesystem.space_percent = 0;
+ s->inf->priv.filesystem.space_total = 0L;
+ s->inf->priv.filesystem._flags = -1;
+ s->inf->priv.filesystem.flags = -1;
+ break;
+ case TYPE_FILE:
+ // persistent: st_ino, readpos
+ s->inf->priv.file.st_size = 0;
+ s->inf->priv.file.st_ino_prev = 0;
+ *s->inf->priv.file.cs_sum = 0;
+ break;
case TYPE_PROCESS:
- s->inf->priv.process._pid = -1;
+ s->inf->priv.process._pid = -1;
s->inf->priv.process._ppid = -1;
- s->inf->priv.process.pid = -1;
- s->inf->priv.process.ppid = -1;
+ s->inf->priv.process.pid = -1;
+ s->inf->priv.process.ppid = -1;
+ s->inf->priv.process.status_flag = 0;
+ s->inf->priv.process.children = 0;
+ s->inf->priv.process.mem_kbyte = 0L;
+ s->inf->priv.process.total_mem_kbyte = 0L;
+ s->inf->priv.process.mem_percent = 0;
+ s->inf->priv.process.total_mem_percent = 0;
+ s->inf->priv.process.cpu_percent = 0;
+ s->inf->priv.process.total_cpu_percent = 0;
+ s->inf->priv.process.uptime = 0;
break;
- case TYPE_FILESYSTEM:
- s->inf->priv.filesystem._flags = -1;
- s->inf->priv.filesystem.flags = -1;
+ default:
break;
}
}
@@ -1847,7 +1878,7 @@
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;
if ((status = getaddrinfo(hostname, NULL, &hints, &info))) {
- LogError("%s: Cannot translate '%s' to FQDN name -- %s\n", prog, hostname, gai_strerror(status));
+ LogError("%s: Cannot translate '%s' to FQDN name -- %s\n", prog, hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status));
snprintf(buf, len, "%s", hostname); // fallback to gethostname()
} else
snprintf(buf, len, "%s", info->ai_canonname);
|
[-]
[+]
|
Changed |
monit-5.3.2.tar.bz2/src/validate.c
^
|
@@ -142,6 +142,7 @@
Run.handler_flag = HANDLER_SUCCEEDED;
Event_queue_process();
+ update_system_load();
initprocesstree(&ptree, &ptreesize, &oldptree, &oldptreesize);
gettimeofday(&systeminfo.collected, NULL);
|