summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56f8c6a)
raw | patch | inline | side by side (parent: 56f8c6a)
author | Evan Felix <e@pnnl.gov> | |
Thu, 18 Apr 2013 23:46:05 +0000 (16:46 -0700) | ||
committer | Evan Felix <e@pnnl.gov> | |
Thu, 18 Apr 2013 23:46:05 +0000 (16:46 -0700) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/collectd.conf.in | patch | blob | history | |
src/mic.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index a62d608bf21fe35ac40df7662f6c64ea67a24264..515c262113288efbf741e1cd8ded775e7799328a 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
fi
AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
-# }}}
+#
+ }}}
# --with-libdbi {{{
with_libdbi_cppflags=""
AC_SUBST(GANGLIA_LDFLAGS)
AC_SUBST(GANGLIA_LIBS)
AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
+
# }}}
# --with-libgcrypt {{{
AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
# }}}
+# --with-mic {{{
+with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
+with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
+with_mic_libs=""
+AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
+[
+ if test "x$withval" = "xno"
+ then
+ with_mic="no"
+ else if test "x$withval" = "xyes"
+ then
+ with_mic="yes"
+ else if test -d "$with_mic/lib"
+ then
+ AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
+ with_mic_cflags="-I$withval/include"
+ with_mic_ldpath="-L$withval/lib"
+ with_mic_libs="-lMicAccessSDK -lscif -lpthread"
+ with_mic="yes"
+ fi; fi; fi
+],
+[with_mic="yes"])
+if test "x$with_mic" = "xyes"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $with_mic_cflags"
+ AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
+ CFLAGS="$SAVE_CFLAGS"
+fi
+if test "x$with_mic" = "xyes"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ SAVE_LDFLAGS="$LDFLAGS"
+
+ CFLAGS="$CFLAGS $with_mic_cflags"
+ LDFLAGS="$LDFLAGS $with_mic_ldpath"
+
+ AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
+ [with_mic_ldpath="$with_mic_ldpath"
+ with_mic_libs="-lMicAccessSDK -lscif -lpthread"],
+ [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread])
+
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_mic" = "xyes"
+then
+ BUILD_WITH_MIC_CFLAGS="$with_mic_cflags"
+ BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
+ BUILD_WITH_MIC_LDADD="$with_mic_libs"
+ AC_SUBST(BUILD_WITH_MIC_CFLAGS)
+ AC_SUBST(BUILD_WITH_MIC_LIBPATH)
+ AC_SUBST(BUILD_WITH_MIC_LDADD)
+fi
+#}}}
+
# --with-libvarnish {{{
with_libvarnish_cppflags=""
with_libvarnish_cflags=""
AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
AC_PLUGIN([memcached], [yes], [memcached statistics])
AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
+AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats])
AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
libstatgrab . . . . . $with_libstatgrab
libtokyotyrant . . . $with_libtokyotyrant
libupsclient . . . . $with_libupsclient
+ mic . . . . . . . . $with_mic
libvarnish . . . . . $with_libvarnish
libvirt . . . . . . . $with_libvirt
libxml2 . . . . . . . $with_libxml2
diff --git a/src/Makefile.am b/src/Makefile.am
index 2bebec55c6d88ff320f94689c4eb795ead97a7cf..e0c1929c5517a29c7f7455cc9355abdcf3d29d06 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
collectd_DEPENDENCIES += uuid.la
endif
+if BUILD_PLUGIN_MIC
+pkglib_LTLIBRARIES += mic.la
+mic_la_SOURCES = mic.c
+mic_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_MIC_LIBPATH)
+mic_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_MIC_CFLAGS)
+mic_la_LIBADD = $(BUILD_WITH_MIC_LDADD)
+collectd_LDADD += "-dlopen" mic.la
+collectd_DEPENDENCIES += mic.la
+endif
+
if BUILD_PLUGIN_VARNISH
pkglib_LTLIBRARIES += varnish.la
varnish_la_SOURCES = varnish.c
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 5af15684092acb486b57d90023f7203da1a9abaa..89a1b2346512ceadeedc8856c5663d9268074661 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#@BUILD_PLUGIN_USERS_TRUE@LoadPlugin users
#@BUILD_PLUGIN_UUID_TRUE@LoadPlugin uuid
#@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish
+#@BUILD_PLUGIN_MIC_TRUE@LoadPlugin mic
#@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem
#@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver
#@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless
# UUIDFile "/etc/uuid"
#</Plugin>
+#<Plugin mic>
+#</Plugin>
+
#<Plugin varnish>
# This tag support an argument if you want to
# monitor the local instance just use </Instance>
diff --git a/src/mic.c b/src/mic.c
index efd7c1da559091b9a18872577d8980d741f05fcd..f299e942d3dc28231c2e940c1f5b57981e767d6a 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
#include <MicAccessTypes.h>
#include <MicAccessErrorTypes.h>
#include <MicAccessApi.h>
+#include <MicThermalAPI.h>
#define MAX_MICS 32
static MicDeviceOnSystem mics[MAX_MICS];
static U32 numMics = MAX_MICS;
static HANDLE micHandle=NULL;
+#define NUM_THERMS 7
+static const int therms[NUM_THERMS] = {eMicThermalDie,eMicThermalDevMem,eMicThermalFin,eMicThermalFout,eMicThermalVccp,eMicThermalVddg,eMicThermalVddq};
+static const char *thermNames[NUM_THERMS] = {"die","devmem","fin","fout","vccp","vddg","vddq"};
+
static int mic_init (void)
{
return (0);
}
-static void mic_submit_memory_use(int micnumber, char *type, gauge_t val)
+static void mic_submit_memory_use(int micnumber, const char *type, gauge_t val)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
plugin_dispatch_values (&vl);
}
+static void mic_submit_temp(int micnumber, const char *type, gauge_t val)
+{
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ values[0].gauge = val;
+
+ vl.values=values;
+ vl.values_len=1;
+
+ strncpy (vl.host, hostname_g, sizeof (vl.host));
+ strncpy (vl.plugin, "mic", sizeof (vl.plugin));
+ ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), "%i", micnumber);
+ strncpy (vl.type, "temperature", sizeof (vl.type));
+ strncpy (vl.type_instance, type, sizeof (vl.type_instance));
+
+ plugin_dispatch_values (&vl);
+}
+
+
static int mic_read (void)
{
- int i;
- U32 ret;
+ int i,j;
+ U32 ret,bufferSize;
+ U32 *tempBuffer;
int error;
U32 mem_total,mem_used,mem_bufs;
/* Gather memory Utilization */
ret = MicGetMemoryUtilization(micHandle,&mem_total,&mem_used,&mem_bufs);
if (ret != MIC_ACCESS_API_SUCCESS) {
- ERROR("Problem initializing MicAdapter: %s",MicGetErrorString(ret));
+ ERROR("Problem getting Memory Utilization: %s",MicGetErrorString(ret));
error=3;
break;
}
- mic_submit_memory_use(i,"total",mem_total);
- mic_submit_memory_use(i,"used",mem_used);
- mic_submit_memory_use(i,"bufs",mem_bufs);
+ /* API reprots KB's of memory, adjust for this */
+ mic_submit_memory_use(i,"total",mem_total*1024);
+ mic_submit_memory_use(i,"used",mem_used*1024);
+ mic_submit_memory_use(i,"bufs",mem_bufs*1024);
/*INFO("Memory Read: %u %u %u",mem_total,mem_used,mem_bufs);*/
+ /* Gather Temperature Information */
+ bufferSize = sizeof(U32);
+ tempBuffer = malloc(bufferSize);
+ for (j=0;j<NUM_THERMS;j++) {
+ ret = MicGetTemperature(micHandle,therms[j],tempBuffer,&bufferSize);
+ if (ret != MIC_ACCESS_API_SUCCESS) {
+ ERROR("Problem getting Temperature(%d) %s",j,MicGetErrorString(ret));
+ error=4;
+ break;
+ }
+ /*INFO("Temp Read: %u: %u %s",j,tempBuffer[0],thermNames[j]);*/
+ mic_submit_temp(i,thermNames[j],tempBuffer[0]);
+ }
+ if (error)
+ break;
+
ret = MicCloseAdapter(micHandle);
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("Problem initializing MicAdapter: %s",MicGetErrorString(ret));