Skip to content

Commit

Permalink
Index: external/strftime.c
Browse files Browse the repository at this point in the history
... 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)




git-svn-id: http://monit.googlecode.com/svn/trunk@308 808b68a2-07de-11de-a1f0-819f45317607
  • Loading branch information
janhenrik.haukeland committed Dec 18, 2010
1 parent 6a2bb2e commit 87d9ff9
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 116 deletions.
19 changes: 18 additions & 1 deletion CHANGES.txt
@@ -1,4 +1,4 @@
CHANGES version 5.2.3
CHANGES version 5.2.4

This file summarizes changes made since 5.0

Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Expand Up @@ -10,7 +10,7 @@ AC_PREREQ([2.53])
# 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], [monit-general@nongnu.org])
AC_INIT([monit], [5.2.4], [monit-general@nongnu.org])

# Package info
AC_REVISION([$Revision: 1.194 $])
Expand Down Expand Up @@ -141,6 +141,7 @@ AC_CHECK_HEADERS([ \
sys/time.h \
sys/tree.h \
sys/types.h \
sys/ucred.h \
sys/un.h \
sys/utsname.h \
sys/vmmeter.h \
Expand Down
2 changes: 1 addition & 1 deletion device/device_common.c
Expand Up @@ -104,7 +104,7 @@ char *device_path(Info_T inf, char *object) {
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);

Expand Down
31 changes: 21 additions & 10 deletions device/sysdep_DARWIN.c
Expand Up @@ -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
Expand All @@ -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;
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);
}

inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) - 1);

LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n", prog, blockdev, STRERROR);
return NULL;
}


Expand Down
31 changes: 21 additions & 10 deletions device/sysdep_FREEBSD.c
Expand Up @@ -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
Expand All @@ -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;
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);
}

inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) - 1);

LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n", prog, blockdev, STRERROR);
return NULL;
}


Expand Down
57 changes: 23 additions & 34 deletions device/sysdep_NETBSD.c
Expand Up @@ -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
Expand All @@ -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;
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);
}

inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) - 1);
LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n", prog, blockdev, STRERROR);
return NULL;

}

Expand All @@ -108,38 +112,23 @@ char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
* @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;

}

27 changes: 17 additions & 10 deletions device/sysdep_OPENBSD.c
Expand Up @@ -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;
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);
}

inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
return strncpy(inf->mntpath, usage.f_mntonname, sizeof(inf->mntpath) - 1);

LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n", prog, blockdev, STRERROR);
return NULL;
}


Expand Down
1 change: 1 addition & 0 deletions external/strftime.c
Expand Up @@ -999,6 +999,7 @@ strftime (s, maxsize, format, tp)
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
memset(&tm, 0, sizeof(struct tm));
localtime_r (&lt, &tm);

if ((ltm.tm_sec ^ tm.tm_sec)
Expand Down
4 changes: 1 addition & 3 deletions monit.pod
Expand Up @@ -476,9 +476,7 @@ for example by:
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
Expand Down

0 comments on commit 87d9ff9

Please sign in to comment.