[collectd] Patch: collectd hddtemp support
Vincent Stehlé
collectd@verplant.org
Sat, 08 Oct 2005 01:44:06 +0200
This is a multi-part message in MIME format.
--------------070105000804080403000700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Hi, folks,
I implemented collectd hddtemp support.
This enables one to record the temperature of hard disk drives,
providing a hddtemp daemon is running on the local machine.
Here is a patch against collectd 2.1.0.
I will update it to 3.0.0 ASAP.
Best regards,
--
Vincent Stehlé
--------------070105000804080403000700
Content-Type: text/plain;
name="patch-collectd-2.1.0-vs"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="patch-collectd-2.1.0-vs"
--- orig/AUTHORS
+++ mod/AUTHORS
@@ -1,6 +1,9 @@
This package was written by:
Florian octo Forster <octo@verplant.org>
+hddtemp support by:
+ Vincent Stehlé <vincent.stehle@free.fr>
+
It is available at:
http://verplant.org/collectd/
--- orig/ChangeLog
+++ mod/ChangeLog
@@ -1,3 +1,6 @@
+2005-09-29, Version 2.0.1-vs
+ * Module for hddtemp added by Vincent Stehlé <vincent.stehle@free.fr>.
+
2005-09-16, Version 2.0.1 (Revision 170)
* A module for swap statistics has been added.
--- orig/README
+++ mod/README
@@ -90,4 +90,3 @@
------
Florian octo Forster <octo at verplant.org>
-
--- orig/collectd.spec
+++ mod/collectd.spec
@@ -1,6 +1,6 @@
Summary: Statistics collection daemon for filling RRD files.
Name: collectd
-Version: 2.1.0
+Version: 2.1.0-vs
Release: 1
Source: http://verplant.org/collectd/%{name}-%{version}.tar.gz
License: GPL
@@ -48,6 +48,9 @@
%dir /var/lib/collectd
%changelog
+* Thr Sep 29 2005 Vincent Stehlé <vincent.stehle@free.fr> 2.0.1-vs
+- hddtemp support
+
* Mon Sep 10 2005 Florian octo Forster <octo@verplant.org> 2.0.0-1
- New upstream version
--- orig/configure
+++ mod/configure
@@ -1040,6 +1040,7 @@
--disable-sensors Disable lm_sensors statistics
--disable-swap Disable swap statistics
--disable-traffic Disable system traffic statistics
+ --disable-hddtemp Disable hdd temperature statistics
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1814,7 +1815,7 @@
# Define the identity of the package.
PACKAGE=collectd
- VERSION=2.1.0
+ VERSION=2.1.0-vs
cat >>confdefs.h <<_ACEOF
@@ -3963,7 +3964,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3966 "configure"' > conftest.$ac_ext
+ echo '#line 3967 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5293,7 +5294,7 @@
# Provide some information about the compiler.
-echo "$as_me:5296:" \
+echo "$as_me:5297:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6325,11 +6326,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6328: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6329: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6332: \$? = $ac_status" >&5
+ echo "$as_me:6333: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6558,11 +6559,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6561: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6562: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6565: \$? = $ac_status" >&5
+ echo "$as_me:6566: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6618,11 +6619,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6621: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6622: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6625: \$? = $ac_status" >&5
+ echo "$as_me:6626: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8806,7 +8807,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8809 "configure"
+#line 8810 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8904,7 +8905,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8907 "configure"
+#line 8908 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11081,11 +11082,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11084: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11085: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11088: \$? = $ac_status" >&5
+ echo "$as_me:11089: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -11141,11 +11142,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11144: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11145: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11148: \$? = $ac_status" >&5
+ echo "$as_me:11149: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12510,7 +12511,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12513 "configure"
+#line 12514 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12608,7 +12609,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12611 "configure"
+#line 12612 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13435,11 +13436,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13438: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13439: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13442: \$? = $ac_status" >&5
+ echo "$as_me:13443: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -13495,11 +13496,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13498: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13499: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13502: \$? = $ac_status" >&5
+ echo "$as_me:13503: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15540,11 +15541,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15543: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15544: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15547: \$? = $ac_status" >&5
+ echo "$as_me:15548: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15773,11 +15774,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15776: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15777: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15780: \$? = $ac_status" >&5
+ echo "$as_me:15781: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15833,11 +15834,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15836: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15837: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15840: \$? = $ac_status" >&5
+ echo "$as_me:15841: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18021,7 +18022,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18024 "configure"
+#line 18025 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18119,7 +18120,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18122 "configure"
+#line 18123 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23789,6 +23790,22 @@
fi
+# Check whether --enable-hddtemp or --disable-hddtemp was given.
+if test "${enable_hddtemp+set}" = set; then
+ enableval="$enable_hddtemp"
+
+else
+ enable_hddtemp="yes"
+fi;
+if test "x$enable_hddtemp" = "xno"
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define COLLECT_HDDTEMP 0
+_ACEOF
+
+fi
+
ac_config_files="$ac_config_files Makefile src/libping/Makefile src/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -25239,6 +25256,7 @@
sensors . . . . . . $enable_sensors
swap . . . . . . . $enable_swap
traffic . . . . . . $enable_traffic
+ hddtemp . . . . . . $enable_hddtemp
(*) Enabled features are not neccessarily compiled in. Wether or not a feature
is included depends on wether or not your system provides the required
--- orig/configure.in
+++ mod/configure.in
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/collectd.c)
-AM_INIT_AUTOMAKE(collectd, 2.1.0)
+AM_INIT_AUTOMAKE(collectd, 2.1.0-vs)
AM_CONFIG_HEADER(src/config.h src/libping/config.h)
AC_LANG(C)
@@ -194,6 +194,12 @@
AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
fi
+AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
+if test "x$enable_hddtemp" = "xno"
+then
+ AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
+fi
+
AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
cat <<EOF;
@@ -214,6 +220,7 @@
sensors . . . . . . $enable_sensors
swap . . . . . . . $enable_swap
traffic . . . . . . $enable_traffic
+ hddtemp . . . . . . $enable_hddtemp
(*) Enabled features are not neccessarily compiled in. Wether or not a feature
is included depends on wether or not your system provides the required
--- orig/src/Makefile.am
+++ mod/src/Makefile.am
@@ -11,7 +11,8 @@
ping.c ping.h \
sensors.c sensors.h \
swap.c swap.h \
- traffic.c traffic.h
+ traffic.c traffic.h \
+ hddtemp.c hddtemp.h
collectd_LDADD = libping/libping.la
--- orig/src/Makefile.in
+++ mod/src/Makefile.in
@@ -54,7 +54,7 @@
am_collectd_OBJECTS = collectd.$(OBJEXT) common.$(OBJEXT) \
cpu.$(OBJEXT) diskstats.$(OBJEXT) load.$(OBJEXT) \
meminfo.$(OBJEXT) ping.$(OBJEXT) sensors.$(OBJEXT) \
- swap.$(OBJEXT) traffic.$(OBJEXT)
+ swap.$(OBJEXT) traffic.$(OBJEXT) hddtemp.$(OBJEXT)
collectd_OBJECTS = $(am_collectd_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -I$(top_builddir)/src/libping
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -193,7 +193,8 @@
ping.c ping.h \
sensors.c sensors.h \
swap.c swap.h \
- traffic.c traffic.h
+ traffic.c traffic.h \
+ hddtemp.c hddtemp.h
collectd_LDADD = libping/libping.la
collectd_DEPENDENCIES = libping/libping.la
@@ -293,6 +294,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskstats.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hddtemp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meminfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ping.Po@am__quote@
--- orig/src/collectd.c
+++ mod/src/collectd.c
@@ -8,6 +8,7 @@
#include "sensors.h"
#include "swap.h"
#include "traffic.h"
+#include "hddtemp.h"
static int loop = 0;
static char basedir[PATH_MAX];
@@ -102,6 +103,9 @@
#if COLLECT_TRAFFIC
traffic_init ();
#endif
+#if COLLECT_HDDTEMP
+ hddtemp_init ();
+#endif
} /* init_all */
#ifdef HAVE_LIBKSTAT
@@ -151,8 +155,10 @@
" Sensors: %s\n"
" Swap: %s\n"
" Traffic: %s\n"
+ " Hddtemp: %s\n"
"\n%s %s, http://verplant.org/collectd/\n"
- "by Florian octo Forster <octo@verplant.org>\n",
+ "by Florian octo Forster <octo@verplant.org>\n"
+ "hddtemp support by Vincent Stehlé <vincent.stehle@free.fr>\n",
PACKAGE,
(COLLECT_CPU ? "yes" : "no"),
(COLLECT_DISK ? "yes" : "no"),
@@ -162,6 +168,7 @@
(COLLECT_SENSORS ? "yes" : "no"),
(COLLECT_SWAP ? "yes" : "no"),
(COLLECT_TRAFFIC ? "yes" : "no"),
+ (COLLECT_HDDTEMP ? "yes" : "no"),
PACKAGE, VERSION);
exit (0);
}
@@ -288,6 +295,9 @@
#if COLLECT_TRAFFIC
traffic_update ();
#endif
+#if COLLECT_HDDTEMP
+ hddtemp_update ();
+#endif
#if DEBUG
fputs ("Sleeping for 10 seconds\n", stdout);
--- orig/src/config.h.in
+++ mod/src/config.h.in
@@ -6,6 +6,9 @@
/* Wether or not to collect diskstats */
#undef COLLECT_DISK
+/* Wether or not to collect hdd temperature statistics */
+#undef COLLECT_HDDTEMP
+
/* Wether or not to collect system load statistics */
#undef COLLECT_LOAD
--------------070105000804080403000700--