summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 20:47:00 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 20:47:00 (GMT)
commita0640011730d830c562c87ca0bc6237c404146ea (patch)
tree9f18f239eb6fe6efe95e9dca32c428830418868f
parent30aa7a63f1993ea09ba6ce84819d783f027ed516 (diff)
parentf12edfd07384be4060d5c724ac38ee212adc9028 (diff)
downloadmonitoring-plugins-a0640011730d830c562c87ca0bc6237c404146ea.tar.gz
Merge branch 'master' of https://github.com/bbense/nagios-plugins
* 'master' of https://github.com/bbense/nagios-plugins: Bug fix for ncpus if hyperthreading turned off in linux
-rw-r--r--configure.in14
-rw-r--r--plugins/common.h10
2 files changed, 18 insertions, 6 deletions
diff --git a/configure.in b/configure.in
index 43fe4ad..2be2a1c 100644
--- a/configure.in
+++ b/configure.in
@@ -1270,12 +1270,20 @@ fi
1270 1270
1271AC_MSG_CHECKING([for number of cpus]) 1271AC_MSG_CHECKING([for number of cpus])
1272AC_TRY_COMPILE([#include <unistd.h>], 1272AC_TRY_COMPILE([#include <unistd.h>],
1273 [sysconf(_SC_NPROCESSORS_CONF) > 0;], 1273 [sysconf(_SC_NPROCESSORS_ONLN) > 0;],
1274 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus]) 1274 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN,1,[Define if sysconf returns number of cpus])
1275 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]), 1275 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]),
1276 AC_MSG_RESULT([cannot calculate]) 1276 AC_MSG_RESULT([cannot calculate])
1277 ) 1277 )
1278 1278
1279AC_TRY_COMPILE([#include <unistd.h>],
1280 [sysconf(_SC_NPROCESSORS_CONF) > 0;],
1281 AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus])
1282 AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]),
1283 AC_MSG_RESULT([cannot calculate])
1284 )
1285
1286
1279AC_PATH_PROG(PATH_TO_UPTIME,uptime) 1287AC_PATH_PROG(PATH_TO_UPTIME,uptime)
1280AC_ARG_WITH(uptime_command, 1288AC_ARG_WITH(uptime_command,
1281 ACX_HELP_STRING([--with-uptime-command=PATH], 1289 ACX_HELP_STRING([--with-uptime-command=PATH],
diff --git a/plugins/common.h b/plugins/common.h
index c0dc2f4..858329f 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -82,10 +82,14 @@
82 getting that data 82 getting that data
83 Will return -1 if cannot get data 83 Will return -1 if cannot get data
84*/ 84*/
85#ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF 85#ifdef HAVE_SYSCONF__SC_NPROCESSORS_ONLN
86#define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF) 86#define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_ONLN)
87#else 87#else
88#define GET_NUMBER_OF_CPUS() -1 88# ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF
89# define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF)
90# else
91# define GET_NUMBER_OF_CPUS() -1
92# endif
89#endif 93#endif
90 94
91#ifdef TIME_WITH_SYS_TIME 95#ifdef TIME_WITH_SYS_TIME