aboutsummaryrefslogtreecommitdiff
path: root/plugins/common.h
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2007-04-25 22:10:13 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2007-04-25 22:10:13 +0000
commitd47be7a9e48242a25e356e2509f6fb774ae0be10 (patch)
tree1ea8e0185eda27100a26f43a98523f63695f2dfa /plugins/common.h
parent27a624dd9f929af1330be508762057fa4fa8a0f5 (diff)
downloadmonitoring-plugins-d47be7a9e48242a25e356e2509f6fb774ae0be10.tar.gz
check_load can optionally divide by number of cpus
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1700 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/common.h')
-rw-r--r--plugins/common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/common.h b/plugins/common.h
index dd9a0563..752e21ff 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -80,6 +80,18 @@
#include <unistd.h>
#endif
+/* GET_NUMBER_OF_CPUS is a macro to return
+ number of CPUs, if we can get that data.
+ Use configure.in to test for various OS ways of
+ 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)
+#else
+#define GET_NUMBER_OF_CPUS() -1
+#endif
+
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>