[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[monit-dev] [monit] r308 committed - Index: external/strftime.c...
From: |
monit |
Subject: |
[monit-dev] [monit] r308 committed - Index: external/strftime.c... |
Date: |
Sat, 18 Dec 2010 00:36:44 +0000 |
Revision: 308
Author: janhenrik.haukeland
Date: Fri Dec 17 16:35:24 2010
Log: Index: external/strftime.c
... openbsd compiler warning fix
Index: protocols/sip.c
... openbsd compiler warning fix
Index: device/sysdep_FREEBSD.c
... allow usage of path to block device in filesystem check path - formerly
monit took filesystem where the device file resides (usually devfs pseudo
filesystem)
Index: device/sysdep_OPENBSD.c
... allow usage of path to block device in filesystem check path - formerly
monit took filesystem where the device file resides (usually devfs pseudo
filesystem)
Index: device/sysdep_NETBSD.c
... allow usage of path to block device in filesystem check path - formerly
monit took filesystem where the device file resides (usually devfs pseudo
filesystem)
... fix space usage value (it used wrong block size so monit showed
multiple of real filesystem size)
Index: device/device_common.c
... openbsd uses character device in place for block device => need to
allow it too
Index: device/sysdep_DARWIN.c
... allow usage of path to block device in filesystem check path - formerly
monit took filesystem where the device file resides (usually devfs pseudo
filesystem)
Index: socket.c
... openbsd compiler warning fix
Index: process/sysdep_LINUX.c
... support for OpenVZ 2.6.32 kernel which hides part of /proc/meminfo in
VPS hosts (only basic statistics are available in OpenVZ)
http://code.google.com/p/monit/source/detail?r=308
Modified:
/trunk/CHANGES.txt
/trunk/configure.ac
/trunk/device/device_common.c
/trunk/device/sysdep_DARWIN.c
/trunk/device/sysdep_FREEBSD.c
/trunk/device/sysdep_NETBSD.c
/trunk/device/sysdep_OPENBSD.c
/trunk/external/strftime.c
/trunk/monit.pod
/trunk/process/sysdep_LINUX.c
/trunk/protocols/sip.c
/trunk/socket.c
=======================================
--- /trunk/CHANGES.txt Fri Nov 19 12:48:14 2010
+++ /trunk/CHANGES.txt Fri Dec 17 16:35:24 2010
@@ -1,4 +1,4 @@
- CHANGES version 5.2.3
+ CHANGES version 5.2.4
This file summarizes changes made since 5.0
@@ -7,12 +7,29 @@
https://savannah.nongnu.org/bugs/?group=monit
+Version 5.2.4
+
+BUGFIXES:
+
+* FreeBSD, NetBSD, OpenBSD, MacOSX filesystem check fix:
+ If block/character device was used in the check path instead
+ of mountpoint, monit reported usage of wrong filesystem.
+
+* NetBSD filesystem check: Fix space usage report
+
+* Linux OpenVZ 2.6.32+: Fix memory usage monitoring in VPS
+ virtual hosts. Thanks to Kelly for report.
+
+
+
Version 5.2.3
BUGFIXES:
* Mysql protocol test supports mysql 5.5.x and newer now.
+
+
Version 5.2.2
BUGFIXES:
=======================================
--- /trunk/configure.ac Fri Nov 19 12:48:14 2010
+++ /trunk/configure.ac Fri Dec 17 16:35:24 2010
@@ -10,7 +10,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.2.3], address@hidden)
+AC_INIT([monit], [5.2.4], address@hidden)
# Package info
AC_REVISION([$Revision: 1.194 $])
@@ -141,6 +141,7 @@
sys/time.h \
sys/tree.h \
sys/types.h \
+ sys/ucred.h \
sys/un.h \
sys/utsname.h \
sys/vmmeter.h \
=======================================
--- /trunk/device/device_common.c Fri Jan 8 03:20:43 2010
+++ /trunk/device/device_common.c Fri Dec 17 16:35:24 2010
@@ -104,7 +104,7 @@
inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
return strncpy(inf->mntpath, object, sizeof(inf->mntpath) - 1);
- } else if(S_ISBLK(buf.st_mode)) {
+ } else if(S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) {
return device_mountpoint_sysdep(inf, object);
=======================================
--- /trunk/device/sysdep_DARWIN.c Fri Jan 8 03:20:43 2010
+++ /trunk/device/sysdep_DARWIN.c Fri Dec 17 16:35:24 2010
@@ -54,6 +54,10 @@
#include <sys/param.h>
#endif
+#if defined HAVE_SYS_UCRED_H
+#include <sys/ucred.h>
+#endif
+
#if defined HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
@@ -71,21 +75,28 @@
* @return NULL in the case of failure otherwise mountpoint
*/
char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
- struct statfs usage;
+ int countfs;
ASSERT(inf);
ASSERT(blockdev);
- if(statfs(blockdev, &usage) != 0) {
- LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
- prog, blockdev, STRERROR);
- return NULL;
- }
-
- inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
- return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) -
1);
-
+ if ((countfs = getfsstat(NULL, 0, MNT_NOWAIT)) != -1) {
+ struct statfs *statfs = xcalloc(countfs, sizeof(struct statfs));
+ if ((countfs = getfsstat(statfs, countfs * sizeof(struct statfs),
MNT_NOWAIT)) != -1) {
+ int i;
+ for (i = 0; i < countfs; i++) {
+ struct statfs *sfs = statfs + i;
+ if (IS(sfs->f_mntfromname, blockdev)) {
+ snprintf(inf->mntpath, sizeof(inf->mntpath), "%s",
sfs->f_mntonname);
+ FREE(statfs);
+ return inf->mntpath;
+ }
+ }
+ }
+ FREE(statfs);
+ }
+ LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
prog, blockdev, STRERROR);
+ return NULL;
}
=======================================
--- /trunk/device/sysdep_FREEBSD.c Fri Jan 8 03:20:43 2010
+++ /trunk/device/sysdep_FREEBSD.c Fri Dec 17 16:35:24 2010
@@ -54,6 +54,10 @@
#include <sys/param.h>
#endif
+#if defined HAVE_SYS_UCRED_H
+#include <sys/ucred.h>
+#endif
+
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
@@ -71,21 +75,28 @@
* @return NULL in the case of failure otherwise mountpoint
*/
char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
- struct statfs usage;
+ int countfs;
ASSERT(inf);
ASSERT(blockdev);
- if(statfs(blockdev, &usage) != 0) {
- LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
- prog, blockdev, STRERROR);
- return NULL;
- }
-
- inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
- return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) -
1);
-
+ if ((countfs = getfsstat(NULL, 0, MNT_NOWAIT)) != -1) {
+ struct statfs *statfs = xcalloc(countfs, sizeof(struct statfs));
+ if ((countfs = getfsstat(statfs, countfs * sizeof(struct statfs),
MNT_NOWAIT)) != -1) {
+ int i;
+ for (i = 0; i < countfs; i++) {
+ struct statfs *sfs = statfs + i;
+ if (IS(sfs->f_mntfromname, blockdev)) {
+ snprintf(inf->mntpath, sizeof(inf->mntpath), "%s",
sfs->f_mntonname);
+ FREE(statfs);
+ return inf->mntpath;
+ }
+ }
+ }
+ FREE(statfs);
+ }
+ LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
prog, blockdev, STRERROR);
+ return NULL;
}
=======================================
--- /trunk/device/sysdep_NETBSD.c Fri Jan 8 03:20:43 2010
+++ /trunk/device/sysdep_NETBSD.c Fri Dec 17 16:35:24 2010
@@ -57,6 +57,10 @@
#include <sys/mount.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
@@ -74,28 +78,28 @@
* @return NULL in the case of failure otherwise mountpoint
*/
char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
-#if(__NetBSD_Version__ >= 300000000)
- struct statvfs usage;
-#else
- struct statfs usage;
-#endif
+ int countfs;
ASSERT(inf);
ASSERT(blockdev);
-#if(__NetBSD_Version__ >= 300000000)
- if(statvfs(blockdev, &usage) != 0) {
-#else
- if(statfs(blockdev, &usage) != 0) {
-#endif
- LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
- prog, blockdev, STRERROR);
- return NULL;
- }
-
- inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
- return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) -
1);
+ if ((countfs = getvfsstat(NULL, 0, ST_NOWAIT)) != -1) {
+ struct statvfs *statvfs = xcalloc(countfs, sizeof(struct statvfs));
+ if ((countfs = getvfsstat(statvfs, countfs * sizeof(struct statvfs),
ST_NOWAIT)) != -1) {
+ int i;
+ for (i = 0; i < countfs; i++) {
+ struct statvfs *sfs = statvfs + i;
+ if (IS(sfs->f_mntfromname, blockdev)) {
+ snprintf(inf->mntpath, sizeof(inf->mntpath), "%s",
sfs->f_mntonname);
+ FREE(statvfs);
+ return inf->mntpath;
+ }
+ }
+ }
+ FREE(statvfs);
+ }
+ LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
prog, blockdev, STRERROR);
+ return NULL;
}
@@ -108,38 +112,23 @@
* @return TRUE if informations were succesfully read otherwise
FALSE
*/
int filesystem_usage_sysdep(Info_T inf) {
-
-#if(__NetBSD_Version__ >= 300000000)
struct statvfs usage;
-#else
- struct statfs usage;
-#endif
ASSERT(inf);
-#if(__NetBSD_Version__ >= 300000000)
if(statvfs(inf->mntpath, &usage) != 0) {
-#else
- if(statfs(inf->mntpath, &usage) != 0) {
-#endif
- LogError("%s: Error getting usage statistics for filesystem '%s'
-- %s\n",
- prog, inf->mntpath, STRERROR);
+ LogError("%s: Error getting usage statistics for filesystem '%s'
-- %s\n", prog, inf->mntpath, STRERROR);
return FALSE;
}
- inf->f_bsize= usage.f_bsize;
+ inf->f_bsize= usage.f_frsize;
inf->f_blocks= usage.f_blocks;
inf->f_blocksfree= usage.f_bavail;
inf->f_blocksfreetotal= usage.f_bfree;
inf->f_files= usage.f_files;
inf->f_filesfree= usage.f_ffree;
-#if(__NetBSD_Version__ >= 300000000)
inf->flags= usage.f_flag;
-#else
- inf->flags= usage.f_flags;
-#endif
return TRUE;
-
}
=======================================
--- /trunk/device/sysdep_OPENBSD.c Fri Jan 8 03:20:43 2010
+++ /trunk/device/sysdep_OPENBSD.c Fri Dec 17 16:35:24 2010
@@ -71,21 +71,28 @@
* @return NULL in the case of failure otherwise mountpoint
*/
char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
- struct statfs usage;
+ int countfs;
ASSERT(inf);
ASSERT(blockdev);
- if(statfs(blockdev, &usage) != 0) {
- LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
- prog, blockdev, STRERROR);
- return NULL;
- }
-
- inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
- return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) -
1);
-
+ if ((countfs = getfsstat(NULL, 0, MNT_NOWAIT)) != -1) {
+ struct statfs *statfs = xcalloc(countfs, sizeof(struct statfs));
+ if ((countfs = getfsstat(statfs, countfs * sizeof(struct statfs),
MNT_NOWAIT)) != -1) {
+ int i;
+ for (i = 0; i < countfs; i++) {
+ struct statfs *sfs = statfs + i;
+ if (IS(sfs->f_mntfromname, blockdev)) {
+ snprintf(inf->mntpath, sizeof(inf->mntpath), "%s",
sfs->f_mntonname);
+ FREE(statfs);
+ return inf->mntpath;
+ }
+ }
+ }
+ FREE(statfs);
+ }
+ LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n",
prog, blockdev, STRERROR);
+ return NULL;
}
=======================================
--- /trunk/external/strftime.c Thu Jun 4 12:28:53 2009
+++ /trunk/external/strftime.c Fri Dec 17 16:35:24 2010
@@ -999,6 +999,7 @@
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
+ memset(&tm, 0, sizeof(struct tm));
localtime_r (<, &tm);
if ((ltm.tm_sec ^ tm.tm_sec)
=======================================
--- /trunk/monit.pod Mon Sep 20 14:15:39 2010
+++ /trunk/monit.pod Fri Dec 17 16:35:24 2010
@@ -476,9 +476,7 @@
Monit will then not monitor the service. This allows for having
services configured in monitrc and start it with Monit only if it
should run. This feature can be used to build a simple failsafe
-cluster. To see how, read more about how to setup a cluster with
-Monit using the I<heartbeat> system in the examples sections
-below.
+cluster.
A service's monitoring state is persistent across Monit restart.
This means that you probably would like to make certain that
=======================================
--- /trunk/process/sysdep_LINUX.c Thu May 6 09:34:00 2010
+++ /trunk/process/sysdep_LINUX.c Fri Dec 17 16:35:24 2010
@@ -321,70 +321,37 @@
int used_system_memory_sysdep(SystemInfo_T *si) {
char *ptr;
char buf[1024];
- unsigned long mem_free;
- unsigned long buffers;
- unsigned long cached;
- unsigned long swap_total;
- unsigned long swap_free;
-
- /* Memory */
-
+ unsigned long mem_free = 0UL;
+ unsigned long buffers = 0UL;
+ unsigned long cached = 0UL;
+ unsigned long swap_total = 0UL;
+ unsigned long swap_free = 0UL;
+
if (! read_proc_file(buf, 1024, "meminfo", -1, NULL)) {
LogError("system statistic error -- cannot get real memory free
amount\n");
goto error;
}
- if (! (ptr = strstr(buf, MEMFREE))) {
+ /* Memory */
+ if (! (ptr = strstr(buf, MEMFREE)) || sscanf(ptr +
strlen(MEMFREE), "%ld", &mem_free) != 1) {
LogError("system statistic error -- cannot get real memory free
amount\n");
goto error;
}
- if (sscanf(ptr + strlen(MEMFREE), "%ld", &mem_free) != 1) {
- LogError("system statistic error -- cannot get real memory free
amount\n");
- goto error;
- }
-
- if (! (ptr = strstr(buf, MEMBUF))) {
- LogError("system statistic error -- cannot get real memory buffers "
- "amount\n");
- goto error;
- }
- if (sscanf(ptr + strlen(MEMBUF), "%ld", &buffers) != 1) {
- LogError("system statistic error -- cannot get real memory buffers
amount\n");
- goto error;
- }
-
- if (! (ptr = strstr(buf, MEMCACHE))) {
- LogError("system statistic error -- cannot get real memory cache
amount\n");
- goto error;
- }
- if (sscanf(ptr + strlen(MEMCACHE), "%ld", &cached) != 1) {
- LogError("system statistic error -- cannot get real memory cache free "
- "amount\n");
- goto error;
- }
-
+ if (! (ptr = strstr(buf, MEMBUF)) || sscanf(ptr + strlen(MEMBUF), "%ld",
&buffers) != 1)
+ DEBUG("system statistic error -- cannot get real memory buffers
amount\n");
+ if (! (ptr = strstr(buf, MEMCACHE)) || sscanf(ptr +
strlen(MEMCACHE), "%ld", &cached) != 1)
+ DEBUG("system statistic error -- cannot get real memory cache
amount\n");
si->total_mem_kbyte = systeminfo.mem_kbyte_max - mem_free - buffers -
cached;
/* Swap */
-
- if (! (ptr = strstr(buf, SWAPTOTAL))) {
+ if (! (ptr = strstr(buf, SWAPTOTAL)) || sscanf(ptr +
strlen(SWAPTOTAL), "%ld", &swap_total) != 1) {
LogError("system statistic error -- cannot get swap total amount\n");
goto error;
}
- if (sscanf(ptr + strlen(SWAPTOTAL), "%ld", &swap_total) != 1) {
- LogError("system statistic error -- cannot get swap total amount\n");
- goto error;
- }
-
- if (! (ptr = strstr(buf, SWAPFREE))) {
+ if (! (ptr = strstr(buf, SWAPFREE)) || sscanf(ptr +
strlen(SWAPFREE), "%ld", &swap_free) != 1) {
LogError("system statistic error -- cannot get swap free amount\n");
goto error;
}
- if (sscanf(ptr + strlen(SWAPFREE), "%ld", &swap_free) != 1) {
- LogError("system statistic error -- cannot get swap free amount\n");
- goto error;
- }
-
si->swap_kbyte_max = swap_total;
si->total_swap_kbyte = swap_total - swap_free;
=======================================
--- /trunk/protocols/sip.c Fri Jan 8 03:20:43 2010
+++ /trunk/protocols/sip.c Fri Dec 17 16:35:24 2010
@@ -64,6 +64,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
=======================================
--- /trunk/socket.c Thu Sep 16 04:49:51 2010
+++ /trunk/socket.c Fri Dec 17 16:35:24 2010
@@ -49,6 +49,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [monit-dev] [monit] r308 committed - Index: external/strftime.c...,
monit <=