summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0a9987a)
raw | patch | inline | side by side (parent: 0a9987a)
author | Florian Forster <octo@noris.net> | |
Fri, 4 Apr 2008 12:25:33 +0000 (14:25 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Fri, 4 Apr 2008 12:25:33 +0000 (14:25 +0200) |
src/ipmi.c | patch | blob | history |
diff --git a/src/ipmi.c b/src/ipmi.c
index 516dd7ffafc49991f9958a052a9a3ac9041e50a6..95e2e7c1023fd140e7012920e548d2ad4c5ed5e6 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
+#include "utils_ignorelist.h"
#include <pthread.h>
static int c_ipmi_active = 0;
static pthread_t thread_id = (pthread_t) 0;
+static const char *config_keys[] =
+{
+ "Sensor",
+ "IgnoreSelected"
+};
+static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
+
+static ignorelist_t *ignorelist = NULL;
+
/*
* Misc private functions
*/
return;
}
+ /* Both `ignorelist' and `plugin_instance' may be NULL. */
+ if (ignorelist_match (ignorelist, sensor_name_ptr) != 0)
+ {
+ sensor_list_remove (sensor);
+ return;
+ }
+
/* FIXME: Use rate unit or base unit to scale the value */
sensor_type = ipmi_sensor_get_sensor_type (sensor);
return ((void *) 0);
} /* void *thread_main */
+static int c_ipmi_config (const char *key, const char *value)
+{
+ if (ignorelist == NULL)
+ ignorelist = ignorelist_create (/* invert = */ 1);
+ if (ignorelist == NULL)
+ return (1);
+
+ if (strcasecmp ("Sensor", key) == 0)
+ {
+ ignorelist_add (ignorelist, value);
+ }
+ else if (strcasecmp ("IgnoreSelected", key) == 0)
+ {
+ int invert = 1;
+ if ((strcasecmp ("True", value) == 0)
+ || (strcasecmp ("Yes", value) == 0)
+ || (strcasecmp ("On", value) == 0))
+ invert = 0;
+ ignorelist_set_invert (ignorelist, invert);
+ }
+ else
+ {
+ return (-1);
+ }
+
+ return (0);
+} /* int c_ipmi_config */
+
static int c_ipmi_init (void)
{
int status;
void module_register (void)
{
+ plugin_register_config ("ipmi", c_ipmi_config,
+ config_keys, config_keys_num);
plugin_register_init ("ipmi", c_ipmi_init);
plugin_register_read ("ipmi", c_ipmi_read);
plugin_register_shutdown ("ipmi", c_ipmi_shutdown);