+static lcc_connection_t *collectd_connection = NULL;
+
+static int data_provider_ident_flush (const graph_ident_t *ident) /* {{{ */
+{
+ char *ident_str;
+ lcc_identifier_t ident_lcc;
+ int status;
+
+ if (ident == NULL)
+ return (EINVAL);
+
+ ident_str = ident_to_string (ident);
+ if (ident_str == NULL)
+ return (ENOMEM);
+
+ if (collectd_connection == NULL)
+ {
+ /* TODO: Make socket path configurable */
+ status = lcc_connect (/* path = */ "/var/run/collectd-unixsock",
+ &collectd_connection);
+ if (status != 0)
+ {
+ assert (collectd_connection == NULL);
+ fprintf (stderr, "data_provider_ident_flush: lcc_connect failed "
+ "with status %i.\n", status);
+ return (status);
+ }
+ assert (collectd_connection != NULL);
+ }
+
+ memset (&ident_lcc, 0, sizeof (ident_lcc));
+ status = lcc_string_to_identifier (collectd_connection,
+ &ident_lcc, ident_str);
+ if (status != 0)
+ {
+ fprintf (stderr, "data_provider_ident_flush: lcc_string_to_identifier "
+ "failed: %s (%i)\n",
+ lcc_strerror (collectd_connection), status);
+ free (ident_str);
+ return (status);
+ }
+
+ status = lcc_flush (collectd_connection,
+ /* write-plugin = */ NULL,
+ /* identifier = */ &ident_lcc,
+ /* timeout = */ -1);
+ if (status != 0)
+ {
+ fprintf (stderr, "data_provider_ident_flush: lcc_flush (\"%s\") failed: %s (%i)\n",
+ ident_str, lcc_strerror (collectd_connection), status);
+ free (ident_str);
+
+ lcc_disconnect (collectd_connection);
+ collectd_connection = NULL;
+
+ return (status);
+ }
+
+ /* fprintf (stderr, "data_provider_ident_flush: lcc_flush (\"%s\") succeeded.\n", ident_str); */
+ free (ident_str);
+ return (0);
+} /* }}} int data_provider_ident_flush */
+