aboutsummaryrefslogtreecommitdiff
path: root/plugins/common.h
diff options
context:
space:
mode:
authorGravatar Booker C. Bense <bbense@gmail.com> 2013-08-19 11:14:05 -0700
committerGravatar Booker C. Bense <bbense@gmail.com> 2013-08-19 11:14:05 -0700
commitf12edfd07384be4060d5c724ac38ee212adc9028 (patch)
tree099c7d0c1faac4670fe5b59d0f5b9e2f499f3f93 /plugins/common.h
parent64b4d1fb665005c9442361094e02cfd25aa15f43 (diff)
downloadmonitoring-plugins-f12edfd07384be4060d5c724ac38ee212adc9028.tar.gz
Bug fix for ncpus if hyperthreading turned off in linux
Diffstat (limited to 'plugins/common.h')
-rw-r--r--plugins/common.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/common.h b/plugins/common.h
index c0dc2f41..858329fd 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -82,10 +82,14 @@
getting that data
Will return -1 if cannot get data
*/
-#ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF
-#define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF)
+#ifdef HAVE_SYSCONF__SC_NPROCESSORS_ONLN
+#define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_ONLN)
#else
-#define GET_NUMBER_OF_CPUS() -1
+# ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF
+# define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF)
+# else
+# define GET_NUMBER_OF_CPUS() -1
+# endif
#endif
#ifdef TIME_WITH_SYS_TIME