Skip to content

Commit 60d1fd9

Browse files
committed
Add and enable WMI plugin.
1 parent 5b0dd36 commit 60d1fd9

File tree

6 files changed

+864
-1
lines changed

6 files changed

+864
-1
lines changed

Makefile.am

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,18 @@ disk_la_LIBADD += -lperfstat
838838
endif
839839
endif
840840

841+
if BUILD_PLUGIN_WMI
842+
pkglib_LTLIBRARIES += wmi.la
843+
wmi_la_SOURCES = \
844+
src/wmi.c \
845+
src/utils_wmi.c \
846+
src/utils_wmi.h
847+
wmi_la_CFLAGS = $(AM_CFLAGS)
848+
wmi_la_LDFLAGS = $(PLUGIN_LDFLAGS) -L.
849+
wmi_la_DEPENDENCIES = libuuid.dll
850+
wmi_la_LIBADD = -loleaut32 -lole32 -luuid libcollectd.la
851+
endif
852+
841853
if BUILD_PLUGIN_DNS
842854
pkglib_LTLIBRARIES += dns.la
843855
dns_la_SOURCES = \
@@ -2076,6 +2088,10 @@ install-exec-hook:
20762088
$(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(pkgdatadir)/types.db;
20772089
$(INSTALL) -m 0644 $(srcdir)/src/postgresql_default.conf \
20782090
$(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
2091+
if BUILD_WIN32
2092+
$(mkinstalldirs) "$(DESTDIR)$(sbindir)"
2093+
$(INSTALL) -m 0644 $(srcdir)/libuuid.dll "$(pkglibdir)/libuuid.dll"
2094+
endif
20792095

20802096
uninstall-hook:
20812097
rm -f $(DESTDIR)$(pkgdatadir)/types.db;
@@ -2084,6 +2100,11 @@ uninstall-hook:
20842100

20852101
all-local: @PERL_BINDINGS@
20862102

2103+
# Windows doesn't have a shared library for libuuid.dll, so we need to build
2104+
# a wrapper.
2105+
libuuid.dll:
2106+
${CC} -x c /dev/null -shared -o libuuid.dll -Wl,-whole-archive -luuid -Wl,-no-whole-archive
2107+
20872108
install-exec-local:
20882109
[ ! -f buildperl/Makefile ] || ( cd buildperl && $(MAKE) install )
20892110

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ build_windows ()
150150
--datarootdir="${DATADIR}" \
151151
--disable-all-plugins \
152152
--host="mingw32" \
153-
--enable-logfile
153+
--enable-logfile \
154+
--enable-wmi
154155

155156
cp ${GNULIB_DIR}/../config.h src/gnulib_config.h
156157
echo "#include <config.h.in>" >> src/gnulib_config.h

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6243,6 +6243,10 @@ if test "x$ac_system" = "xLinux"; then
62436243
fi
62446244
fi
62456245
6246+
if test "x$ac_system" = "xWindows"; then
6247+
plugin_wmi="yes"
6248+
fi
6249+
62466250
if test "x$ac_system" = "xOpenBSD"; then
62476251
plugin_tcpconns="yes"
62486252
fi
@@ -6666,6 +6670,7 @@ AC_PLUGIN([virt], [$plugin_virt], [Virtual machine sta
66666670
AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
66676671
AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
66686672
AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
6673+
AC_PLUGIN([wmi], [$plugin_wmi], [Windows Management Instrumentation])
66696674
AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
66706675
AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
66716676
AC_PLUGIN([write_kafka], [$with_librdkafka], [Kafka output plugin])
@@ -7084,6 +7089,7 @@ AC_MSG_RESULT([ virt . . . . . . . . $enable_virt])
70847089
AC_MSG_RESULT([ vmem . . . . . . . . $enable_vmem])
70857090
AC_MSG_RESULT([ vserver . . . . . . . $enable_vserver])
70867091
AC_MSG_RESULT([ wireless . . . . . . $enable_wireless])
7092+
AC_MSG_RESULT([ wmi . . . . . . . . . $enable_wmi])
70877093
AC_MSG_RESULT([ write_graphite . . . $enable_write_graphite])
70887094
AC_MSG_RESULT([ write_http . . . . . $enable_write_http])
70897095
AC_MSG_RESULT([ write_kafka . . . . . $enable_write_kafka])

0 commit comments

Comments
 (0)