Hi,
I have a patch for mysql collectd library.
The patch allow to specify also Port and Socket
parameters for those who have a non-standard configuration
of mysql.
It's very straightforward. If accepted, there is only to
change documentation and config file to reflect the new
parameters.
Enjoy
Mirko
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
"User",
"Password",
"Database",
"User",
"Password",
"Database",
-static int config_keys_num = 4;
+static int config_keys_num = 6;
static char *host = "localhost";
static char *user;
static char *pass;
static char *db = NULL;
static char *host = "localhost";
static char *user;
static char *pass;
static char *db = NULL;
+static char *socket = NULL;
+static int port = 0;
static MYSQL *getconnection (void)
{
static MYSQL *getconnection (void)
{
- if (mysql_real_connect (con, host, user, pass, db, 0, NULL, 0) == NULL)
+ if (mysql_real_connect (con, host, user, pass, db, port, socket, 0) == NULL)
{
ERROR ("mysql_real_connect failed: %s", mysql_error (con));
state = 0;
{
ERROR ("mysql_real_connect failed: %s", mysql_error (con));
state = 0;
return ((pass = strdup (value)) == NULL ? 1 : 0);
else if (strcasecmp (key, "database") == 0)
return ((db = strdup (value)) == NULL ? 1 : 0);
return ((pass = strdup (value)) == NULL ? 1 : 0);
else if (strcasecmp (key, "database") == 0)
return ((db = strdup (value)) == NULL ? 1 : 0);
+ else if (strcasecmp (key, "socket") == 0)
+ return ((socket = strdup (value)) == NULL ? 1 : 0);
+ else if (strcasecmp (key, "port") == 0)
+ return ((port = atoi (value)) == NULL ? 1 : 0);