projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unixsock plugin: Use `format_name' rather than the local `cache_alloc_name'.
[collectd.git]
/
src
/
mysql.c
diff --git
a/src/mysql.c
b/src/mysql.c
index
a928172
..
92b49bf
100644
(file)
--- a/
src/mysql.c
+++ b/
src/mysql.c
@@
-113,14
+113,12
@@
static MYSQL *getconnection (void)
static int wait_for = 0;
static int wait_increase = 60;
static int wait_for = 0;
static int wait_increase = 60;
- int step;
-
if (state != 0)
{
int err;
if ((err = mysql_ping (con)) != 0)
{
if (state != 0)
{
int err;
if ((err = mysql_ping (con)) != 0)
{
-
syslog (LOG_WARNING,
"mysql_ping failed: %s", mysql_error (con));
+
WARNING (
"mysql_ping failed: %s", mysql_error (con));
state = 0;
}
else
state = 0;
}
else
@@
-130,11
+128,9
@@
static MYSQL *getconnection (void)
}
}
}
}
- step = atoi (COLLECTD_STEP);
-
if (wait_for > 0)
{
if (wait_for > 0)
{
- wait_for -=
step
;
+ wait_for -=
interval_g
;
return (NULL);
}
return (NULL);
}
@@
-145,14
+141,14
@@
static MYSQL *getconnection (void)
if ((con = mysql_init (con)) == NULL)
{
if ((con = mysql_init (con)) == NULL)
{
-
syslog (LOG_ERR,
"mysql_init failed: %s", mysql_error (con));
+
ERROR (
"mysql_init failed: %s", mysql_error (con));
state = 0;
return (NULL);
}
if (mysql_real_connect (con, host, user, pass, db, 0, NULL, 0) == NULL)
{
state = 0;
return (NULL);
}
if (mysql_real_connect (con, host, user, pass, db, 0, NULL, 0) == NULL)
{
-
syslog (LOG_ERR,
"mysql_real_connect failed: %s", mysql_error (con));
+
ERROR (
"mysql_real_connect failed: %s", mysql_error (con));
state = 0;
return (NULL);
}
state = 0;
return (NULL);
}
@@
-190,7
+186,7
@@
static void counter_submit (const char *type, const char *type_instance,
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname);
+ strcpy (vl.host, hostname
_g
);
strcpy (vl.plugin, "mysql");
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
strcpy (vl.plugin, "mysql");
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
@@
-213,7
+209,7
@@
static void qcache_submit (counter_t hits, counter_t inserts,
vl.values = values;
vl.values_len = 5;
vl.time = time (NULL);
vl.values = values;
vl.values_len = 5;
vl.time = time (NULL);
- strcpy (vl.host, hostname);
+ strcpy (vl.host, hostname
_g
);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_qcache", &vl);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_qcache", &vl);
@@
-233,7
+229,7
@@
static void threads_submit (gauge_t running, gauge_t connected, gauge_t cached,
vl.values = values;
vl.values_len = 4;
vl.time = time (NULL);
vl.values = values;
vl.values_len = 4;
vl.time = time (NULL);
- strcpy (vl.host, hostname);
+ strcpy (vl.host, hostname
_g
);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_threads", &vl);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_threads", &vl);
@@
-250,7
+246,7
@@
static void traffic_submit (counter_t rx, counter_t tx)
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname);
+ strcpy (vl.host, hostname
_g
);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_octets", &vl);
strcpy (vl.plugin, "mysql");
plugin_dispatch_values ("mysql_octets", &vl);
@@
-291,14
+287,14
@@
static int mysql_read (void)
if (mysql_real_query (con, query, query_len))
{
if (mysql_real_query (con, query, query_len))
{
-
syslog (LOG_ERR,
"mysql_real_query failed: %s\n",
+
ERROR (
"mysql_real_query failed: %s\n",
mysql_error (con));
return (-1);
}
if ((res = mysql_store_result (con)) == NULL)
{
mysql_error (con));
return (-1);
}
if ((res = mysql_store_result (con)) == NULL)
{
-
syslog (LOG_ERR,
"mysql_store_result failed: %s\n",
+
ERROR (
"mysql_store_result failed: %s\n",
mysql_error (con));
return (-1);
}
mysql_error (con));
return (-1);
}