[collectd] RESUBMIT: Patch: collectd 3.0.0 hddtemp support

Vincent Stehlé vincent.stehle at free.fr
Mon Oct 10 22:08:27 CEST 2005


Hi Florian,

I just finished to merge 2.1.0-vs and 3.0.0 this week-end, and now 
3.0.0-vs w/hddtemp support is ok, if I got your read/submit/write system 
correctly.

Here is a patch against 3.0.0.

I did not update the manpage, but would like to. How do you generate it, 
please?

Also, I think your multicast evolution is a good idea, but will come 
with its problems. For example, with hddtemp, let's say we have machine 
A and B submitting stats to machine C. They both have a /dev/hda. 
Machine C will try to write statistic to hddtemp-%dev%hda.rrd twice :/

What do you think? Shall we include the sender host name in the rrd 
filename, like hddtemp-A-%dev%hda.rrd?

Best regards,

-- 
Vincent Stehlé
-------------- next part --------------
diff -urN collectd--mainline--0.1--patch-1/AUTHORS collectd--vincent--0.1--patch-3/AUTHORS
--- collectd--mainline--0.1--patch-1/AUTHORS	2005-10-08 19:07:39.004972363 +0200
+++ collectd--vincent--0.1--patch-3/AUTHORS	2005-10-08 19:07:46.113645774 +0200
@@ -1,6 +1,9 @@
 This package was written by:
   Florian octo Forster <octo at verplant.org>
 
+hddtemp support by:
+  Vincent Stehlé <vincent.stehle at free.fr>
+
 It is available at:
   http://verplant.org/collectd/
 
diff -urN collectd--mainline--0.1--patch-1/ChangeLog collectd--vincent--0.1--patch-3/ChangeLog
--- collectd--mainline--0.1--patch-1/ChangeLog	2005-10-08 19:07:39.012970871 +0200
+++ collectd--vincent--0.1--patch-3/ChangeLog	2005-10-08 19:07:47.831325228 +0200
@@ -1,3 +1,6 @@
+2005-10-08, Version 3.0.0-vs
+	* Module for hddtemp added by Vincent Stehlé <vincent.stehle at free.fr>.
+
 2005-09-30, Version 3.0.0 (Revision 184)
 	* The ability to send/receive data to/from the network (sung
 	  multicast) has been added.
diff -urN collectd--mainline--0.1--patch-1/Makefile.in collectd--vincent--0.1--patch-3/Makefile.in
--- collectd--mainline--0.1--patch-1/Makefile.in	2005-10-08 19:07:39.023968818 +0200
+++ collectd--vincent--0.1--patch-3/Makefile.in	2005-10-08 19:07:49.423028190 +0200
@@ -85,6 +85,8 @@
 BUILD_MODULE_CPU_TRUE = @BUILD_MODULE_CPU_TRUE@
 BUILD_MODULE_DISK_FALSE = @BUILD_MODULE_DISK_FALSE@
 BUILD_MODULE_DISK_TRUE = @BUILD_MODULE_DISK_TRUE@
+BUILD_MODULE_HDDTEMP_FALSE = @BUILD_MODULE_HDDTEMP_FALSE@
+BUILD_MODULE_HDDTEMP_TRUE = @BUILD_MODULE_HDDTEMP_TRUE@
 BUILD_MODULE_LOAD_FALSE = @BUILD_MODULE_LOAD_FALSE@
 BUILD_MODULE_LOAD_TRUE = @BUILD_MODULE_LOAD_TRUE@
 BUILD_MODULE_MEMORY_FALSE = @BUILD_MODULE_MEMORY_FALSE@
diff -urN collectd--mainline--0.1--patch-1/README collectd--vincent--0.1--patch-3/README
--- collectd--mainline--0.1--patch-1/README	2005-10-08 19:07:39.028967885 +0200
+++ collectd--vincent--0.1--patch-3/README	2005-10-08 19:07:47.874317205 +0200
@@ -95,4 +95,3 @@
 ------
 
   Florian octo Forster <octo at verplant.org>
-
diff -urN collectd--mainline--0.1--patch-1/collectd.spec collectd--vincent--0.1--patch-3/collectd.spec
--- collectd--mainline--0.1--patch-1/collectd.spec	2005-10-08 19:07:39.813821420 +0200
+++ collectd--vincent--0.1--patch-3/collectd.spec	2005-10-08 19:07:47.893313660 +0200
@@ -1,6 +1,6 @@
 Summary:	Statistics collection daemon for filling RRD files.
 Name:           collectd
-Version:	3.0.0
+Version:	3.0.0-vs
 Release:	1
 Source:		http://verplant.org/collectd/%{name}-%{version}.tar.gz
 License:	GPL
@@ -60,12 +60,16 @@
 %attr(0444,root,root) %{_libdir}/%{name}/ping.so*
 %attr(0444,root,root) %{_libdir}/%{name}/swap.so*
 %attr(0444,root,root) %{_libdir}/%{name}/traffic.so*
+%attr(0444,root,root) %{_libdir}/%{name}/hddtemp.so*
 %dir /var/lib/collectd
 
 %files sensors
 %attr(0444,root,root) %{_libdir}/%{name}/sensors.so*
 
 %changelog
+* Thr Oct 08 2005 Vincent Stehlé <vincent.stehle at free.fr> 3.0.0-1-vs
+- hddtemp support
+
 * Fri Sep 30 2005 Florian octo Forster <octo at verplant.org> 3.0.0-1
 - New upstream version
 - Split the package into `collectd' and `collectd-sensors'
diff -urN collectd--mainline--0.1--patch-1/configure collectd--vincent--0.1--patch-3/configure
--- collectd--mainline--0.1--patch-1/configure	2005-10-08 19:07:39.154944376 +0200
+++ collectd--vincent--0.1--patch-3/configure	2005-10-08 19:07:49.506012704 +0200
@@ -463,7 +463,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP LN_S build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL BUILD_MODULE_CPU_TRUE BUILD_MODULE_CPU_FALSE BUILD_MODULE_DISK_TRUE BUILD_MODULE_DISK_FALSE BUILD_MODULE_LOAD_TRUE BUILD_MODULE_LOAD_FALSE BUILD_MODULE_MEMORY_TRUE BUILD_MODULE_MEMORY_FALSE BUILD_MODULE_PING_TRUE BUILD_MODULE_PING_FALSE BUILD_MODULE_SENSORS_TRUE BUILD_MODULE_SENSORS_FALSE BUILD_MODULE_SWAP_TRUE BUILD_MODULE_SWAP_FALSE BUILD_MODULE_TRAFFIC_TRUE BUILD_MODULE_TRAFFIC_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP LN_S build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL BUILD_MODULE_CPU_TRUE BUILD_MODULE_CPU_FALSE BUILD_MODULE_DISK_TRUE BUILD_MODULE_DISK_FALSE BUILD_MODULE_LOAD_TRUE BUILD_MODULE_LOAD_FALSE BUILD_MODULE_MEMORY_TRUE BUILD_MODULE_MEMORY_FALSE BUILD_MODULE_PING_TRUE BUILD_MODULE_PING_FALSE BUILD_MODULE_SENSORS_TRUE BUILD_MODULE_SENSORS_FALSE BUILD_MODULE_SWAP_TRUE BUILD_MODULE_SWAP_FALSE BUILD_MODULE_TRAFFIC_TRUE BUILD_MODULE_TRAFFIC_FALSE BUILD_MODULE_HDDTEMP_TRUE BUILD_MODULE_HDDTEMP_FALSE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -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=3.0.0
+ VERSION=3.0.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
@@ -24159,6 +24160,32 @@
 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
+
+
+if test "x$enable_hddtemp" = "xyes"; then
+  BUILD_MODULE_HDDTEMP_TRUE=
+  BUILD_MODULE_HDDTEMP_FALSE='#'
+else
+  BUILD_MODULE_HDDTEMP_TRUE='#'
+  BUILD_MODULE_HDDTEMP_FALSE=
+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
@@ -24328,6 +24355,13 @@
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${BUILD_MODULE_HDDTEMP_TRUE}" && test -z "${BUILD_MODULE_HDDTEMP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_MODULE_HDDTEMP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MODULE_HDDTEMP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
@@ -24944,6 +24978,8 @@
 s, at BUILD_MODULE_SWAP_FALSE@,$BUILD_MODULE_SWAP_FALSE,;t t
 s, at BUILD_MODULE_TRAFFIC_TRUE@,$BUILD_MODULE_TRAFFIC_TRUE,;t t
 s, at BUILD_MODULE_TRAFFIC_FALSE@,$BUILD_MODULE_TRAFFIC_FALSE,;t t
+s, at BUILD_MODULE_HDDTEMP_TRUE@,$BUILD_MODULE_HDDTEMP_TRUE,;t t
+s, at BUILD_MODULE_HDDTEMP_FALSE@,$BUILD_MODULE_HDDTEMP_FALSE,;t t
 s, at LIBOBJS@,$LIBOBJS,;t t
 s, at LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
@@ -25681,5 +25717,6 @@
     sensors . . . . . . $enable_sensors
     swap  . . . . . . . $enable_swap
     traffic . . . . . . $enable_traffic
+    hddtemp . . . . . . $enable_hddtemp
 
 EOF
diff -urN collectd--mainline--0.1--patch-1/configure.in collectd--vincent--0.1--patch-3/configure.in
--- collectd--mainline--0.1--patch-1/configure.in	2005-10-08 19:07:39.158943630 +0200
+++ collectd--vincent--0.1--patch-3/configure.in	2005-10-08 19:07:49.361039758 +0200
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/collectd.c)
-AM_INIT_AUTOMAKE(collectd, 3.0.0)
+AM_INIT_AUTOMAKE(collectd, 3.0.0-vs)
 AM_CONFIG_HEADER(src/config.h src/libping/config.h)
 AC_LANG(C)
 
@@ -280,6 +280,13 @@
 fi
 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
 
+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
+AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
+
 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
 
 cat <<EOF;
@@ -300,5 +307,6 @@
     sensors . . . . . . $enable_sensors
     swap  . . . . . . . $enable_swap
     traffic . . . . . . $enable_traffic
+    hddtemp . . . . . . $enable_hddtemp
 
 EOF
diff -urN collectd--mainline--0.1--patch-1/src/Makefile.am collectd--vincent--0.1--patch-3/src/Makefile.am
--- collectd--mainline--0.1--patch-1/src/Makefile.am	2005-10-08 19:07:39.515877021 +0200
+++ collectd--vincent--0.1--patch-3/src/Makefile.am	2005-10-08 19:07:48.133268880 +0200
@@ -63,6 +63,12 @@
 traffic_la_LDFLAGS = -module
 endif
 
+if BUILD_MODULE_HDDTEMP
+pkglib_LTLIBRARIES += hddtemp.la
+hddtemp_la_SOURCES = hddtemp.c hddtemp.h
+hddtemp_la_LDFLAGS = -module
+endif
+
 man_MANS = collectd.1
 
 EXTRA_DIST = $(man_MANS)
diff -urN collectd--mainline--0.1--patch-1/src/Makefile.in collectd--vincent--0.1--patch-3/src/Makefile.in
--- collectd--mainline--0.1--patch-1/src/Makefile.in	2005-10-08 19:07:39.521875901 +0200
+++ collectd--vincent--0.1--patch-3/src/Makefile.in	2005-10-08 19:07:49.520010092 +0200
@@ -46,6 +46,7 @@
 @BUILD_MODULE_SENSORS_TRUE at am__append_6 = sensors.la
 @BUILD_MODULE_SWAP_TRUE at am__append_7 = swap.la
 @BUILD_MODULE_TRAFFIC_TRUE at am__append_8 = traffic.la
+ at BUILD_MODULE_HDDTEMP_TRUE@am__append_9 = hddtemp.la
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
 	$(srcdir)/config.h.in
@@ -76,6 +77,11 @@
 @BUILD_MODULE_DISK_TRUE at am_disk_la_OBJECTS = disk.lo
 disk_la_OBJECTS = $(am_disk_la_OBJECTS)
 @BUILD_MODULE_DISK_TRUE at am_disk_la_rpath = -rpath $(pkglibdir)
+hddtemp_la_LIBADD =
+am__hddtemp_la_SOURCES_DIST = hddtemp.c hddtemp.h
+ at BUILD_MODULE_HDDTEMP_TRUE@am_hddtemp_la_OBJECTS = hddtemp.lo
+hddtemp_la_OBJECTS = $(am_hddtemp_la_OBJECTS)
+ at BUILD_MODULE_HDDTEMP_TRUE@am_hddtemp_la_rpath = -rpath $(pkglibdir)
 load_la_LIBADD =
 am__load_la_SOURCES_DIST = load.c load.h
 @BUILD_MODULE_LOAD_TRUE at am_load_la_OBJECTS = load.lo
@@ -123,14 +129,15 @@
 CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(cpu_la_SOURCES) $(disk_la_SOURCES) $(load_la_SOURCES) \
-	$(memory_la_SOURCES) $(ping_la_SOURCES) $(sensors_la_SOURCES) \
-	$(swap_la_SOURCES) $(traffic_la_SOURCES) $(collectd_SOURCES)
-DIST_SOURCES = $(am__cpu_la_SOURCES_DIST) $(am__disk_la_SOURCES_DIST) \
-	$(am__load_la_SOURCES_DIST) $(am__memory_la_SOURCES_DIST) \
-	$(am__ping_la_SOURCES_DIST) $(am__sensors_la_SOURCES_DIST) \
-	$(am__swap_la_SOURCES_DIST) $(am__traffic_la_SOURCES_DIST) \
+SOURCES = $(cpu_la_SOURCES) $(disk_la_SOURCES) $(hddtemp_la_SOURCES) \
+	$(load_la_SOURCES) $(memory_la_SOURCES) $(ping_la_SOURCES) \
+	$(sensors_la_SOURCES) $(swap_la_SOURCES) $(traffic_la_SOURCES) \
 	$(collectd_SOURCES)
+DIST_SOURCES = $(am__cpu_la_SOURCES_DIST) $(am__disk_la_SOURCES_DIST) \
+	$(am__hddtemp_la_SOURCES_DIST) $(am__load_la_SOURCES_DIST) \
+	$(am__memory_la_SOURCES_DIST) $(am__ping_la_SOURCES_DIST) \
+	$(am__sensors_la_SOURCES_DIST) $(am__swap_la_SOURCES_DIST) \
+	$(am__traffic_la_SOURCES_DIST) $(collectd_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-exec-recursive install-info-recursive \
@@ -157,6 +164,8 @@
 BUILD_MODULE_CPU_TRUE = @BUILD_MODULE_CPU_TRUE@
 BUILD_MODULE_DISK_FALSE = @BUILD_MODULE_DISK_FALSE@
 BUILD_MODULE_DISK_TRUE = @BUILD_MODULE_DISK_TRUE@
+BUILD_MODULE_HDDTEMP_FALSE = @BUILD_MODULE_HDDTEMP_FALSE@
+BUILD_MODULE_HDDTEMP_TRUE = @BUILD_MODULE_HDDTEMP_TRUE@
 BUILD_MODULE_LOAD_FALSE = @BUILD_MODULE_LOAD_FALSE@
 BUILD_MODULE_LOAD_TRUE = @BUILD_MODULE_LOAD_TRUE@
 BUILD_MODULE_MEMORY_FALSE = @BUILD_MODULE_MEMORY_FALSE@
@@ -266,7 +275,7 @@
 collectd_LDFLAGS = -rdynamic -lrrd
 pkglib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \
 	$(am__append_4) $(am__append_5) $(am__append_6) \
-	$(am__append_7) $(am__append_8)
+	$(am__append_7) $(am__append_8) $(am__append_9)
 @BUILD_MODULE_CPU_TRUE at cpu_la_SOURCES = cpu.c cpu.h
 @BUILD_MODULE_CPU_TRUE at cpu_la_LDFLAGS = -module
 @BUILD_MODULE_DISK_TRUE at disk_la_SOURCES = disk.c disk.h
@@ -285,6 +294,8 @@
 @BUILD_MODULE_SWAP_TRUE at swap_la_LDFLAGS = -module
 @BUILD_MODULE_TRAFFIC_TRUE at traffic_la_SOURCES = traffic.c traffic.h
 @BUILD_MODULE_TRAFFIC_TRUE at traffic_la_LDFLAGS = -module
+ at BUILD_MODULE_HDDTEMP_TRUE@hddtemp_la_SOURCES = hddtemp.c hddtemp.h
+ at BUILD_MODULE_HDDTEMP_TRUE@hddtemp_la_LDFLAGS = -module
 man_MANS = collectd.1
 EXTRA_DIST = $(man_MANS)
 all: config.h
@@ -369,6 +380,8 @@
 	$(LINK) $(am_cpu_la_rpath) $(cpu_la_LDFLAGS) $(cpu_la_OBJECTS) $(cpu_la_LIBADD) $(LIBS)
 disk.la: $(disk_la_OBJECTS) $(disk_la_DEPENDENCIES) 
 	$(LINK) $(am_disk_la_rpath) $(disk_la_LDFLAGS) $(disk_la_OBJECTS) $(disk_la_LIBADD) $(LIBS)
+hddtemp.la: $(hddtemp_la_OBJECTS) $(hddtemp_la_DEPENDENCIES) 
+	$(LINK) $(am_hddtemp_la_rpath) $(hddtemp_la_LDFLAGS) $(hddtemp_la_OBJECTS) $(hddtemp_la_LIBADD) $(LIBS)
 load.la: $(load_la_OBJECTS) $(load_la_DEPENDENCIES) 
 	$(LINK) $(am_load_la_rpath) $(load_la_LDFLAGS) $(load_la_OBJECTS) $(load_la_LIBADD) $(LIBS)
 memory.la: $(memory_la_OBJECTS) $(memory_la_DEPENDENCIES) 
@@ -425,6 +438,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/collectd-plugin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/disk.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hddtemp.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/load.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/memory.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ping.Plo at am__quote@
diff -urN collectd--mainline--0.1--patch-1/src/collectd.c collectd--vincent--0.1--patch-3/src/collectd.c
--- collectd--mainline--0.1--patch-1/src/collectd.c	2005-10-08 19:07:39.530874222 +0200
+++ collectd--vincent--0.1--patch-3/src/collectd.c	2005-10-08 19:07:48.199256566 +0200
@@ -105,7 +105,8 @@
 			"                    more than one host.\n"
 #endif /* COLLECT_PING */
 			"\n%s %s, http://verplant.org/collectd/\n"
-			"by Florian octo Forster <octo at verplant.org>\n",
+			"by Florian octo Forster <octo at verplant.org>\n"
+			"hddtemp support by Vincent Stehlé <vincent.stehle at free.fr>\n",
 			PACKAGE, PACKAGE, VERSION);
 	exit (0);
 }
diff -urN collectd--mainline--0.1--patch-1/src/config.h.in collectd--vincent--0.1--patch-3/src/config.h.in
--- collectd--mainline--0.1--patch-1/src/config.h.in	2005-10-08 19:07:39.542871983 +0200
+++ collectd--vincent--0.1--patch-3/src/config.h.in	2005-10-08 19:07:48.278241826 +0200
@@ -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
 
diff -urN collectd--mainline--0.1--patch-1/src/hddtemp.c collectd--vincent--0.1--patch-3/src/hddtemp.c
--- collectd--mainline--0.1--patch-1/src/hddtemp.c	1970-01-01 01:00:00.000000000 +0100
+++ collectd--vincent--0.1--patch-3/src/hddtemp.c	2005-10-08 19:07:48.338230631 +0200
@@ -0,0 +1,583 @@
+/* hddtemp "collector" for collectd 
+   Author: Vincent Stehlé <vincent.stehle at free.fr>
+
+
+   This program is free software; you can distribute it and/or modify it
+   under the terms of the GNU General Public License (Version 2) as
+   published by the Free Software Foundation.
+
+   This program is distributed in the hope it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+
+
+   The following data sources are stored in each disk's rrd file:
+     temperature: Hard disk temperature, in whatever unit the daemon
+                  reported. Currently, your best bet is that this is °C.
+     code:        The status reported from the hddtemp daemon, as coded in
+                  our manner, in [0 : 5] (see the enum for details).
+
+   Here is a sample command to graph the stored rrd:
+
+   rrdtool graph temperature.png \
+     DEF:t=$rrd:temperature:MAX \
+     LINE2:t#7777ff:temperature \
+     DEF:c=$rrd:code:MAX \
+     LINE2:c#ff0000:code
+
+   You will notice that while the drive sleeps, the temperature is unknown.
+
+*/
+
+#include "hddtemp.h"
+
+#if COLLECT_HDDTEMP
+#define MODULE_NAME "hddtemp"
+
+#include "plugin.h"
+#include "common.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <string.h>
+#include <errno.h>
+#include <syslog.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* LOCALHOST_ADDR
+   The ip address 127.0.0.1, as a 32 bit. */
+
+#define LOCALHOST_ADDR ((127 << 24) | 1)
+
+/* HDDTEMP_PORT
+   The tcp port the hddtemp daemon is listening on. */
+
+#define HDDTEMP_PORT 7634
+
+/* BUFFER_SIZE
+   Size of the buffer we use to receive from the hddtemp daemon. */
+
+#define BUFFER_SIZE 1024
+
+/* DEVICE_NAME_SIZE
+   Maximum size for a disk device name, including terminating \0. */
+
+#define DEVICE_NAME_SIZE 32
+
+/* MODEL_NAME_SIZE
+   Maximum size for a disk model name, including terminating \0. */
+
+#define MODEL_NAME_SIZE 32
+
+/* CODE_STRING_SIZE
+   Maximum size for a hddtemp code, including terminating \0. */
+
+#define CODE_STRING_SIZE 4
+
+/* UNIT_STRING_SIZE
+   Maximum size for temperature unit, including terminating \0. */
+
+#define UNIT_STRING_SIZE 2
+
+/* hddtemp_code
+   Enum, corresponding to hddtemp "return code". */
+
+enum hddtemp_code {
+	KNOWN			= 0,
+	NOT_APPLICABLE	= 1,
+	UNKNOWN 		= 2,
+	NOSENSOR		= 3,
+	DRIVE_SLEEP 	= 4,
+	ERROR			= 5
+};
+
+/* disk_infos
+   The structure we use to handle per-disk information.
+
+   Fields worth describing:
+     device_name: disk device. e.g. /dev/hda
+     model_name:  disk model. e.g. ST340014A
+     unit:        temperature unit. e.g. C 
+
+   Note: the temperature is only valid when the hddtemp code is "KNOWN".
+
+ */
+
+struct disk_infos {
+	int temperature;
+	enum hddtemp_code code;
+	char device_name[DEVICE_NAME_SIZE],
+		model_name[MODEL_NAME_SIZE],
+		code_as_string[CODE_STRING_SIZE],
+		unit[UNIT_STRING_SIZE];
+};
+
+/* buffer
+   The buffer we use to receive data from the hddtemp daemon. */
+
+static char buffer[BUFFER_SIZE];
+
+/* num_disks
+   Number of disks in the system, or < 0 if an error happened */
+
+static int num_disks;
+
+/* disks_infos
+   Buffer to hold all disks informations. */
+
+static struct disk_infos *disks_infos;
+
+/* debug
+   debug printing, when DEBUG is defined */
+
+static void debug(const char *message)
+{
+#	if DEBUG
+	syslog(LOG_ERR, message);
+#	endif
+}
+
+/* ask_hddtemp_daemon_for_data
+   Connect to the hddtemp daemon and receive data.
+
+   Parameters:
+     buffer:      the buffer where we put the received ascii string.
+     buffer_size: size of the buffer
+
+   Return value:
+     >= 0 if ok, < 0 otherwise.
+
+   Example of possible strings, as received from daemon:
+
+	   |/dev/hda|ST340014A|36|C|
+	   |/dev/hda|ST380011A|46|C||/dev/hdd|ST340016A|SLP|*|
+
+   Note: we need to create a new socket each time. Is there another way? */
+
+static int ask_hddtemp_daemon_for_data(char *buffer, unsigned buffer_size)
+{
+	int sock;
+	size_t size;
+	const struct sockaddr_in addr = {
+		AF_INET,					/* sin_family */
+		htons(HDDTEMP_PORT),		/* sin_port */
+		{							/* sin_addr */
+			htonl(LOCALHOST_ADDR),	/* s_addr */
+		}
+	};
+
+	/* create our socket descriptor */
+
+	sock = socket(PF_INET, SOCK_STREAM, 0);
+
+	if(sock == -1){
+		syslog (LOG_ERR, "hddtemp: could not create socket! %s",
+			strerror (errno));
+		return -1;
+	}
+
+	/* connect to the hddtemp daemon */
+
+	if(connect(sock, (const struct sockaddr *)&addr, sizeof(addr)) != 0){
+		syslog (LOG_ERR, "hddtemp: could not connect to the hddtemp daemon! %s",
+			strerror (errno));
+		goto error;
+	}
+
+	/* receive data from the hddtemp daemon
+	   TODO: handle case when there is more data than buffer size */
+
+#	if DEBUG
+	memset(buffer, 0xba, buffer_size);
+#	endif
+
+	size = recv(sock, buffer, (buffer_size - 1), 0);
+
+	if(size <= 0){
+		syslog (LOG_ERR,
+			"hddtemp: could not receive from the hddtemp daemon! %s",
+			strerror (errno));
+		goto error;
+	}
+
+	/* ensure null-terminated string */
+	buffer[size] = '\0';
+	debug("hddtemp: received:");
+	debug(buffer);
+
+	return 0;
+
+error:
+	/* close our socket and exit */
+
+	if(close(sock) != 0){
+		/* even close does'nt work. there are days like this one... */
+		syslog (LOG_ERR, "hddtemp: could not close socket! %s",
+			strerror (errno));
+	}
+
+	return -1;
+}
+
+/* count_bars
+   Count the number of '|' in a string. */
+
+static unsigned count_bars(const char *p)
+{
+	unsigned u = 0;
+
+	for(; *p; p++)
+		if(*p == '|')
+			u++;
+
+	return u;
+}
+
+/* find_number_of_disks
+   Parse the received string and determine the number of disks in the system.
+
+   Return value:
+     Number of disk(s) found if ok, < 0 otherwise. */
+
+static int find_number_of_disks(const char *string)
+{
+	unsigned num_disks, num_bars;
+
+	/* there are five bars per disk; deduce number of disks */
+	num_bars = count_bars(string);
+	num_disks = num_bars / 5;
+
+	/* check everything is ok */
+	if((num_disks * 5) != num_bars)
+		return -1;
+
+	return (int)num_disks;
+}
+
+/* extract_field
+   Extract a field between |.
+
+   Returned value:
+     NULL in case of error,
+     string, advanced to the next delimiter if ok.
+
+   Note: we terminate field with a \0. */
+
+static const char *extract_field(const char *string, char *buffer, unsigned buffer_size)
+{
+	const char *d;
+	unsigned s;
+
+	/* skip first | */
+	if(*string++ != '|')
+		return NULL;
+
+	/* extract field */
+	d = strchr(string, '|');
+
+	if(!d)
+		return NULL;
+
+	s = d - string;
+
+	if(!s)
+		return NULL;
+
+	/* prevent overflow */
+	s = (s > (buffer_size - 1)) ? (buffer_size - 1) : s;
+
+	/* copy, \0-terminated */
+	strncpy(buffer, string, s);
+	buffer[s] = '\0';
+
+	/* advance to next delimiter */
+	return d;
+}
+
+/* extract_single_disk_infos
+   Extract one disk information from the received string.
+
+   Returned value:
+     string, advanced just after what we parsed if ok,
+     NULL if error. */
+
+static const char *extract_single_disk_infos(const char *string, struct disk_infos *p)
+{
+	const char *d;
+	unsigned s;
+	char temp[5];
+
+	/* check first |, but do not skip */
+	if(*string != '|')
+		return NULL;
+
+	/* extract device */
+	string = extract_field(string, p->device_name, DEVICE_NAME_SIZE);
+
+	if(!string)
+		return NULL;
+
+	debug("hddtemp: device name:");
+	debug(p->device_name);
+
+	/* extract model */
+	string = extract_field(string, p->model_name, MODEL_NAME_SIZE);
+
+	if(!string)
+		return NULL;
+
+	debug("hddtemp: model name:");
+	debug(p->model_name);
+
+	/* extract code/temperature as string, to intermediate buffer */
+	string = extract_field(string, temp, 5);
+
+	if(!string)
+		return NULL;
+
+	debug("hddtemp: code/temperature:");
+	debug(temp);
+
+	/* parse code, and temperature */
+
+	if(!strcmp(temp, "NA")){
+		p->code = NOT_APPLICABLE;
+		strcpy(p->code_as_string, temp);
+		p->temperature = 0;
+
+	} else if(!strcmp(temp, "UNK")){
+		p->code = UNKNOWN;
+		strcpy(p->code_as_string, temp);
+		p->temperature = 0;
+
+	} else if(!strcmp(temp, "NOS")){
+		p->code = NOSENSOR;
+		strcpy(p->code_as_string, temp);
+		p->temperature = 0;
+
+	} else if(!strcmp(temp, "SLP")){
+		p->code = DRIVE_SLEEP;
+		strcpy(p->code_as_string, temp);
+		p->temperature = 0;
+
+	} else if(!strcmp(temp, "ERR")){
+		p->code = ERROR;
+		strcpy(p->code_as_string, temp);
+		p->temperature = 0;
+
+	} else {
+		/* assume valid temperature */
+		p->code = KNOWN;
+		p->temperature = atoi(temp);
+	}
+
+	/* extract unit */
+	string = extract_field(string, p->unit, UNIT_STRING_SIZE);
+
+	if(!string)
+		return NULL;
+
+	debug("hddtemp: unit:");
+	debug(p->unit);
+
+	/* check last | */
+	if(*string++ != '|')
+		return NULL;
+
+	return string;
+}
+
+/* extract_all_disks_infos
+   Extract all disks information from the received string.
+
+   Parameters worth describing:
+     n: awaited number of disks
+
+   Returned value:
+     >= 0 if ok, < 0 otherwise. */
+
+static int extract_all_disks_infos(const char *string, unsigned n,
+	struct disk_infos *p)
+{
+	unsigned u;
+
+	for(u = 0; u < n; u++){
+		string = extract_single_disk_infos(string, p);
+
+		if(!string)
+			return -1;
+
+		p++;
+	}
+
+	return 0;
+}
+
+/* submit_single_hddtemp_statistics
+   Submit hddtemp statistics for one disk.
+   
+   Note:
+     We prepare our string so that it can be used as-is
+     for later rrd update. */
+
+static void submit_single_hddtemp_statistics(const struct disk_infos *p)
+{
+	extern time_t curtime;
+	char buf[512];
+
+	/* construct rrd data */
+
+	if(p->code == KNOWN)
+		snprintf (buf, 512, "%u:%i:%u", (unsigned int)curtime, p->temperature, p->code);
+
+	else
+		snprintf (buf, 512, "%u:U:%u", (unsigned int)curtime, p->code);
+
+	buffer[511] = '\0';
+	plugin_submit (MODULE_NAME, p->device_name, buf);
+}
+
+/* submit_all_hddtemp_statistics
+   Submit hddtemp statistics for all disks.
+
+   Parameters worth describing:
+     n: number of disks */
+
+static void submit_all_hddtemp_statistics(const struct disk_infos *p, unsigned n)
+{
+	unsigned u;
+
+	for(u = 0; u < n; u++)
+		submit_single_hddtemp_statistics(p + u);
+}
+
+/* hddtemp_init
+   Initialize everything needed for hddtemp "collector".
+   Note: we do not touch the rrd file here. */
+
+static void hddtemp_init (void)
+{
+	debug("hddtemp: hddtemp_init");
+
+	/* get data from daemon */
+
+	if(ask_hddtemp_daemon_for_data(buffer, BUFFER_SIZE) < 0){
+		syslog (LOG_ERR, "hddtemp: could not receive from daemon!");
+		num_disks = -1;
+		return;
+	}
+
+	/* find out number of disks in the system */
+
+	num_disks = find_number_of_disks(buffer);
+
+	if(num_disks < 0){
+		syslog (LOG_ERR, "hddtemp: could not determine number of disks!");
+		return;
+
+	} else if(num_disks == 0){
+		syslog (LOG_INFO, "hddtemp: zero disk found.");
+		return;
+
+	} else {
+		syslog (LOG_INFO, "hddtemp: found %u disk(s).", num_disks);
+	}
+
+	/* allocate memory accordingly */
+
+	disks_infos = malloc(num_disks * sizeof(struct disk_infos));
+
+	if(!disks_infos){
+		syslog (LOG_ERR, "hddtemp: could not allocate memory ! %s", strerror(errno));
+		num_disks = -1;
+	}
+}
+
+/* hddtemp_read
+   Read hddtemp statistics for all disks and submit them to collectd. */
+
+static void hddtemp_read (void)
+{
+	debug("hddtemp: hddtemp_update");
+
+	/* early exit, in case init failed, or no disk */
+
+	if(num_disks <= 0){
+		debug("early exit");
+		return;
+	}
+
+	/* get data from daemon */
+
+	if(ask_hddtemp_daemon_for_data(buffer, BUFFER_SIZE) < 0){
+		syslog (LOG_ERR, "hddtemp: could not receive from daemon!");
+		return;
+	}
+
+	/* parse data */
+
+	if(extract_all_disks_infos(buffer, num_disks, disks_infos) < 0){
+		syslog (LOG_ERR, "hddtemp: could not parse data from daemon!");
+		return;
+	}
+
+	/* submit all statistics to collectd */
+	submit_all_hddtemp_statistics(disks_infos, num_disks);
+}
+
+/* substitute_slashes
+   Substitute all / by %, in place. */
+
+static void substitute_slashes(char *p)
+{
+	for(; *p; p++)
+		if(*p == '/')
+			*p = '%';
+}
+
+/* hddtemp_write
+   Write the hddtemp statistics received back from collectd
+   to rrd file.
+
+   TODO: find a way to store drive name, model, as well as
+         temperature units in the rrd file in a convenient way. */
+
+static void hddtemp_write (char *host, char *inst, char *val)
+{
+	static const char *ds_def[] = {
+		"DS:temperature:GAUGE:25:U:U",
+		"DS:code:GAUGE:25:0:5", 		/* sync. with codes */
+		NULL
+	};
+	char cleaned_device_name[DEVICE_NAME_SIZE],
+		filename[DEVICE_NAME_SIZE + 16];
+
+	debug("hddtemp: hddtemp_write");
+
+	/* substitute all / in device name with % */
+	strcpy(cleaned_device_name, inst);
+	substitute_slashes(cleaned_device_name);
+
+	/* construct filename */
+	sprintf(filename, "hddtemp-%s.rrd", cleaned_device_name);
+
+	/* update rrd file */
+	rrd_update_file (host, filename, val, ds_def, 2);
+}
+
+/* module_register
+   Register collectd plugin. */
+
+void module_register (void)
+{
+	plugin_register (MODULE_NAME, hddtemp_init, hddtemp_read, hddtemp_write);
+}
+
+#endif /* COLLECT_HDDTEMP */
diff -urN collectd--mainline--0.1--patch-1/src/hddtemp.h collectd--vincent--0.1--patch-3/src/hddtemp.h
--- collectd--mainline--0.1--patch-1/src/hddtemp.h	1970-01-01 01:00:00.000000000 +0100
+++ collectd--vincent--0.1--patch-3/src/hddtemp.h	2005-10-08 19:07:48.356227273 +0200
@@ -0,0 +1,27 @@
+/* hddtemp "collector" for collectd 
+   Author: Vincent Stehlé <vincent.stehle at free.fr>
+
+   This program is free software; you can distribute it and/or modify it
+   under the terms of the GNU General Public License (Version 2) as
+   published by the Free Software Foundation.
+
+   This program is distributed in the hope it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */
+
+#ifndef HDDTEMP_H
+#define HDDTEMP_H
+
+#include "collectd.h"
+#include "common.h"
+
+#ifndef COLLECT_HDDTEMP
+#define COLLECT_HDDTEMP 1
+#endif
+
+#endif /* HDDTEMP_H */
diff -urN collectd--mainline--0.1--patch-1/src/libping/Makefile.in collectd--vincent--0.1--patch-3/src/libping/Makefile.in
--- collectd--mainline--0.1--patch-1/src/libping/Makefile.in	2005-10-08 19:07:39.632855191 +0200
+++ collectd--vincent--0.1--patch-3/src/libping/Makefile.in	2005-10-08 19:07:49.531008039 +0200
@@ -80,6 +80,8 @@
 BUILD_MODULE_CPU_TRUE = @BUILD_MODULE_CPU_TRUE@
 BUILD_MODULE_DISK_FALSE = @BUILD_MODULE_DISK_FALSE@
 BUILD_MODULE_DISK_TRUE = @BUILD_MODULE_DISK_TRUE@
+BUILD_MODULE_HDDTEMP_FALSE = @BUILD_MODULE_HDDTEMP_FALSE@
+BUILD_MODULE_HDDTEMP_TRUE = @BUILD_MODULE_HDDTEMP_TRUE@
 BUILD_MODULE_LOAD_FALSE = @BUILD_MODULE_LOAD_FALSE@
 BUILD_MODULE_LOAD_TRUE = @BUILD_MODULE_LOAD_TRUE@
 BUILD_MODULE_MEMORY_FALSE = @BUILD_MODULE_MEMORY_FALSE@


More information about the Collectd mailing list