X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmysql.c;h=444acaa26aef33ed1d858e78564f52adec599f05;hb=089d33f1f455da115ca0c87160df8dbd49286377;hp=9014e5ff2c31781b727526b0bea646f7e47820e1;hpb=7e5df1a2c6611bd4ac9fb8ac4b78106f9139ae6e;p=collectd.git diff --git a/src/mysql.c b/src/mysql.c index 9014e5ff..444acaa2 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -28,15 +28,8 @@ #include #endif -#if HAVE_LIBMYSQLCLIENT -# define MYSQL_HAVE_READ 1 -#else -# define MYSQL_HAVE_READ 0 -#endif - /* TODO: Understand `Select_*' and possibly do that stuff as well.. */ -#if MYSQL_HAVE_READ static const char *config_keys[] = { "Host", @@ -135,9 +128,10 @@ static void counter_submit (const char *type, const char *type_instance, vl.time = time (NULL); strcpy (vl.host, hostname_g); strcpy (vl.plugin, "mysql"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - plugin_dispatch_values (type, &vl); + plugin_dispatch_values (&vl); } /* void counter_submit */ static void qcache_submit (counter_t hits, counter_t inserts, @@ -158,8 +152,9 @@ static void qcache_submit (counter_t hits, counter_t inserts, vl.time = time (NULL); strcpy (vl.host, hostname_g); strcpy (vl.plugin, "mysql"); + strcpy (vl.type, "mysql_qcache"); - plugin_dispatch_values ("mysql_qcache", &vl); + plugin_dispatch_values (&vl); } /* void qcache_submit */ static void threads_submit (gauge_t running, gauge_t connected, gauge_t cached, @@ -178,8 +173,9 @@ static void threads_submit (gauge_t running, gauge_t connected, gauge_t cached, vl.time = time (NULL); strcpy (vl.host, hostname_g); strcpy (vl.plugin, "mysql"); + strcpy (vl.type, "mysql_threads"); - plugin_dispatch_values ("mysql_threads", &vl); + plugin_dispatch_values (&vl); } /* void threads_submit */ static void traffic_submit (counter_t rx, counter_t tx) @@ -195,8 +191,9 @@ static void traffic_submit (counter_t rx, counter_t tx) vl.time = time (NULL); strcpy (vl.host, hostname_g); strcpy (vl.plugin, "mysql"); + strcpy (vl.type, "mysql_octets"); - plugin_dispatch_values ("mysql_octets", &vl); + plugin_dispatch_values (&vl); } /* void traffic_submit */ static int mysql_read (void) @@ -322,12 +319,9 @@ static int mysql_read (void) return (0); } /* int mysql_read */ -#endif /* MYSQL_HAVE_READ */ void module_register (void) { -#if MYSQL_HAVE_READ plugin_register_config ("mysql", config, config_keys, config_keys_num); plugin_register_read ("mysql", mysql_read); -#endif /* MYSQL_HAVE_READ */ } /* void module_register */