2 * collectd - src/plugin.c
3 * Copyright (C) 2005-2009 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
20 * Sebastian Harl <sh at tokkee.org>
24 #include "utils_complain.h"
34 #include "configfile.h"
35 #include "utils_avltree.h"
36 #include "utils_llist.h"
37 #include "utils_cache.h"
38 #include "utils_threshold.h"
39 #include "filter_chain.h"
48 int (*callback) (void);
49 enum { DONE = 0, TODO = 1, ACTIVE = 2 } needs_read;
51 typedef struct read_func_s read_func_t;
56 static llist_t *list_init;
57 static llist_t *list_read;
58 static llist_t *list_write;
59 static llist_t *list_flush;
60 static llist_t *list_shutdown;
61 static llist_t *list_log;
62 static llist_t *list_notification;
64 static fc_chain_t *pre_cache_chain = NULL;
65 static fc_chain_t *post_cache_chain = NULL;
67 static c_avl_tree_t *data_sets;
69 static char *plugindir = NULL;
71 static int read_loop = 1;
72 static pthread_mutex_t read_lock = PTHREAD_MUTEX_INITIALIZER;
73 static pthread_cond_t read_cond = PTHREAD_COND_INITIALIZER;
74 static pthread_t *read_threads = NULL;
75 static int read_threads_num = 0;
80 static const char *plugin_get_dir (void)
82 if (plugindir == NULL)
88 static int register_callback (llist_t **list, const char *name, void *callback)
94 && ((*list = llist_create ()) == NULL))
97 le = llist_search (*list, name);
104 le = llentry_create (key, callback);
111 llist_append (*list, le);
115 le->value = callback;
119 } /* int register_callback */
121 static int plugin_unregister (llist_t *list, const char *name)
125 e = llist_search (list, name);
130 llist_remove (list, e);
135 } /* int plugin_unregister */
138 * (Try to) load the shared object `file'. Won't complain if it isn't a shared
139 * object, but it will bitch about a shared object not having a
140 * ``module_register'' symbol..
142 static int plugin_load_file (char *file)
145 void (*reg_handle) (void);
147 DEBUG ("file = %s", file);
150 lt_dlerror (); /* clear errors */
152 if ((dlh = lt_dlopen (file)) == NULL)
154 const char *error = lt_dlerror ();
156 ERROR ("lt_dlopen (%s) failed: %s", file, error);
157 fprintf (stderr, "lt_dlopen (%s) failed: %s\n", file, error);
161 if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
163 WARNING ("Couldn't find symbol `module_register' in `%s': %s\n",
164 file, lt_dlerror ());
174 static void *plugin_read_thread (void __attribute__((unused)) *args)
181 pthread_mutex_lock (&read_lock);
183 while (read_loop != 0)
185 le = llist_head (list_read);
188 while ((read_loop != 0) && (le != NULL))
190 rf = (read_func_t *) le->value;
192 if (rf->needs_read != TODO)
198 /* We will do this read function */
199 rf->needs_read = ACTIVE;
201 DEBUG ("[thread #%5lu] plugin: plugin_read_thread: Handling %s",
202 (unsigned long int) pthread_self (), le->key);
203 pthread_mutex_unlock (&read_lock);
205 status = rf->callback ();
210 if (rf->wait_time < interval_g)
211 rf->wait_time = interval_g;
212 rf->wait_left = rf->wait_time;
213 rf->wait_time = rf->wait_time * 2;
214 if (rf->wait_time > 86400)
215 rf->wait_time = 86400;
217 NOTICE ("read-function of plugin `%s' "
218 "failed. Will suspend it for %i "
219 "seconds.", le->key, rf->wait_left);
224 rf->wait_time = interval_g;
227 pthread_mutex_lock (&read_lock);
229 rf->needs_read = DONE;
231 } /* while (le != NULL) */
233 if ((read_loop != 0) && (done == 0))
235 DEBUG ("[thread #%5lu] plugin: plugin_read_thread: Waiting on read_cond.",
236 (unsigned long int) pthread_self ());
237 pthread_cond_wait (&read_cond, &read_lock);
239 } /* while (read_loop) */
241 pthread_mutex_unlock (&read_lock);
245 } /* void *plugin_read_thread */
247 static void start_threads (int num)
251 if (read_threads != NULL)
254 read_threads = (pthread_t *) calloc (num, sizeof (pthread_t));
255 if (read_threads == NULL)
257 ERROR ("plugin: start_threads: calloc failed.");
261 read_threads_num = 0;
262 for (i = 0; i < num; i++)
264 if (pthread_create (read_threads + read_threads_num, NULL,
265 plugin_read_thread, NULL) == 0)
271 ERROR ("plugin: start_threads: pthread_create failed.");
275 } /* void start_threads */
277 static void stop_threads (void)
281 if (read_threads == NULL)
284 pthread_mutex_lock (&read_lock);
286 DEBUG ("plugin: stop_threads: Signalling `read_cond'");
287 pthread_cond_broadcast (&read_cond);
288 pthread_mutex_unlock (&read_lock);
290 for (i = 0; i < read_threads_num; i++)
292 if (pthread_join (read_threads[i], NULL) != 0)
294 ERROR ("plugin: stop_threads: pthread_join failed.");
296 read_threads[i] = (pthread_t) 0;
298 sfree (read_threads);
299 read_threads_num = 0;
300 } /* void stop_threads */
305 void plugin_set_dir (const char *dir)
307 if (plugindir != NULL)
312 else if ((plugindir = strdup (dir)) == NULL)
315 ERROR ("strdup failed: %s",
316 sstrerror (errno, errbuf, sizeof (errbuf)));
321 int plugin_load (const char *type)
325 char filename[BUFSIZE] = "";
326 char typename[BUFSIZE];
333 DEBUG ("type = %s", type);
335 dir = plugin_get_dir ();
338 /* `cpu' should not match `cpufreq'. To solve this we add `.so' to the
339 * type when matching the filename */
340 status = ssnprintf (typename, sizeof (typename), "%s.so", type);
341 if ((status < 0) || ((size_t) status >= sizeof (typename)))
343 WARNING ("snprintf: truncated: `%s.so'", type);
346 typename_len = strlen (typename);
348 if ((dh = opendir (dir)) == NULL)
351 ERROR ("opendir (%s): %s", dir,
352 sstrerror (errno, errbuf, sizeof (errbuf)));
356 while ((de = readdir (dh)) != NULL)
358 if (strncasecmp (de->d_name, typename, typename_len))
361 status = ssnprintf (filename, sizeof (filename),
362 "%s/%s", dir, de->d_name);
363 if ((status < 0) || ((size_t) status >= sizeof (filename)))
365 WARNING ("snprintf: truncated: `%s/%s'", dir, de->d_name);
369 if (lstat (filename, &statbuf) == -1)
372 WARNING ("stat %s: %s", filename,
373 sstrerror (errno, errbuf, sizeof (errbuf)));
376 else if (!S_ISREG (statbuf.st_mode))
378 /* don't follow symlinks */
379 WARNING ("stat %s: not a regular file", filename);
383 if (plugin_load_file (filename) == 0)
391 fprintf (stderr, "Unable to load plugin %s.\n", type);
397 if (filename[0] == '\0')
398 fprintf (stderr, "Could not find plugin %s.\n", type);
404 * The `register_*' functions follow
406 int plugin_register_config (const char *name,
407 int (*callback) (const char *key, const char *val),
408 const char **keys, int keys_num)
410 cf_register (name, callback, keys, keys_num);
412 } /* int plugin_register_config */
414 int plugin_register_complex_config (const char *type,
415 int (*callback) (oconfig_item_t *))
417 return (cf_register_complex (type, callback));
418 } /* int plugin_register_complex_config */
420 int plugin_register_init (const char *name,
421 int (*callback) (void))
423 return (register_callback (&list_init, name, (void *) callback));
424 } /* plugin_register_init */
426 int plugin_register_read (const char *name,
427 int (*callback) (void))
431 rf = (read_func_t *) malloc (sizeof (read_func_t));
435 ERROR ("plugin_register_read: malloc failed: %s",
436 sstrerror (errno, errbuf, sizeof (errbuf)));
440 memset (rf, '\0', sizeof (read_func_t));
441 rf->wait_time = interval_g;
443 rf->callback = callback;
444 rf->needs_read = DONE;
446 return (register_callback (&list_read, name, (void *) rf));
447 } /* int plugin_register_read */
449 int plugin_register_write (const char *name,
450 int (*callback) (const data_set_t *ds, const value_list_t *vl))
452 return (register_callback (&list_write, name, (void *) callback));
453 } /* int plugin_register_write */
455 int plugin_register_flush (const char *name,
456 int (*callback) (const int timeout, const char *identifier))
458 return (register_callback (&list_flush, name, (void *) callback));
459 } /* int plugin_register_flush */
461 int plugin_register_shutdown (char *name,
462 int (*callback) (void))
464 return (register_callback (&list_shutdown, name, (void *) callback));
465 } /* int plugin_register_shutdown */
467 int plugin_register_data_set (const data_set_t *ds)
472 if ((data_sets != NULL)
473 && (c_avl_get (data_sets, ds->type, NULL) == 0))
475 NOTICE ("Replacing DS `%s' with another version.", ds->type);
476 plugin_unregister_data_set (ds->type);
478 else if (data_sets == NULL)
480 data_sets = c_avl_create ((int (*) (const void *, const void *)) strcmp);
481 if (data_sets == NULL)
485 ds_copy = (data_set_t *) malloc (sizeof (data_set_t));
488 memcpy(ds_copy, ds, sizeof (data_set_t));
490 ds_copy->ds = (data_source_t *) malloc (sizeof (data_source_t)
492 if (ds_copy->ds == NULL)
498 for (i = 0; i < ds->ds_num; i++)
499 memcpy (ds_copy->ds + i, ds->ds + i, sizeof (data_source_t));
501 return (c_avl_insert (data_sets, (void *) ds_copy->type, (void *) ds_copy));
502 } /* int plugin_register_data_set */
504 int plugin_register_log (char *name,
505 void (*callback) (int priority, const char *msg))
507 return (register_callback (&list_log, name, (void *) callback));
508 } /* int plugin_register_log */
510 int plugin_register_notification (const char *name,
511 int (*callback) (const notification_t *notif))
513 return (register_callback (&list_notification, name, (void *) callback));
514 } /* int plugin_register_log */
516 int plugin_unregister_config (const char *name)
518 cf_unregister (name);
520 } /* int plugin_unregister_config */
522 int plugin_unregister_complex_config (const char *name)
524 cf_unregister_complex (name);
526 } /* int plugin_unregister_complex_config */
528 int plugin_unregister_init (const char *name)
530 return (plugin_unregister (list_init, name));
533 int plugin_unregister_read (const char *name)
537 e = llist_search (list_read, name);
542 llist_remove (list_read, e);
550 int plugin_unregister_write (const char *name)
552 return (plugin_unregister (list_write, name));
555 int plugin_unregister_flush (const char *name)
557 return (plugin_unregister (list_flush, name));
560 int plugin_unregister_shutdown (const char *name)
562 return (plugin_unregister (list_shutdown, name));
565 int plugin_unregister_data_set (const char *name)
569 if (data_sets == NULL)
572 if (c_avl_remove (data_sets, name, NULL, (void *) &ds) != 0)
579 } /* int plugin_unregister_data_set */
581 int plugin_unregister_log (const char *name)
583 return (plugin_unregister (list_log, name));
586 int plugin_unregister_notification (const char *name)
588 return (plugin_unregister (list_notification, name));
591 void plugin_init_all (void)
593 const char *chain_name;
594 int (*callback) (void);
598 /* Init the value cache */
601 chain_name = global_option_get ("PreCacheChain");
602 pre_cache_chain = fc_chain_get_by_name (chain_name);
604 chain_name = global_option_get ("PostCacheChain");
605 post_cache_chain = fc_chain_get_by_name (chain_name);
608 if ((list_init == NULL) && (list_read == NULL))
611 /* Calling all init callbacks before checking if read callbacks
612 * are available allows the init callbacks to register the read
614 le = llist_head (list_init);
617 callback = (int (*) (void)) le->value;
618 status = (*callback) ();
622 ERROR ("Initialization of plugin `%s' "
623 "failed with status %i. "
624 "Plugin will be unloaded.",
626 /* Plugins that register read callbacks from the init
627 * callback should take care of appropriate error
628 * handling themselves. */
629 /* FIXME: Unload _all_ functions */
630 plugin_unregister_read (le->key);
636 /* Start read-threads */
637 if (list_read != NULL)
641 rt = global_option_get ("ReadThreads");
644 start_threads ((num > 0) ? num : 5);
646 } /* void plugin_init_all */
648 void plugin_read_all (void)
655 if (list_read == NULL)
658 pthread_mutex_lock (&read_lock);
660 le = llist_head (list_read);
663 rf = (read_func_t *) le->value;
665 if (rf->needs_read != DONE)
671 if (rf->wait_left > 0)
672 rf->wait_left -= interval_g;
674 if (rf->wait_left <= 0)
676 rf->needs_read = TODO;
682 DEBUG ("plugin: plugin_read_all: Signalling `read_cond'");
683 pthread_cond_broadcast (&read_cond);
684 pthread_mutex_unlock (&read_lock);
685 } /* void plugin_read_all */
687 /* Read function called when the `-T' command line argument is given. */
688 int plugin_read_all_once (void)
693 int return_status = 0;
695 if (list_read == NULL)
697 NOTICE ("No read-functions are registered.");
701 for (le = llist_head (list_read);
705 rf = (read_func_t *) le->value;
706 status = rf->callback ();
709 NOTICE ("read-function of plugin `%s' failed.",
715 return (return_status);
716 } /* int plugin_read_all_once */
718 int plugin_write (const char *plugin, /* {{{ */
719 const data_set_t *ds, const value_list_t *vl)
721 int (*callback) (const data_set_t *ds, const value_list_t *vl);
728 if (list_write == NULL)
733 ds = plugin_get_ds (vl->type);
736 ERROR ("plugin_write: Unable to lookup type `%s'.", vl->type);
746 le = llist_head (list_write);
749 callback = le->value;
750 status = (*callback) (ds, vl);
759 if ((success == 0) && (failure != 0))
764 else /* plugin != NULL */
766 le = llist_head (list_write);
769 if (strcasecmp (plugin, le->key) == 0)
778 callback = le->value;
779 status = (*callback) (ds, vl);
783 } /* }}} int plugin_write */
785 int plugin_flush (const char *plugin, int timeout, const char *identifier)
787 int (*callback) (int timeout, const char *identifier);
790 if (list_flush == NULL)
793 le = llist_head (list_flush);
797 && (strcmp (plugin, le->key) != 0))
803 callback = (int (*) (int, const char *)) le->value;
804 (*callback) (timeout, identifier);
809 } /* int plugin_flush */
811 void plugin_shutdown_all (void)
813 int (*callback) (void);
818 if (list_shutdown == NULL)
821 le = llist_head (list_shutdown);
824 callback = (int (*) (void)) le->value;
826 /* Advance the pointer before calling the callback allows
827 * shutdown functions to unregister themselves. If done the
828 * other way around the memory `le' points to will be freed
829 * after callback returns. */
834 } /* void plugin_shutdown_all */
836 int plugin_dispatch_values (value_list_t *vl)
839 static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC;
841 value_t *saved_values;
842 int saved_values_len;
846 if ((vl == NULL) || (vl->type[0] == 0)
847 || (vl->values == NULL) || (vl->values_len < 1))
849 ERROR ("plugin_dispatch_values: Invalid value list.");
853 if (list_write == NULL)
854 c_complain_once (LOG_WARNING, &no_write_complaint,
855 "plugin_dispatch_values: No write callback has been "
856 "registered. Please load at least one output plugin, "
857 "if you want the collected data to be stored.");
859 if (data_sets == NULL)
861 ERROR ("plugin_dispatch_values: No data sets registered. "
862 "Could the types database be read? Check "
863 "your `TypesDB' setting!");
867 if (c_avl_get (data_sets, vl->type, (void *) &ds) != 0)
869 INFO ("plugin_dispatch_values: Dataset not found: %s", vl->type);
874 vl->time = time (NULL);
876 DEBUG ("plugin_dispatch_values: time = %u; interval = %i; "
878 "plugin = %s; plugin_instance = %s; "
879 "type = %s; type_instance = %s;",
880 (unsigned int) vl->time, vl->interval,
882 vl->plugin, vl->plugin_instance,
883 vl->type, vl->type_instance);
886 assert (0 == strcmp (ds->type, vl->type));
888 if (0 != strcmp (ds->type, vl->type))
889 WARNING ("plugin_dispatch_values: (ds->type = %s) != (vl->type = %s)",
894 assert (ds->ds_num == vl->values_len);
896 if (ds->ds_num != vl->values_len)
898 ERROR ("plugin_dispatch_values: ds->type = %s: "
899 "(ds->ds_num = %i) != "
900 "(vl->values_len = %i)",
901 ds->type, ds->ds_num, vl->values_len);
906 escape_slashes (vl->host, sizeof (vl->host));
907 escape_slashes (vl->plugin, sizeof (vl->plugin));
908 escape_slashes (vl->plugin_instance, sizeof (vl->plugin_instance));
909 escape_slashes (vl->type, sizeof (vl->type));
910 escape_slashes (vl->type_instance, sizeof (vl->type_instance));
912 /* Copy the values. This way, we can assure `targets' that they get
913 * dynamically allocated values, which they can free and replace if
915 if ((pre_cache_chain != NULL) || (post_cache_chain != NULL))
917 saved_values = vl->values;
918 saved_values_len = vl->values_len;
920 vl->values = (value_t *) calloc (vl->values_len,
921 sizeof (*vl->values));
922 if (vl->values == NULL)
924 ERROR ("plugin_dispatch_values: calloc failed.");
925 vl->values = saved_values;
928 memcpy (vl->values, saved_values,
929 vl->values_len * sizeof (*vl->values));
931 else /* if ((pre == NULL) && (post == NULL)) */
934 saved_values_len = 0;
937 if (pre_cache_chain != NULL)
939 status = fc_process_chain (ds, vl, pre_cache_chain);
942 WARNING ("plugin_dispatch_values: Running the "
943 "pre-cache chain failed with "
947 else if (status == FC_TARGET_STOP)
949 /* Restore the state of the value_list so that plugins
950 * don't get confused.. */
951 if (saved_values != NULL)
954 vl->values = saved_values;
955 vl->values_len = saved_values_len;
961 /* Update the value cache */
964 /* Initiate threshold checking */
965 ut_check_threshold (ds, vl);
967 if (post_cache_chain != NULL)
969 status = fc_process_chain (ds, vl, post_cache_chain);
972 WARNING ("plugin_dispatch_values: Running the "
973 "post-cache chain failed with "
979 fc_default_action (ds, vl);
981 /* Restore the state of the value_list so that plugins don't get
983 if (saved_values != NULL)
986 vl->values = saved_values;
987 vl->values_len = saved_values_len;
991 } /* int plugin_dispatch_values */
993 int plugin_dispatch_notification (const notification_t *notif)
995 int (*callback) (const notification_t *);
997 /* Possible TODO: Add flap detection here */
999 DEBUG ("plugin_dispatch_notification: severity = %i; message = %s; "
1000 "time = %u; host = %s;",
1001 notif->severity, notif->message,
1002 (unsigned int) notif->time, notif->host);
1004 /* Nobody cares for notifications */
1005 if (list_notification == NULL)
1008 le = llist_head (list_notification);
1011 callback = (int (*) (const notification_t *)) le->value;
1012 (*callback) (notif);
1018 } /* int plugin_dispatch_notification */
1020 void plugin_log (int level, const char *format, ...)
1025 void (*callback) (int, const char *);
1028 if (list_log == NULL)
1032 if (level >= LOG_DEBUG)
1036 va_start (ap, format);
1037 vsnprintf (msg, sizeof (msg), format, ap);
1038 msg[sizeof (msg) - 1] = '\0';
1041 le = llist_head (list_log);
1044 callback = (void (*) (int, const char *)) le->value;
1045 (*callback) (level, msg);
1049 } /* void plugin_log */
1051 const data_set_t *plugin_get_ds (const char *name)
1055 if (c_avl_get (data_sets, name, (void *) &ds) != 0)
1057 DEBUG ("No such dataset registered: %s", name);
1062 } /* data_set_t *plugin_get_ds */
1064 static int plugin_notification_meta_add (notification_t *n,
1066 enum notification_meta_type_e type,
1069 notification_meta_t *meta;
1070 notification_meta_t *tail;
1072 if ((n == NULL) || (name == NULL) || (value == NULL))
1074 ERROR ("plugin_notification_meta_add: A pointer is NULL!");
1078 meta = (notification_meta_t *) malloc (sizeof (notification_meta_t));
1081 ERROR ("plugin_notification_meta_add: malloc failed.");
1084 memset (meta, 0, sizeof (notification_meta_t));
1086 sstrncpy (meta->name, name, sizeof (meta->name));
1091 case NM_TYPE_STRING:
1093 meta->nm_value.nm_string = strdup ((const char *) value);
1094 if (meta->nm_value.nm_string == NULL)
1096 ERROR ("plugin_notification_meta_add: strdup failed.");
1102 case NM_TYPE_SIGNED_INT:
1104 meta->nm_value.nm_signed_int = *((int64_t *) value);
1107 case NM_TYPE_UNSIGNED_INT:
1109 meta->nm_value.nm_unsigned_int = *((uint64_t *) value);
1112 case NM_TYPE_DOUBLE:
1114 meta->nm_value.nm_double = *((double *) value);
1117 case NM_TYPE_BOOLEAN:
1119 meta->nm_value.nm_boolean = *((bool *) value);
1124 ERROR ("plugin_notification_meta_add: Unknown type: %i", type);
1128 } /* switch (type) */
1132 while ((tail != NULL) && (tail->next != NULL))
1141 } /* int plugin_notification_meta_add */
1143 int plugin_notification_meta_add_string (notification_t *n,
1147 return (plugin_notification_meta_add (n, name, NM_TYPE_STRING, value));
1150 int plugin_notification_meta_add_signed_int (notification_t *n,
1154 return (plugin_notification_meta_add (n, name, NM_TYPE_SIGNED_INT, &value));
1157 int plugin_notification_meta_add_unsigned_int (notification_t *n,
1161 return (plugin_notification_meta_add (n, name, NM_TYPE_UNSIGNED_INT, &value));
1164 int plugin_notification_meta_add_double (notification_t *n,
1168 return (plugin_notification_meta_add (n, name, NM_TYPE_DOUBLE, &value));
1171 int plugin_notification_meta_add_boolean (notification_t *n,
1175 return (plugin_notification_meta_add (n, name, NM_TYPE_BOOLEAN, &value));
1178 int plugin_notification_meta_copy (notification_t *dst,
1179 const notification_t *src)
1181 notification_meta_t *meta;
1183 assert (dst != NULL);
1184 assert (src != NULL);
1185 assert (dst != src);
1186 assert ((src->meta == NULL) || (src->meta != dst->meta));
1188 for (meta = src->meta; meta != NULL; meta = meta->next)
1190 if (meta->type == NM_TYPE_STRING)
1191 plugin_notification_meta_add_string (dst, meta->name,
1192 meta->nm_value.nm_string);
1193 else if (meta->type == NM_TYPE_SIGNED_INT)
1194 plugin_notification_meta_add_signed_int (dst, meta->name,
1195 meta->nm_value.nm_signed_int);
1196 else if (meta->type == NM_TYPE_UNSIGNED_INT)
1197 plugin_notification_meta_add_unsigned_int (dst, meta->name,
1198 meta->nm_value.nm_unsigned_int);
1199 else if (meta->type == NM_TYPE_DOUBLE)
1200 plugin_notification_meta_add_double (dst, meta->name,
1201 meta->nm_value.nm_double);
1202 else if (meta->type == NM_TYPE_BOOLEAN)
1203 plugin_notification_meta_add_boolean (dst, meta->name,
1204 meta->nm_value.nm_boolean);
1208 } /* int plugin_notification_meta_copy */
1210 int plugin_notification_meta_free (notification_meta_t *n)
1212 notification_meta_t *this;
1213 notification_meta_t *next;
1217 ERROR ("plugin_notification_meta_free: n == NULL!");
1222 while (this != NULL)
1226 if (this->type == NM_TYPE_STRING)
1228 free ((char *)this->nm_value.nm_string);
1229 this->nm_value.nm_string = NULL;
1237 } /* int plugin_notification_meta_free */