[collectd] [PATCH] contrib/examples/: Be more verbose about how to handle types.

Sebastian Harl sh at tokkee.org
Mon Jun 16 23:35:28 CEST 2008


As suggested by Wolfgang Kroener.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 contrib/examples/MyPlugin.pm |   10 ++++++++--
 contrib/examples/myplugin.c  |    9 ++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/contrib/examples/MyPlugin.pm b/contrib/examples/MyPlugin.pm
index 1a0247f..13806ee 100644
--- a/contrib/examples/MyPlugin.pm
+++ b/contrib/examples/MyPlugin.pm
@@ -21,7 +21,12 @@ use Collectd qw( :all );
 
 # data set definition:
 # see section "DATA TYPES" in collectd-perl(5) for details
-# (take a look at the types.db file for a large list of predefined data-sets)
+#
+# NOTE: If you're defining a custom data-set, you have to make that known to
+# any servers as well. Else, the server is not able to store values using the
+# type defined by that data-set.
+# It is strongly recommended to use one of the types and data-sets pre-defined
+# in the types.db file.
 my $dataset =
 [
 	{
@@ -70,7 +75,8 @@ sub my_read
 
 	# dispatch the values to collectd which passes them on to all registered
 	# write functions - the first argument is used to lookup the data set
-	# definition
+	# definition (it is strongly recommended to use a type defined in the
+	# types.db file)
 	plugin_dispatch_values ('myplugin', $vl);
 
 	# A false return value indicates an error and the plugin will be skipped
diff --git a/contrib/examples/myplugin.c b/contrib/examples/myplugin.c
index cdd537a..240c6c3 100644
--- a/contrib/examples/myplugin.c
+++ b/contrib/examples/myplugin.c
@@ -59,6 +59,12 @@ static data_source_t dsrc[1] =
  * - name of the data set
  * - number of data sources
  * - list of data sources
+ *
+ * NOTE: If you're defining a custom data-set, you have to make that known to
+ * any servers as well. Else, the server is not able to store values using the
+ * type defined by that data-set.
+ * It is strongly recommended to use one of the types and data-sets
+ * pre-defined in the types.db file.
  */
 static data_set_t ds =
 {
@@ -99,7 +105,8 @@ static int my_read (void)
 
 	/* dispatch the values to collectd which passes them on to all registered
 	 * write functions - the first argument is used to lookup the data set
-	 * definition */
+	 * definition (it is strongly recommended to use a type defined in the
+	 * types.db file) */
 	plugin_dispatch_values ("myplugin", &vl);
 
 	/* A return value != 0 indicates an error and the plugin will be skipped
-- 
1.5.6.rc2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080616/337207ab/attachment.pgp 


More information about the collectd mailing list