X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmemcached.c;h=ab9de56fbba2516b5b37adccc3727eb1905761e6;hb=77243847767b4bc2ea6600a5f88ef45f2a8ec713;hp=535ea84704b3dac328a5af495f69bccdbdfedb9a;hpb=7fc4c1f412c4002b787b5ce24b08e3091ced08a5;p=collectd.git diff --git a/src/memcached.c b/src/memcached.c index 535ea847..ab9de56f 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -84,6 +84,15 @@ static int memcached_connect_unix (memcached_t *st) return (-1); } + /* connect to the memcached daemon */ + int status = connect (fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)); + if (status != 0) + { + shutdown (fd, SHUT_RDWR); + close (fd); + fd = -1; + } + return (fd); } /* int memcached_connect_unix */ @@ -378,7 +387,7 @@ static int memcached_read (user_data_t *user_data) /* * For an explanation on these fields please refer to - * + * */ /* @@ -428,6 +437,10 @@ static int memcached_read (user_data_t *user_data) { submit_gauge ("memcached_connections", "current", atof (fields[2]), st); } + else if (FIELD_IS ("listen_disabled_num")) + { + submit_derive ("memcached_connections", "listen_disabled", atof (fields[2]), st); + } /* * Commands @@ -552,7 +565,7 @@ static int memcached_add_read_callback (memcached_t *st) status = plugin_register_complex_read (/* group = */ "memcached", /* name = */ callback_name, /* callback = */ memcached_read, - /* interval = */ NULL, + /* interval = */ 0, /* user_data = */ &ud); return (status); } /* int memcached_add_read_callback */