projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1842 from rubenk/declare-loop-variable-in-for-loop-controlling...
[collectd.git]
/
src
/
mysql.c
diff --git
a/src/mysql.c
b/src/mysql.c
index
a239413
..
1bc0fdf
100644
(file)
--- a/
src/mysql.c
+++ b/
src/mysql.c
@@
-28,6
+28,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
@@
-71,7
+72,7
@@
static void mysql_database_free (void *arg) /* {{{ */
DEBUG ("mysql plugin: mysql_database_free (arg = %p);", arg);
DEBUG ("mysql plugin: mysql_database_free (arg = %p);", arg);
- db =
(mysql_database_t *)
arg;
+ db = arg;
if (db == NULL)
return;
if (db == NULL)
return;
@@
-103,7
+104,6
@@
static int mysql_config_database (oconfig_item_t *ci) /* {{{ */
{
mysql_database_t *db;
int status = 0;
{
mysql_database_t *db;
int status = 0;
- int i;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
@@
-143,7
+143,7
@@
static int mysql_config_database (oconfig_item_t *ci) /* {{{ */
assert (db->instance != NULL);
/* Fill the `mysql_database_t' structure.. */
assert (db->instance != NULL);
/* Fill the `mysql_database_t' structure.. */
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;
@@
-191,13
+191,12
@@
static int mysql_config_database (oconfig_item_t *ci) /* {{{ */
/* If all went well, register this database for reading */
if (status == 0)
{
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud;
+ user_data_t ud
= { 0 }
;
char cb_name[DATA_MAX_NAME_LEN];
DEBUG ("mysql plugin: Registering new read callback: %s",
(db->database != NULL) ? db->database : "<default>");
char cb_name[DATA_MAX_NAME_LEN];
DEBUG ("mysql plugin: Registering new read callback: %s",
(db->database != NULL) ? db->database : "<default>");
- memset (&ud, 0, sizeof (ud));
ud.data = (void *) db;
ud.free_func = mysql_database_free;
ud.data = (void *) db;
ud.free_func = mysql_database_free;
@@
-222,13
+221,11
@@
static int mysql_config_database (oconfig_item_t *ci) /* {{{ */
static int mysql_config (oconfig_item_t *ci) /* {{{ */
{
static int mysql_config (oconfig_item_t *ci) /* {{{ */
{
- int i;
-
if (ci == NULL)
return (EINVAL);
/* Fill the `mysql_database_t' structure.. */
if (ci == NULL)
return (EINVAL);
/* Fill the `mysql_database_t' structure.. */
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;
@@
-904,6
+901,10
@@
static int mysql_read (user_data_t *ud)
counter_submit ("mysql_sort", "scan", val, db);
}
counter_submit ("mysql_sort", "scan", val, db);
}
+ else if (strncmp (key, "Slow_queries", strlen ("Slow_queries")) == 0)
+ {
+ counter_submit ("mysql_slow_queries", NULL , val, db);
+ }
}
mysql_free_result (res); res = NULL;
}
mysql_free_result (res); res = NULL;