summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 617e87b)
raw | patch | inline | side by side (parent: 617e87b)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 26 Apr 2014 14:42:21 +0000 (16:42 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 26 Apr 2014 14:47:57 +0000 (16:47 +0200) |
debian/changelog | patch | blob | history | |
debian/patches/00list | patch | blob | history | |
debian/patches/myplugin_api.dpatch | [new file with mode: 0755] | patch | blob |
diff --git a/debian/changelog b/debian/changelog
index 8dc89bbdabdceca1e6131e3749a8dc1a78dcfaab..d69f8270941dcd237b05e4457ea0f6b624dd05a5 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- Added collection.cgi.dpatch fixing apache data-sources; thanks to
Fabiano Pires for reporting this and providing a patch
(Closes: #743881).
+ - Added myplugin_api.dpatch updating myplugin.c to the latest API.
-- Sebastian Harl <tokkee@debian.org> Sat, 26 Apr 2014 15:29:43 +0200
diff --git a/debian/patches/00list b/debian/patches/00list
index 717d464c463c522d2d711caee35f4dfde1bdf39b..ae9c349118cfee31c14d359e0674fe21eefabbd3 100644 (file)
--- a/debian/patches/00list
+++ b/debian/patches/00list
collection_conf_path.dpatch
collection.cgi.dpatch
myplugin_includes.dpatch
+myplugin_api.dpatch
bts559801_plugin_find_fix.dpatch
diff --git a/debian/patches/myplugin_api.dpatch b/debian/patches/myplugin_api.dpatch
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## myplugin_api.dpatch by Sebastian Harl <sh@tokkee.org>
+##
+## DP: Update myplugin.c to the latest collectd API.
+
+@DPATCH@
+
+diff a/contrib/examples/myplugin.c b/contrib/examples/myplugin.c
+--- a/contrib/examples/myplugin.c
++++ b/contrib/examples/myplugin.c
+@@ -100,14 +100,16 @@
+ vl.time = time (NULL);
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "myplugin", sizeof (vl.plugin));
++
++ /* it is strongly recommended to use a type defined in the types.db file
++ * instead of a custom type */
++ sstrncpy (vl.type, "myplugin", sizeof (vl.plugin));
+ /* optionally set vl.plugin_instance and vl.type_instance to reasonable
+ * values (default: "") */
+
+ /* 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 (it is strongly recommended to use a type defined in the
+- * types.db file) */
+- plugin_dispatch_values ("myplugin", &vl);
++ * write functions */
++ plugin_dispatch_values (&vl);
+
+ /* A return value != 0 indicates an error and the plugin will be skipped
+ * for an increasing amount of time. */
+@@ -117,7 +119,8 @@
+ /*
+ * This function is called after values have been dispatched to collectd.
+ */
+-static int my_write (const data_set_t *ds, const value_list_t *vl)
++static int my_write (const data_set_t *ds, const value_list_t *vl,
++ user_data_t *ud)
+ {
+ char name[1024] = "";
+ int i = 0;
+@@ -151,7 +154,7 @@
+ /*
+ * This function is called when plugin_log () has been used.
+ */
+-static void my_log (int severity, const char *msg)
++static void my_log (int severity, const char *msg, user_data_t *ud)
+ {
+ printf ("LOG: %i - %s\n", severity, msg);
+ return;
+@@ -160,7 +163,7 @@
+ /*
+ * This function is called when plugin_dispatch_notification () has been used.
+ */
+-static int my_notify (const notification_t *notif)
++static int my_notify (const notification_t *notif, user_data_t *ud)
+ {
+ char time_str[32] = "";
+ struct tm *tm = NULL;
+@@ -210,12 +213,13 @@
+ */
+ void module_register (void)
+ {
+- plugin_register_log ("myplugin", my_log);
+- plugin_register_notification ("myplugin", my_notify);
++ plugin_register_log ("myplugin", my_log, /* user data */ NULL);
++ plugin_register_notification ("myplugin", my_notify,
++ /* user data */ NULL);
+ plugin_register_data_set (&ds);
+ plugin_register_read ("myplugin", my_read);
+ plugin_register_init ("myplugin", my_init);
+- plugin_register_write ("myplugin", my_write);
++ plugin_register_write ("myplugin", my_write, /* user data */ NULL);
+ plugin_register_shutdown ("myplugin", my_shutdown);
+ return;
+ } /* void module_register (void) */