static int wait_for = 0;
static int wait_increase = 60;
- int step;
-
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
}
}
- step = atoi (COLLECTD_STEP);
-
if (wait_for > 0)
{
- wait_for -= step;
+ wait_for -= interval_g;
return (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)
{
- syslog (LOG_ERR, "mysql_real_connect failed: %s", mysql_error (con));
+ ERROR ("mysql_real_connect failed: %s", mysql_error (con));
state = 0;
return (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));
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);
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);
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);
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)
{
- syslog (LOG_ERR, "mysql_store_result failed: %s\n",
+ ERROR ("mysql_store_result failed: %s\n",
mysql_error (con));
return (-1);
}