nut plugin: Added a plugin to query the `upsd' from the `network ups tools'.
[collectd.git] / src / serial.c
index 8f8e433..c278672 100644 (file)
@@ -80,7 +80,9 @@ static int serial_read (void)
        if ((fh = fopen ("/proc/tty/driver/serial", "r")) == NULL &&
                (fh = fopen ("/proc/tty/driver/ttyS", "r")) == NULL)
        {
-               syslog (LOG_WARNING, "serial: fopen: %s", strerror (errno));
+               char errbuf[1024];
+               WARNING ("serial: fopen: %s",
+                               sstrerror (errno, errbuf, sizeof (errbuf)));
                return (-1);
        }
 
@@ -134,11 +136,13 @@ static int serial_read (void)
 } /* int serial_read */
 #endif /* SERIAL_HAVE_READ */
 
-void module_register (void)
+void module_register (modreg_e load)
 {
-       plugin_register_data_set (&octets_ds);
+       if (load & MR_DATASETS)
+               plugin_register_data_set (&octets_ds);
 
 #if SERIAL_HAVE_READ
-       plugin_register_read ("serial", serial_read);
+       if (load & MR_READ)
+               plugin_register_read ("serial", serial_read);
 #endif /* SERIAL_HAVE_READ */
-}
+} /* void module_register */