From 60d69e4cc038583bd2627d386b6c29ecac2c56ba Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 28 Oct 2007 00:10:06 +0200 Subject: [PATCH] Removed debian/examples/myplugin.c and debian/examples/MyPlugin.pm. They are now included in the upstream sources. --- debian/changelog | 4 +- debian/examples/MyPlugin.pm | 125 -------------------------- debian/examples/myplugin.c | 171 ------------------------------------ debian/rules | 4 +- 4 files changed, 5 insertions(+), 299 deletions(-) delete mode 100644 debian/examples/MyPlugin.pm delete mode 100644 debian/examples/myplugin.c diff --git a/debian/changelog b/debian/changelog index 643c513..792c28c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,10 @@ collectd (4.1.3-1) experimental; urgency=low * Added collectd.overrides to override shlib-with-non-pic-code errors of plugins liked against static libraries which have not been linked with -fPIC. + * Removed debian/examples/myplugin.c and debian/examples/MyPlugin.pm - they + are included in the upstream sources now. - -- Sebastian Harl Wed, 24 Oct 2007 23:25:04 +0200 + -- Sebastian Harl Thu, 25 Oct 2007 00:54:13 +0200 collectd (4.0.7-1) experimental; urgency=low diff --git a/debian/examples/MyPlugin.pm b/debian/examples/MyPlugin.pm deleted file mode 100644 index 1b98d5b..0000000 --- a/debian/examples/MyPlugin.pm +++ /dev/null @@ -1,125 +0,0 @@ -# /usr/share/doc/collectd/examples/MyPlugin.pm -# -# A Perl plugin template for collectd. -# -# Written by Sebastian Harl -# -# This is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; only version 2 of the License is applicable. - -# Notes: -# - each of the functions below (and the corresponding plugin_register call) -# is optional - -package Collectd::Plugin::MyPlugin; - -use strict; -use warnings; - -# data set definition: -# see section "DATA TYPES" in collectd-perl(5) for details -my $dataset = -[ - { - name => 'my_ds', - type => Collectd::DS_TYPE_GAUGE, - min => 0, - max => 65535, - }, -]; - -# This code is executed after loading the plugin to register it with collectd. -Collectd::plugin_register (Collectd::TYPE_LOG, 'myplugin', \&my_log); -Collectd::plugin_register (Collectd::TYPE_DATASET, 'myplugin', $dataset); -Collectd::plugin_register (Collectd::TYPE_INIT, 'myplugin', \&my_init); -Collectd::plugin_register (Collectd::TYPE_READ, 'myplugin', \&my_read); -Collectd::plugin_register (Collectd::TYPE_WRITE, 'myplugin', \&my_write); -Collectd::plugin_register (Collectd::TYPE_SHUTDOWN, 'myplugin', \&my_shutdown); - -# For each of the functions below see collectd-perl(5) for details about -# arguments and the like. - -# This function is called once upon startup to initialize the plugin. -sub my_init -{ - # open sockets, initialize data structures, ... - - # A false return value indicates an error and causes the plugin to be - # disabled. - return 1; -} # my_init () - -# This function is called in regular intervals to collectd the data. -sub my_read -{ - # value list to dispatch to collectd: - # see section "DATA TYPES" in collectd-perl(5) for details - my $vl = {}; - - # do the magic to read the data: - # the number of values has to match the number of data sources defined in - # the registered data set - $vl->{'values'} = [ rand(65535) ]; - $vl->{'plugin'} = 'myplugin'; - # any other elements are optional - - # 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 - Collectd::plugin_dispatch_values ('myplugin', $vl); - - # A false return value indicates an error and the plugin will be skipped - # for an increasing amount of time. - return 1; -} # my_read () - -# This function is called after values have been dispatched to collectd. -sub my_write -{ - my $type = shift; - my $ds = shift; - my $vl = shift; - - if (scalar (@$ds) != scalar (@{$vl->{'values'}})) { - Collectd::plugin_log (Collectd::LOG_WARNING, - "DS number does not match values length"); - return; - } - - for (my $i = 0; $i < scalar (@$ds); ++$i) { - # do the magic to output the data - print "$vl->{'host'}: $vl->{'plugin'}: "; - - if (defined $vl->{'plugin_instance'}) { - print "$vl->{'plugin_instance'}: "; - } - - print "$type: "; - - if (defined $vl->{'type_instance'}) { - print "$vl->{'type_instance'}: "; - } - - print "$vl->{'values'}->[$i]\n"; - } - return 1; -} # my_write() - -# This function is called before shutting down collectd. -sub my_shutdown -{ - # close sockets, ... - return 1; -} # my_shutdown () - -# This function is called when plugin_log () has been used. -sub my_log -{ - my $level = shift; - my $msg = shift; - - print "LOG: $level - $msg\n"; - return 1; -} # my_log () - diff --git a/debian/examples/myplugin.c b/debian/examples/myplugin.c deleted file mode 100644 index ab7417b..0000000 --- a/debian/examples/myplugin.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * /usr/share/doc/collectd/examples/myplugin.c - * - * A plugin template for collectd. - * - * Written by Sebastian Harl - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; only version 2 of the License is applicable. - */ - -/* - * Notes: - * - plugins are executed in parallel, thus, thread-safe - * functions need to be used - * - each of the functions below (except module_register) - * is optional - */ - -#include -#include - -#include - -#ifndef __USE_ISOC99 /* required for NAN */ -# define DISABLE_ISOC99 1 -# define __USE_ISOC99 1 -#endif /* !defined(__USE_ISOC99) */ -#include -#if DISABLE_ISOC99 -# undef DISABLE_ISOC99 -# undef __USE_ISOC99 -#endif /* DISABLE_ISOC99 */ - -#include -#include -#include - -/* - * data source definition: - * - name of the data source - * - type of the data source (DS_TYPE_GAUGE, DS_TYPE_COUNTER) - * - minimum allowed value - * - maximum allowed value - */ -static data_source_t dsrc[1] = -{ - { "my_ds", DS_TYPE_GAUGE, 0, NAN } -}; - -/* - * data set definition: - * - name of the data set - * - number of data sources - * - list of data sources - */ -static data_set_t ds = -{ - "myplugin", STATIC_ARRAY_SIZE (dsrc), dsrc -}; - -/* - * This function is called once upon startup to initialize the plugin. - */ -static int my_init (void) -{ - /* open sockets, initialize data structures, ... */ - - /* A return value != 0 indicates an error and causes the plugin to be - disabled. */ - return 0; -} /* static int my_init (void) */ - -/* - * This function is called in regular intervalls to collect the data. - */ -static int my_read (void) -{ - value_t values[1]; /* the size of this list should equal the number of - data sources */ - value_list_t vl = VALUE_LIST_INIT; - - /* do the magic to read the data */ - values[0].gauge = random (); - - vl.values = values; - vl.values_len = 1; - vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "myplugin"); - /* 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 */ - plugin_dispatch_values ("myplugin", &vl); - - /* A return value != 0 indicates an error and the plugin will be skipped - * for an increasing amount of time. */ - return 0; -} /* static int my_read (void) */ - -/* - * 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) -{ - char name[1024] = ""; - int i = 0; - - if (ds->ds_num != vl->values_len) { - plugin_log (LOG_WARNING, "DS number does not match values length"); - return -1; - } - - /* get the default base filename for the output file - depending on the - * provided values this will be something like - * /[-]/[-] */ - if (0 != format_name (name, 1024, vl->host, vl->plugin, - vl->plugin_instance, ds->type, vl->type_instance)) - return -1; - - for (i = 0; i < ds->ds_num; ++i) { - /* do the magic to output the data */ - printf ("%s (%s) at %i: ", name, - (ds->ds->type == DS_TYPE_GAUGE) ? "GAUGE" : "COUNTER", - (int)vl->time); - - if (ds->ds->type == DS_TYPE_GAUGE) - printf ("%f\n", vl->values[i].gauge); - else - printf ("%lld\n", vl->values[i].counter); - } - return 0; -} /* static int my_write (data_set_t *, value_list_t *) */ - -/* - * This function is called when plugin_log () has been used. - */ -static void my_log (int severity, const char *msg) -{ - printf ("LOG: %i - %s\n", severity, msg); - return; -} /* static void my_log (int, const char *) */ - -/* - * This function is called before shutting down collectd. - */ -static int my_shutdown (void) -{ - /* close sockets, free data structures, ... */ - return 0; -} /* static int my_shutdown (void) */ - -/* - * This function is called after loading the plugin to register it with - * collectd. - */ -void module_register (void) -{ - plugin_register_log ("myplugin", my_log); - 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_shutdown ("myplugin", my_shutdown); - return; -} /* void module_register (modreg_e) */ - diff --git a/debian/rules b/debian/rules index 46addb8..37ca713 100755 --- a/debian/rules +++ b/debian/rules @@ -105,8 +105,8 @@ binary-indep: install-indep dh_testroot dh_installchangelogs -i ChangeLog dh_installdocs -A -i debian/README.Debian AUTHORS README TODO - dh_installexamples -i debian/examples/myplugin.c \ - debian/examples/MyPlugin.pm + dh_installexamples -i contrib/examples/myplugin.c \ + contrib/examples/MyPlugin.pm dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c dh_fixperms -i dh_installdeb -i -- 2.30.2