Merge pull request #1844 from rubenk/sigrok
[collectd.git] / src / ipmi.c
1 /**
2  * collectd - src/ipmi.c
3  * Copyright (C) 2008-2009  Florian octo Forster
4  * Copyright (C) 2008       Peter Holik
5  * Copyright (C) 2009       Bruno PrĂ©mont
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; only version 2 of the License is applicable.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  *
20  * Authors:
21  *   Florian octo Forster <octo at collectd.org>
22  *   Peter Holik <peter at holik.at>
23  *   Bruno PrĂ©mont <bonbons at linux-vserver.org>
24  **/
25
26 #include "collectd.h"
27
28 #include "common.h"
29 #include "plugin.h"
30 #include "utils_ignorelist.h"
31
32 #include <OpenIPMI/ipmiif.h>
33 #include <OpenIPMI/ipmi_err.h>
34 #include <OpenIPMI/ipmi_posix.h>
35 #include <OpenIPMI/ipmi_conn.h>
36 #include <OpenIPMI/ipmi_smi.h>
37
38 /*
39  * Private data types
40  */
41 struct c_ipmi_sensor_list_s;
42 typedef struct c_ipmi_sensor_list_s c_ipmi_sensor_list_t;
43
44 struct c_ipmi_sensor_list_s
45 {
46   ipmi_sensor_id_t sensor_id;
47   char sensor_name[DATA_MAX_NAME_LEN];
48   char sensor_type[DATA_MAX_NAME_LEN];
49   int sensor_not_present;
50   c_ipmi_sensor_list_t *next;
51 };
52
53 /*
54  * Module global variables
55  */
56 static pthread_mutex_t sensor_list_lock = PTHREAD_MUTEX_INITIALIZER;
57 static c_ipmi_sensor_list_t *sensor_list = NULL;
58
59 static int c_ipmi_init_in_progress = 0;
60 static int c_ipmi_active = 0;
61 static pthread_t thread_id = (pthread_t) 0;
62
63 static const char *config_keys[] =
64 {
65         "Sensor",
66         "IgnoreSelected",
67         "NotifySensorAdd",
68         "NotifySensorRemove",
69         "NotifySensorNotPresent"
70 };
71 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
72
73 static ignorelist_t *ignorelist = NULL;
74
75 static int c_ipmi_nofiy_add = 0;
76 static int c_ipmi_nofiy_remove = 0;
77 static int c_ipmi_nofiy_notpresent = 0;
78
79 /*
80  * Misc private functions
81  */
82 static void c_ipmi_error (const char *func, int status)
83 {
84   char errbuf[4096] = { 0 };
85
86   if (IPMI_IS_OS_ERR (status))
87   {
88     sstrerror (IPMI_GET_OS_ERR (status), errbuf, sizeof (errbuf));
89   }
90   else if (IPMI_IS_IPMI_ERR (status))
91   {
92     ipmi_get_error_string (IPMI_GET_IPMI_ERR (status), errbuf, sizeof (errbuf));
93   }
94
95   if (errbuf[0] == 0)
96   {
97     ssnprintf (errbuf, sizeof (errbuf), "Unknown error %#x", status);
98   }
99   errbuf[sizeof (errbuf) - 1] = 0;
100
101   ERROR ("ipmi plugin: %s failed: %s", func, errbuf);
102 } /* void c_ipmi_error */
103
104 /*
105  * Sensor handlers
106  */
107 /* Prototype for sensor_list_remove, so sensor_read_handler can call it. */
108 static int sensor_list_remove (ipmi_sensor_t *sensor);
109
110 static void sensor_read_handler (ipmi_sensor_t *sensor,
111     int err,
112     enum ipmi_value_present_e value_present,
113     unsigned int __attribute__((unused)) raw_value,
114     double value,
115     ipmi_states_t __attribute__((unused)) *states,
116     void *user_data)
117 {
118   value_t values[1];
119   value_list_t vl = VALUE_LIST_INIT;
120
121   c_ipmi_sensor_list_t *list_item = (c_ipmi_sensor_list_t *)user_data;
122
123   if (err != 0)
124   {
125     if ((err & 0xff) == IPMI_NOT_PRESENT_CC)
126     {
127       if (list_item->sensor_not_present == 0)
128       {
129         list_item->sensor_not_present = 1;
130
131         INFO ("ipmi plugin: sensor_read_handler: sensor %s "
132             "not present.", list_item->sensor_name);
133
134         if (c_ipmi_nofiy_notpresent)
135         {
136           notification_t n = { NOTIF_WARNING, cdtime (), "", "", "ipmi",
137             "", "", "", NULL };
138
139           sstrncpy (n.host, hostname_g, sizeof (n.host));
140           sstrncpy (n.type_instance, list_item->sensor_name,
141               sizeof (n.type_instance));
142           sstrncpy (n.type, list_item->sensor_type, sizeof (n.type));
143           ssnprintf (n.message, sizeof (n.message),
144               "sensor %s not present", list_item->sensor_name);
145
146           plugin_dispatch_notification (&n);
147         }
148       }
149     }
150     else if (IPMI_IS_IPMI_ERR(err) && IPMI_GET_IPMI_ERR(err) == IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC)
151     {
152       INFO ("ipmi plugin: sensor_read_handler: Sensor %s not ready",
153           list_item->sensor_name);
154     }
155     else
156     {
157       if (IPMI_IS_IPMI_ERR(err))
158         INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
159             "because it failed with IPMI error %#x.",
160             list_item->sensor_name, IPMI_GET_IPMI_ERR(err));
161       else if (IPMI_IS_OS_ERR(err))
162         INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
163             "because it failed with OS error %#x.",
164             list_item->sensor_name, IPMI_GET_OS_ERR(err));
165       else if (IPMI_IS_RMCPP_ERR(err))
166         INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
167             "because it failed with RMCPP error %#x.",
168             list_item->sensor_name, IPMI_GET_RMCPP_ERR(err));
169       else if (IPMI_IS_SOL_ERR(err))
170         INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
171             "because it failed with RMCPP error %#x.",
172             list_item->sensor_name, IPMI_GET_SOL_ERR(err));
173       else
174         INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
175             "because it failed with error %#x. of class %#x",
176             list_item->sensor_name, err & 0xff, err & 0xffffff00);
177       sensor_list_remove (sensor);
178     }
179     return;
180   }
181   else if (list_item->sensor_not_present == 1)
182   {
183     list_item->sensor_not_present = 0;
184
185     INFO ("ipmi plugin: sensor_read_handler: sensor %s present.",
186         list_item->sensor_name);
187
188     if (c_ipmi_nofiy_notpresent)
189     {
190       notification_t n = { NOTIF_OKAY, cdtime (), "", "", "ipmi",
191         "", "", "", NULL };
192
193       sstrncpy (n.host, hostname_g, sizeof (n.host));
194       sstrncpy (n.type_instance, list_item->sensor_name,
195           sizeof (n.type_instance));
196       sstrncpy (n.type, list_item->sensor_type, sizeof (n.type));
197       ssnprintf (n.message, sizeof (n.message),
198           "sensor %s present", list_item->sensor_name);
199
200       plugin_dispatch_notification (&n);
201     }
202   }
203
204   if (value_present != IPMI_BOTH_VALUES_PRESENT)
205   {
206     INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
207         "because it provides %s. If you need this sensor, "
208         "please file a bug report.",
209         list_item->sensor_name,
210         (value_present == IPMI_RAW_VALUE_PRESENT)
211         ? "only the raw value"
212         : "no value");
213     sensor_list_remove (sensor);
214     return;
215   }
216
217   values[0].gauge = value;
218
219   vl.values = values;
220   vl.values_len = 1;
221
222   sstrncpy (vl.host, hostname_g, sizeof (vl.host));
223   sstrncpy (vl.plugin, "ipmi", sizeof (vl.plugin));
224   sstrncpy (vl.type, list_item->sensor_type, sizeof (vl.type));
225   sstrncpy (vl.type_instance, list_item->sensor_name, sizeof (vl.type_instance));
226
227   plugin_dispatch_values (&vl);
228 } /* void sensor_read_handler */
229
230 static int sensor_list_add (ipmi_sensor_t *sensor)
231 {
232   ipmi_sensor_id_t sensor_id;
233   c_ipmi_sensor_list_t *list_item;
234   c_ipmi_sensor_list_t *list_prev;
235
236   char buffer[DATA_MAX_NAME_LEN] = { 0 };
237   const char *entity_id_string;
238   char sensor_name[DATA_MAX_NAME_LEN];
239   char *sensor_name_ptr;
240   int sensor_type;
241   const char *type;
242   ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor);
243
244   sensor_id = ipmi_sensor_convert_to_id (sensor);
245
246   ipmi_sensor_get_name (sensor, buffer, sizeof (buffer));
247   buffer[sizeof (buffer) - 1] = 0;
248
249   entity_id_string = ipmi_entity_get_entity_id_string (ent);
250
251   if (entity_id_string == NULL)
252     sstrncpy (sensor_name, buffer, sizeof (sensor_name));
253   else
254     ssnprintf (sensor_name, sizeof (sensor_name),
255         "%s %s", buffer, entity_id_string);
256
257   sstrncpy (buffer, sensor_name, sizeof (buffer));
258   sensor_name_ptr = strstr (buffer, ").");
259   if (sensor_name_ptr != NULL)
260   {
261     /* If name is something like "foo (123).bar",
262      * change that to "bar (123)".
263      * Both, sensor_name_ptr and sensor_id_ptr point to memory within the
264      * `buffer' array, which holds a copy of the current `sensor_name'. */
265     char *sensor_id_ptr;
266
267     /* `sensor_name_ptr' points to ").bar". */
268     sensor_name_ptr[1] = 0;
269     /* `buffer' holds "foo (123)\0bar\0". */
270     sensor_name_ptr += 2;
271     /* `sensor_name_ptr' now points to "bar". */
272
273     sensor_id_ptr = strstr (buffer, "(");
274     if (sensor_id_ptr != NULL)
275     {
276       /* `sensor_id_ptr' now points to "(123)". */
277       ssnprintf (sensor_name, sizeof (sensor_name),
278           "%s %s", sensor_name_ptr, sensor_id_ptr);
279     }
280     /* else: don't touch sensor_name. */
281   }
282   sensor_name_ptr = sensor_name;
283
284   /* Both `ignorelist' and `plugin_instance' may be NULL. */
285   if (ignorelist_match (ignorelist, sensor_name_ptr) != 0)
286     return (0);
287
288   /* FIXME: Use rate unit or base unit to scale the value */
289
290   sensor_type = ipmi_sensor_get_sensor_type (sensor);
291   switch (sensor_type)
292   {
293     case IPMI_SENSOR_TYPE_TEMPERATURE:
294       type = "temperature";
295       break;
296
297     case IPMI_SENSOR_TYPE_VOLTAGE:
298       type = "voltage";
299       break;
300
301     case IPMI_SENSOR_TYPE_CURRENT:
302       type = "current";
303       break;
304
305     case IPMI_SENSOR_TYPE_FAN:
306       type = "fanspeed";
307       break;
308
309     default:
310       {
311         const char *sensor_type_str;
312
313         sensor_type_str = ipmi_sensor_get_sensor_type_string (sensor);
314         INFO ("ipmi plugin: sensor_list_add: Ignore sensor %s, "
315             "because I don't know how to handle its type (%#x, %s). "
316             "If you need this sensor, please file a bug report.",
317             sensor_name_ptr, sensor_type, sensor_type_str);
318         return (-1);
319       }
320   } /* switch (sensor_type) */
321
322   pthread_mutex_lock (&sensor_list_lock);
323
324   list_prev = NULL;
325   for (list_item = sensor_list;
326       list_item != NULL;
327       list_item = list_item->next)
328   {
329     if (ipmi_cmp_sensor_id (sensor_id, list_item->sensor_id) == 0)
330       break;
331     list_prev = list_item;
332   } /* for (list_item) */
333
334   if (list_item != NULL)
335   {
336     pthread_mutex_unlock (&sensor_list_lock);
337     return (0);
338   }
339
340   list_item = (c_ipmi_sensor_list_t *) calloc (1, sizeof (c_ipmi_sensor_list_t));
341   if (list_item == NULL)
342   {
343     pthread_mutex_unlock (&sensor_list_lock);
344     return (-1);
345   }
346
347   list_item->sensor_id = ipmi_sensor_convert_to_id (sensor);
348
349   if (list_prev != NULL)
350     list_prev->next = list_item;
351   else
352     sensor_list = list_item;
353
354   sstrncpy (list_item->sensor_name, sensor_name_ptr,
355             sizeof (list_item->sensor_name));
356   sstrncpy (list_item->sensor_type, type, sizeof (list_item->sensor_type));
357
358   pthread_mutex_unlock (&sensor_list_lock);
359
360   if (c_ipmi_nofiy_add && (c_ipmi_init_in_progress == 0))
361   {
362     notification_t n = { NOTIF_OKAY, cdtime (), "", "", "ipmi",
363                          "", "", "", NULL };
364
365     sstrncpy (n.host, hostname_g, sizeof (n.host));
366     sstrncpy (n.type_instance, list_item->sensor_name,
367               sizeof (n.type_instance));
368     sstrncpy (n.type, list_item->sensor_type, sizeof (n.type));
369     ssnprintf (n.message, sizeof (n.message),
370               "sensor %s added", list_item->sensor_name);
371
372     plugin_dispatch_notification (&n);
373   }
374
375   return (0);
376 } /* int sensor_list_add */
377
378 static int sensor_list_remove (ipmi_sensor_t *sensor)
379 {
380   ipmi_sensor_id_t sensor_id;
381   c_ipmi_sensor_list_t *list_item;
382   c_ipmi_sensor_list_t *list_prev;
383
384   sensor_id = ipmi_sensor_convert_to_id (sensor);
385
386   pthread_mutex_lock (&sensor_list_lock);
387
388   list_prev = NULL;
389   for (list_item = sensor_list;
390       list_item != NULL;
391       list_item = list_item->next)
392   {
393     if (ipmi_cmp_sensor_id (sensor_id, list_item->sensor_id) == 0)
394       break;
395     list_prev = list_item;
396   } /* for (list_item) */
397
398   if (list_item == NULL)
399   {
400     pthread_mutex_unlock (&sensor_list_lock);
401     return (-1);
402   }
403
404   if (list_prev == NULL)
405     sensor_list = list_item->next;
406   else
407     list_prev->next = list_item->next;
408
409   list_prev = NULL;
410   list_item->next = NULL;
411
412   pthread_mutex_unlock (&sensor_list_lock);
413
414   if (c_ipmi_nofiy_remove && c_ipmi_active)
415   {
416     notification_t n = { NOTIF_WARNING, cdtime (), "", "",
417                          "ipmi", "", "", "", NULL };
418
419     sstrncpy (n.host, hostname_g, sizeof (n.host));
420     sstrncpy (n.type_instance, list_item->sensor_name,
421               sizeof (n.type_instance));
422     sstrncpy (n.type, list_item->sensor_type, sizeof (n.type));
423     ssnprintf (n.message, sizeof (n.message),
424               "sensor %s removed", list_item->sensor_name);
425
426     plugin_dispatch_notification (&n);
427   }
428
429   free (list_item);
430   return (0);
431 } /* int sensor_list_remove */
432
433 static int sensor_list_read_all (void)
434 {
435   pthread_mutex_lock (&sensor_list_lock);
436
437   for (c_ipmi_sensor_list_t *list_item = sensor_list;
438       list_item != NULL;
439       list_item = list_item->next)
440   {
441     ipmi_sensor_id_get_reading (list_item->sensor_id,
442         sensor_read_handler, /* user data = */ list_item);
443   } /* for (list_item) */
444
445   pthread_mutex_unlock (&sensor_list_lock);
446
447   return (0);
448 } /* int sensor_list_read_all */
449
450 static int sensor_list_remove_all (void)
451 {
452   c_ipmi_sensor_list_t *list_item;
453
454   pthread_mutex_lock (&sensor_list_lock);
455
456   list_item = sensor_list;
457   sensor_list = NULL;
458
459   pthread_mutex_unlock (&sensor_list_lock);
460
461   while (list_item != NULL)
462   {
463     c_ipmi_sensor_list_t *list_next = list_item->next;
464
465     free (list_item);
466
467     list_item = list_next;
468   } /* while (list_item) */
469
470   return (0);
471 } /* int sensor_list_remove_all */
472
473 /*
474  * Entity handlers
475  */
476 static void entity_sensor_update_handler (enum ipmi_update_e op,
477     ipmi_entity_t __attribute__((unused)) *entity,
478     ipmi_sensor_t *sensor,
479     void __attribute__((unused)) *user_data)
480 {
481   /* TODO: Ignore sensors we cannot read */
482
483   if ((op == IPMI_ADDED) || (op == IPMI_CHANGED))
484   {
485     /* Will check for duplicate entries.. */
486     sensor_list_add (sensor);
487   }
488   else if (op == IPMI_DELETED)
489   {
490     sensor_list_remove (sensor);
491   }
492 } /* void entity_sensor_update_handler */
493
494 /*
495  * Domain handlers
496  */
497 static void domain_entity_update_handler (enum ipmi_update_e op,
498     ipmi_domain_t __attribute__((unused)) *domain,
499     ipmi_entity_t *entity,
500     void __attribute__((unused)) *user_data)
501 {
502   int status;
503
504   if (op == IPMI_ADDED)
505   {
506     status = ipmi_entity_add_sensor_update_handler (entity,
507         entity_sensor_update_handler, /* user data = */ NULL);
508     if (status != 0)
509     {
510       c_ipmi_error ("ipmi_entity_add_sensor_update_handler", status);
511     }
512   }
513   else if (op == IPMI_DELETED)
514   {
515     status = ipmi_entity_remove_sensor_update_handler (entity,
516         entity_sensor_update_handler, /* user data = */ NULL);
517     if (status != 0)
518     {
519       c_ipmi_error ("ipmi_entity_remove_sensor_update_handler", status);
520     }
521   }
522 } /* void domain_entity_update_handler */
523
524 static void domain_connection_change_handler (ipmi_domain_t *domain,
525     int err,
526     unsigned int conn_num,
527     unsigned int port_num,
528     int still_connected,
529     void *user_data)
530 {
531   int status;
532
533   DEBUG ("domain_connection_change_handler (domain = %p, err = %i, "
534       "conn_num = %u, port_num = %u, still_connected = %i, "
535       "user_data = %p);\n",
536       (void *) domain, err, conn_num, port_num, still_connected, user_data);
537
538   status = ipmi_domain_add_entity_update_handler (domain,
539       domain_entity_update_handler, /* user data = */ NULL);
540   if (status != 0)
541   {
542     c_ipmi_error ("ipmi_domain_add_entity_update_handler", status);
543   }
544 } /* void domain_connection_change_handler */
545
546 static int thread_init (os_handler_t **ret_os_handler)
547 {
548   os_handler_t *os_handler;
549   ipmi_con_t *smi_connection = NULL;
550   ipmi_domain_id_t domain_id;
551   int status;
552
553   os_handler = ipmi_posix_thread_setup_os_handler (SIGIO);
554   if (os_handler == NULL)
555   {
556     ERROR ("ipmi plugin: ipmi_posix_thread_setup_os_handler failed.");
557     return (-1);
558   }
559
560   ipmi_init (os_handler);
561
562   status = ipmi_smi_setup_con (/* if_num = */ 0,
563       os_handler,
564       /* user data = */ NULL,
565       &smi_connection);
566   if (status != 0)
567   {
568     c_ipmi_error ("ipmi_smi_setup_con", status);
569     return (-1);
570   }
571
572   ipmi_open_option_t open_option[1] = {
573     [0] = {
574       .option = IPMI_OPEN_OPTION_ALL,
575       { .ival = 1 }
576     }
577   };
578
579   status = ipmi_open_domain ("mydomain", &smi_connection, /* num_con = */ 1,
580       domain_connection_change_handler, /* user data = */ NULL,
581       /* domain_fully_up_handler = */ NULL, /* user data = */ NULL,
582       open_option, sizeof (open_option) / sizeof (open_option[0]),
583       &domain_id);
584   if (status != 0)
585   {
586     c_ipmi_error ("ipmi_open_domain", status);
587     return (-1);
588   }
589
590   *ret_os_handler = os_handler;
591   return (0);
592 } /* int thread_init */
593
594 static void *thread_main (void __attribute__((unused)) *user_data)
595 {
596   int status;
597   os_handler_t *os_handler = NULL;
598
599   status = thread_init (&os_handler);
600   if (status != 0)
601   {
602     ERROR ("ipmi plugin: thread_init failed.\n");
603     return ((void *) -1);
604   }
605
606   while (c_ipmi_active != 0)
607   {
608     struct timeval tv = { 1, 0 };
609     os_handler->perform_one_op (os_handler, &tv);
610   }
611
612   ipmi_posix_thread_free_os_handler (os_handler);
613
614   return ((void *) 0);
615 } /* void *thread_main */
616
617 static int c_ipmi_config (const char *key, const char *value)
618 {
619   if (ignorelist == NULL)
620     ignorelist = ignorelist_create (/* invert = */ 1);
621   if (ignorelist == NULL)
622     return (1);
623
624   if (strcasecmp ("Sensor", key) == 0)
625   {
626     ignorelist_add (ignorelist, value);
627   }
628   else if (strcasecmp ("IgnoreSelected", key) == 0)
629   {
630     int invert = 1;
631     if (IS_TRUE (value))
632       invert = 0;
633     ignorelist_set_invert (ignorelist, invert);
634   }
635   else if (strcasecmp ("NotifySensorAdd", key) == 0)
636   {
637     if (IS_TRUE (value))
638       c_ipmi_nofiy_add = 1;
639   }
640   else if (strcasecmp ("NotifySensorRemove", key) == 0)
641   {
642     if (IS_TRUE (value))
643       c_ipmi_nofiy_remove = 1;
644   }
645   else if (strcasecmp ("NotifySensorNotPresent", key) == 0)
646   {
647     if (IS_TRUE (value))
648       c_ipmi_nofiy_notpresent = 1;
649   }
650   else
651   {
652     return (-1);
653   }
654
655   return (0);
656 } /* int c_ipmi_config */
657
658 static int c_ipmi_init (void)
659 {
660   int status;
661
662   /* Don't send `ADD' notifications during startup (~ 1 minute) */
663   time_t iv = CDTIME_T_TO_TIME_T (plugin_get_interval ());
664   c_ipmi_init_in_progress = 1 + (60 / iv);
665
666   c_ipmi_active = 1;
667
668   status = plugin_thread_create (&thread_id, /* attr = */ NULL, thread_main,
669       /* user data = */ NULL);
670   if (status != 0)
671   {
672     c_ipmi_active = 0;
673     thread_id = (pthread_t) 0;
674     ERROR ("ipmi plugin: pthread_create failed.");
675     return (-1);
676   }
677
678   return (0);
679 } /* int c_ipmi_init */
680
681 static int c_ipmi_read (void)
682 {
683   if ((c_ipmi_active == 0) || (thread_id == (pthread_t) 0))
684   {
685     INFO ("ipmi plugin: c_ipmi_read: I'm not active, returning false.");
686     return (-1);
687   }
688
689   sensor_list_read_all ();
690
691   if (c_ipmi_init_in_progress > 0)
692     c_ipmi_init_in_progress--;
693   else
694     c_ipmi_init_in_progress = 0;
695
696   return (0);
697 } /* int c_ipmi_read */
698
699 static int c_ipmi_shutdown (void)
700 {
701   c_ipmi_active = 0;
702
703   if (thread_id != (pthread_t) 0)
704   {
705     pthread_join (thread_id, NULL);
706     thread_id = (pthread_t) 0;
707   }
708
709   sensor_list_remove_all ();
710
711   return (0);
712 } /* int c_ipmi_shutdown */
713
714 void module_register (void)
715 {
716   plugin_register_config ("ipmi", c_ipmi_config,
717       config_keys, config_keys_num);
718   plugin_register_init ("ipmi", c_ipmi_init);
719   plugin_register_read ("ipmi", c_ipmi_read);
720   plugin_register_shutdown ("ipmi", c_ipmi_shutdown);
721 } /* void module_register */
722
723 /* vim: set sw=2 sts=2 ts=8 fdm=marker et : */