Merge branch 'collectd-3.11' into collectd-4.0
[collectd.git] / src / serial.c
index 6ca752c..dd063bb 100644 (file)
 # define SERIAL_HAVE_READ 0
 #endif
 
-static data_source_t octets_dsrc[2] =
-{
-       {"rx", DS_TYPE_COUNTER, 0, 4294967295.0},
-       {"tx", DS_TYPE_COUNTER, 0, 4294967295.0}
-};
-
-static data_set_t octets_ds =
-{
-       "serial_octets", 2, octets_dsrc
-};
-
 #if SERIAL_HAVE_READ
 static void serial_submit (const char *type_instance,
                counter_t rx, counter_t tx)
@@ -55,7 +44,7 @@ static void serial_submit (const char *type_instance,
        vl.values = values;
        vl.values_len = 2;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname);
+       strcpy (vl.host, hostname_g);
        strcpy (vl.plugin, "serial");
        strncpy (vl.type_instance, type_instance,
                        sizeof (vl.type_instance));
@@ -80,7 +69,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);
        }
 
@@ -136,9 +127,7 @@ static int serial_read (void)
 
 void module_register (void)
 {
-       plugin_register_data_set (&octets_ds);
-
 #if SERIAL_HAVE_READ
        plugin_register_read ("serial", serial_read);
 #endif /* SERIAL_HAVE_READ */
-}
+} /* void module_register */