summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03576db)
raw | patch | inline | side by side (parent: 03576db)
author | Mirko Buffoni <briareos@eswat.org> | |
Wed, 29 Oct 2008 11:24:04 +0000 (12:24 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sat, 8 Nov 2008 14:34:28 +0000 (15:34 +0100) |
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>
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>
src/mysql.c | patch | blob | history |
diff --git a/src/mysql.c b/src/mysql.c
index 4e72b5bf8989669cafb724ce011cc8b0a28cc2ee..08df3fa81d4c3045b592335a6ab9e0e663214048 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
"User",
"Password",
"Database",
+ "Port",
+ "Socket",
NULL
};
-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 *socket = NULL;
+static int port = 0;
static MYSQL *getconnection (void)
{
return (NULL);
}
- 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;
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);
else
return (-1);
}