1 /**
2 * collectd - src/dbi.c
3 * Copyright (C) 2008,2009 Florian octo Forster
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * Authors:
19 * Florian octo Forster <octo at verplant.org>
20 **/
22 #include "collectd.h"
23 #include "common.h"
24 #include "plugin.h"
25 #include "configfile.h"
26 #include "utils_db_query.h"
28 #include <dbi/dbi.h>
30 /*
31 * Data types
32 */
33 struct cdbi_driver_option_s /* {{{ */
34 {
35 char *key;
36 char *value;
37 };
38 typedef struct cdbi_driver_option_s cdbi_driver_option_t; /* }}} */
40 struct cdbi_database_s /* {{{ */
41 {
42 char *name;
43 char *select_db;
45 char *driver;
46 cdbi_driver_option_t *driver_options;
47 size_t driver_options_num;
49 udb_query_t **queries;
50 size_t queries_num;
52 dbi_conn connection;
53 };
54 typedef struct cdbi_database_s cdbi_database_t; /* }}} */
56 /*
57 * Global variables
58 */
59 static udb_query_t **queries = NULL;
60 static size_t queries_num = 0;
61 static cdbi_database_t **databases = NULL;
62 static size_t databases_num = 0;
64 /*
65 * Functions
66 */
67 static const char *cdbi_strerror (dbi_conn conn, /* {{{ */
68 char *buffer, size_t buffer_size)
69 {
70 const char *msg;
71 int status;
73 if (conn == NULL)
74 {
75 sstrncpy (buffer, "connection is NULL", buffer_size);
76 return (buffer);
77 }
79 msg = NULL;
80 status = dbi_conn_error (conn, &msg);
81 if ((status >= 0) && (msg != NULL))
82 ssnprintf (buffer, buffer_size, "%s (status %i)", msg, status);
83 else
84 ssnprintf (buffer, buffer_size, "dbi_conn_error failed with status %i",
85 status);
87 return (buffer);
88 } /* }}} const char *cdbi_conn_error */
90 static int cdbi_result_get_field (dbi_result res, /* {{{ */
91 unsigned int index, char *buffer, size_t buffer_size)
92 {
93 unsigned short src_type;
95 src_type = dbi_result_get_field_type_idx (res, index);
96 if (src_type == DBI_TYPE_ERROR)
97 {
98 ERROR ("dbi plugin: cdbi_result_get: "
99 "dbi_result_get_field_type_idx failed.");
100 return (-1);
101 }
103 if (src_type == DBI_TYPE_INTEGER)
104 {
105 long long value;
107 value = dbi_result_get_longlong_idx (res, index);
108 ssnprintf (buffer, buffer_size, "%lli", value);
109 }
110 else if (src_type == DBI_TYPE_DECIMAL)
111 {
112 double value;
114 value = dbi_result_get_double_idx (res, index);
115 ssnprintf (buffer, buffer_size, "%63.15g", value);
116 }
117 else if (src_type == DBI_TYPE_STRING)
118 {
119 const char *value;
121 value = dbi_result_get_string_idx (res, index);
122 if (value == NULL)
123 sstrncpy (buffer, "", buffer_size);
124 else if (strcmp ("ERROR", value) == 0)
125 return (-1);
126 else
127 sstrncpy (buffer, value, buffer_size);
128 }
129 /* DBI_TYPE_BINARY */
130 /* DBI_TYPE_DATETIME */
131 else
132 {
133 const char *field_name;
135 field_name = dbi_result_get_field_name (res, index);
136 if (field_name == NULL)
137 field_name = "<unknown>";
139 ERROR ("dbi plugin: Column `%s': Don't know how to handle "
140 "source type %hu.",
141 field_name, src_type);
142 return (-1);
143 }
145 return (0);
146 } /* }}} int cdbi_result_get_field */
148 static void cdbi_database_free (cdbi_database_t *db) /* {{{ */
149 {
150 size_t i;
152 if (db == NULL)
153 return;
155 sfree (db->name);
156 sfree (db->driver);
158 for (i = 0; i < db->driver_options_num; i++)
159 {
160 sfree (db->driver_options[i].key);
161 sfree (db->driver_options[i].value);
162 }
163 sfree (db->driver_options);
165 sfree (db);
166 } /* }}} void cdbi_database_free */
168 /* Configuration handling functions {{{
169 *
170 * <Plugin dbi>
171 * <Query "plugin_instance0">
172 * Statement "SELECT name, value FROM table"
173 * <Result>
174 * Type "gauge"
175 * InstancesFrom "name"
176 * ValuesFrom "value"
177 * </Result>
178 * ...
179 * </Query>
180 *
181 * <Database "plugin_instance1">
182 * Driver "mysql"
183 * DriverOption "hostname" "localhost"
184 * ...
185 * Query "plugin_instance0"
186 * </Database>
187 * </Plugin>
188 */
190 static int cdbi_config_set_string (char **ret_string, /* {{{ */
191 oconfig_item_t *ci)
192 {
193 char *string;
195 if ((ci->values_num != 1)
196 || (ci->values[0].type != OCONFIG_TYPE_STRING))
197 {
198 WARNING ("dbi plugin: The `%s' config option "
199 "needs exactly one string argument.", ci->key);
200 return (-1);
201 }
203 string = strdup (ci->values[0].value.string);
204 if (string == NULL)
205 {
206 ERROR ("dbi plugin: strdup failed.");
207 return (-1);
208 }
210 if (*ret_string != NULL)
211 free (*ret_string);
212 *ret_string = string;
214 return (0);
215 } /* }}} int cdbi_config_set_string */
217 static int cdbi_config_add_database_driver_option (cdbi_database_t *db, /* {{{ */
218 oconfig_item_t *ci)
219 {
220 cdbi_driver_option_t *option;
222 if ((ci->values_num != 2)
223 || (ci->values[0].type != OCONFIG_TYPE_STRING)
224 || (ci->values[1].type != OCONFIG_TYPE_STRING))
225 {
226 WARNING ("dbi plugin: The `DriverOption' config option "
227 "needs exactly two string arguments.");
228 return (-1);
229 }
231 option = (cdbi_driver_option_t *) realloc (db->driver_options,
232 sizeof (*option) * (db->driver_options_num + 1));
233 if (option == NULL)
234 {
235 ERROR ("dbi plugin: realloc failed");
236 return (-1);
237 }
239 db->driver_options = option;
240 option = db->driver_options + db->driver_options_num;
242 option->key = strdup (ci->values[0].value.string);
243 if (option->key == NULL)
244 {
245 ERROR ("dbi plugin: strdup failed.");
246 return (-1);
247 }
249 option->value = strdup (ci->values[1].value.string);
250 if (option->value == NULL)
251 {
252 ERROR ("dbi plugin: strdup failed.");
253 sfree (option->key);
254 return (-1);
255 }
257 db->driver_options_num++;
258 return (0);
259 } /* }}} int cdbi_config_add_database_driver_option */
261 static int cdbi_config_add_database (oconfig_item_t *ci) /* {{{ */
262 {
263 cdbi_database_t *db;
264 int status;
265 int i;
267 if ((ci->values_num != 1)
268 || (ci->values[0].type != OCONFIG_TYPE_STRING))
269 {
270 WARNING ("dbi plugin: The `Database' block "
271 "needs exactly one string argument.");
272 return (-1);
273 }
275 db = (cdbi_database_t *) malloc (sizeof (*db));
276 if (db == NULL)
277 {
278 ERROR ("dbi plugin: malloc failed.");
279 return (-1);
280 }
281 memset (db, 0, sizeof (*db));
283 status = cdbi_config_set_string (&db->name, ci);
284 if (status != 0)
285 {
286 sfree (db);
287 return (status);
288 }
290 /* Fill the `cdbi_database_t' structure.. */
291 for (i = 0; i < ci->children_num; i++)
292 {
293 oconfig_item_t *child = ci->children + i;
295 if (strcasecmp ("Driver", child->key) == 0)
296 status = cdbi_config_set_string (&db->driver, child);
297 else if (strcasecmp ("DriverOption", child->key) == 0)
298 status = cdbi_config_add_database_driver_option (db, child);
299 else if (strcasecmp ("SelectDB", child->key) == 0)
300 status = cdbi_config_set_string (&db->select_db, child);
301 else if (strcasecmp ("Query", child->key) == 0)
302 status = udb_query_pick_from_list (child, queries, queries_num,
303 &db->queries, &db->queries_num);
304 else
305 {
306 WARNING ("dbi plugin: Option `%s' not allowed here.", child->key);
307 status = -1;
308 }
310 if (status != 0)
311 break;
312 }
314 /* Check that all necessary options have been given. */
315 while (status == 0)
316 {
317 if (db->driver == NULL)
318 {
319 WARNING ("dbi plugin: `Driver' not given for database `%s'", db->name);
320 status = -1;
321 }
322 if (db->driver_options_num == 0)
323 {
324 WARNING ("dbi plugin: No `DriverOption' given for database `%s'. "
325 "This will likely not work.", db->name);
326 }
328 break;
329 } /* while (status == 0) */
331 /* If all went well, add this database to the global list of databases. */
332 if (status == 0)
333 {
334 cdbi_database_t **temp;
336 temp = (cdbi_database_t **) realloc (databases,
337 sizeof (*databases) * (databases_num + 1));
338 if (temp == NULL)
339 {
340 ERROR ("dbi plugin: realloc failed");
341 status = -1;
342 }
343 else
344 {
345 databases = temp;
346 databases[databases_num] = db;
347 databases_num++;
348 }
349 }
351 if (status != 0)
352 {
353 cdbi_database_free (db);
354 return (-1);
355 }
357 return (0);
358 } /* }}} int cdbi_config_add_database */
360 static int cdbi_config (oconfig_item_t *ci) /* {{{ */
361 {
362 int i;
364 for (i = 0; i < ci->children_num; i++)
365 {
366 oconfig_item_t *child = ci->children + i;
367 if (strcasecmp ("Query", child->key) == 0)
368 udb_query_create (&queries, &queries_num, child,
369 /* callback = */ NULL, /* legacy mode = */ 0);
370 else if (strcasecmp ("Database", child->key) == 0)
371 cdbi_config_add_database (child);
372 else
373 {
374 WARNING ("snmp plugin: Ignoring unknown config option `%s'.", child->key);
375 }
376 } /* for (ci->children) */
378 return (0);
379 } /* }}} int cdbi_config */
381 /* }}} End of configuration handling functions */
383 static int cdbi_init (void) /* {{{ */
384 {
385 static int did_init = 0;
386 int status;
388 if (did_init != 0)
389 return (0);
391 if (queries_num == 0)
392 {
393 ERROR ("dbi plugin: No <Query> blocks have been found. Without them, "
394 "this plugin can't do anything useful, so we will returns an error.");
395 return (-1);
396 }
398 if (databases_num == 0)
399 {
400 ERROR ("dbi plugin: No <Database> blocks have been found. Without them, "
401 "this plugin can't do anything useful, so we will returns an error.");
402 return (-1);
403 }
405 status = dbi_initialize (NULL);
406 if (status < 0)
407 {
408 ERROR ("dbi plugin: cdbi_init: dbi_initialize failed with status %i.",
409 status);
410 return (-1);
411 }
412 else if (status == 0)
413 {
414 ERROR ("dbi plugin: `dbi_initialize' could not load any drivers. Please "
415 "install at least one `DBD' or check your installation.");
416 return (-1);
417 }
418 DEBUG ("dbi plugin: cdbi_init: dbi_initialize reports %i driver%s.",
419 status, (status == 1) ? "" : "s");
421 return (0);
422 } /* }}} int cdbi_init */
424 static int cdbi_read_database_query (cdbi_database_t *db, /* {{{ */
425 udb_query_t *q)
426 {
427 const char *statement;
428 dbi_result res;
429 size_t column_num;
430 char **column_names;
431 char **column_values;
432 int status;
433 size_t i;
435 /* Macro that cleans up dynamically allocated memory and returns the
436 * specified status. */
437 #define BAIL_OUT(status) \
438 if (column_names != NULL) { sfree (column_names[0]); sfree (column_names); } \
439 if (column_values != NULL) { sfree (column_values[0]); sfree (column_values); } \
440 if (res != NULL) { dbi_result_free (res); res = NULL; } \
441 return (status)
443 column_names = NULL;
444 column_values = NULL;
445 res = NULL;
447 statement = udb_query_get_statement (q);
448 assert (statement != NULL);
450 res = dbi_conn_query (db->connection, statement);
451 if (res == NULL)
452 {
453 char errbuf[1024];
454 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
455 "dbi_conn_query failed: %s",
456 db->name, udb_query_get_name (q),
457 cdbi_strerror (db->connection, errbuf, sizeof (errbuf)));
458 BAIL_OUT (-1);
459 }
460 else /* Get the number of columns */
461 {
462 unsigned int db_status;
464 db_status = dbi_result_get_numfields (res);
465 if (db_status == DBI_FIELD_ERROR)
466 {
467 char errbuf[1024];
468 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
469 "dbi_result_get_numfields failed: %s",
470 db->name, udb_query_get_name (q),
471 cdbi_strerror (db->connection, errbuf, sizeof (errbuf)));
472 BAIL_OUT (-1);
473 }
475 column_num = (size_t) db_status;
476 DEBUG ("cdbi_read_database_query (%s, %s): There are %zu columns.",
477 db->name, udb_query_get_name (q), column_num);
478 }
480 /* Allocate `column_names' and `column_values'. {{{ */
481 column_names = (char **) calloc (column_num, sizeof (char *));
482 if (column_names == NULL)
483 {
484 ERROR ("dbi plugin: malloc failed.");
485 BAIL_OUT (-1);
486 }
488 column_names[0] = (char *) calloc (column_num,
489 DATA_MAX_NAME_LEN * sizeof (char));
490 if (column_names[0] == NULL)
491 {
492 ERROR ("dbi plugin: malloc failed.");
493 BAIL_OUT (-1);
494 }
495 for (i = 1; i < column_num; i++)
496 column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
498 column_values = (char **) calloc (column_num, sizeof (char *));
499 if (column_values == NULL)
500 {
501 ERROR ("dbi plugin: malloc failed.");
502 BAIL_OUT (-1);
503 }
505 column_values[0] = (char *) calloc (column_num,
506 DATA_MAX_NAME_LEN * sizeof (char));
507 if (column_values[0] == NULL)
508 {
509 ERROR ("dbi plugin: malloc failed.");
510 BAIL_OUT (-1);
511 }
512 for (i = 1; i < column_num; i++)
513 column_values[i] = column_values[i - 1] + DATA_MAX_NAME_LEN;
514 /* }}} */
516 /* Copy the field names to `column_names' */
517 for (i = 0; i < column_num; i++) /* {{{ */
518 {
519 const char *column_name;
521 column_name = dbi_result_get_field_name (res, (unsigned int) (i + 1));
522 if (column_name == NULL)
523 {
524 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
525 "Cannot retrieve name of field %zu.",
526 db->name, udb_query_get_name (q), i + 1);
527 BAIL_OUT (-1);
528 }
530 sstrncpy (column_names[i], column_name, DATA_MAX_NAME_LEN);
531 } /* }}} for (i = 0; i < column_num; i++) */
533 udb_query_prepare_result (q, hostname_g, /* plugin = */ "dbi", db->name,
534 column_names, column_num);
536 /* 0 = error; 1 = success; */
537 status = dbi_result_first_row (res); /* {{{ */
538 if (status != 1)
539 {
540 char errbuf[1024];
541 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
542 "dbi_result_first_row failed: %s. Maybe the statement didn't "
543 "return any rows?",
544 db->name, udb_query_get_name (q),
545 cdbi_strerror (db->connection, errbuf, sizeof (errbuf)));
546 udb_query_finish_result (q);
547 BAIL_OUT (-1);
548 } /* }}} */
550 /* Iterate over all rows and call `udb_query_handle_result' with each list of
551 * values. */
552 while (42) /* {{{ */
553 {
554 status = 0;
555 /* Copy the value of the columns to `column_values' */
556 for (i = 0; i < column_num; i++) /* {{{ */
557 {
558 status = cdbi_result_get_field (res, (unsigned int) (i + 1),
559 column_values[i], DATA_MAX_NAME_LEN);
561 if (status != 0)
562 {
563 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
564 "cdbi_result_get_field (%zu) failed.",
565 db->name, udb_query_get_name (q), i + 1);
566 status = -1;
567 break;
568 }
569 } /* }}} for (i = 0; i < column_num; i++) */
571 /* If all values were copied successfully, call `udb_query_handle_result'
572 * to dispatch the row to the daemon. */
573 if (status == 0) /* {{{ */
574 {
575 status = udb_query_handle_result (q, column_values);
576 if (status != 0)
577 {
578 ERROR ("dbi plugin: cdbi_read_database_query (%s, %s): "
579 "udb_query_handle_result failed.",
580 db->name, udb_query_get_name (q));
581 }
582 } /* }}} */
584 /* Get the next row from the database. */
585 status = dbi_result_next_row (res); /* {{{ */
586 if (status != 1)
587 {
588 if (dbi_conn_error (db->connection, NULL) != 0)
589 {
590 char errbuf[1024];
591 WARNING ("dbi plugin: cdbi_read_database_query (%s, %s): "
592 "dbi_result_next_row failed: %s.",
593 db->name, udb_query_get_name (q),
594 cdbi_strerror (db->connection, errbuf, sizeof (errbuf)));
595 }
596 break;
597 } /* }}} */
598 } /* }}} while (42) */
600 /* Tell the db query interface that we're done with this query. */
601 udb_query_finish_result (q);
603 /* Clean up and return `status = 0' (success) */
604 BAIL_OUT (0);
605 #undef BAIL_OUT
606 } /* }}} int cdbi_read_database_query */
608 static int cdbi_connect_database (cdbi_database_t *db) /* {{{ */
609 {
610 dbi_driver driver;
611 dbi_conn connection;
612 size_t i;
613 int status;
615 if (db->connection != NULL)
616 {
617 status = dbi_conn_ping (db->connection);
618 if (status != 0) /* connection is alive */
619 return (0);
621 dbi_conn_close (db->connection);
622 db->connection = NULL;
623 }
625 driver = dbi_driver_open (db->driver);
626 if (driver == NULL)
627 {
628 ERROR ("dbi plugin: cdbi_connect_database: dbi_driver_open (%s) failed.",
629 db->driver);
630 INFO ("dbi plugin: Maybe the driver isn't installed? "
631 "Known drivers are:");
632 for (driver = dbi_driver_list (NULL);
633 driver != NULL;
634 driver = dbi_driver_list (driver))
635 {
636 INFO ("dbi plugin: * %s", dbi_driver_get_name (driver));
637 }
638 return (-1);
639 }
641 connection = dbi_conn_open (driver);
642 if (connection == NULL)
643 {
644 ERROR ("dbi plugin: cdbi_connect_database: dbi_conn_open (%s) failed.",
645 db->driver);
646 return (-1);
647 }
649 /* Set all the driver options. Because this is a very very very generic
650 * interface, the error handling is kind of long. If an invalid option is
651 * encountered, it will get a list of options understood by the driver and
652 * report that as `INFO'. This way, users hopefully don't have too much
653 * trouble finding out how to configure the plugin correctly.. */
654 for (i = 0; i < db->driver_options_num; i++)
655 {
656 DEBUG ("dbi plugin: cdbi_connect_database (%s): "
657 "key = %s; value = %s;",
658 db->name,
659 db->driver_options[i].key,
660 db->driver_options[i].value);
662 status = dbi_conn_set_option (connection,
663 db->driver_options[i].key, db->driver_options[i].value);
664 if (status != 0)
665 {
666 char errbuf[1024];
667 const char *opt;
669 ERROR ("dbi plugin: cdbi_connect_database (%s): "
670 "dbi_conn_set_option (%s, %s) failed: %s.",
671 db->name,
672 db->driver_options[i].key, db->driver_options[i].value,
673 cdbi_strerror (connection, errbuf, sizeof (errbuf)));
675 INFO ("dbi plugin: This is a list of all options understood "
676 "by the `%s' driver:", db->driver);
677 for (opt = dbi_conn_get_option_list (connection, NULL);
678 opt != NULL;
679 opt = dbi_conn_get_option_list (connection, opt))
680 {
681 INFO ("dbi plugin: * %s", opt);
682 }
684 dbi_conn_close (connection);
685 return (-1);
686 }
687 } /* for (i = 0; i < db->driver_options_num; i++) */
689 status = dbi_conn_connect (connection);
690 if (status != 0)
691 {
692 char errbuf[1024];
693 ERROR ("dbi plugin: cdbi_connect_database (%s): "
694 "dbi_conn_connect failed: %s",
695 db->name, cdbi_strerror (connection, errbuf, sizeof (errbuf)));
696 dbi_conn_close (connection);
697 return (-1);
698 }
700 if (db->select_db != NULL)
701 {
702 status = dbi_conn_select_db (connection, db->select_db);
703 if (status != 0)
704 {
705 char errbuf[1024];
706 WARNING ("dbi plugin: cdbi_connect_database (%s): "
707 "dbi_conn_select_db (%s) failed: %s. Check the `SelectDB' option.",
708 db->name, db->select_db,
709 cdbi_strerror (connection, errbuf, sizeof (errbuf)));
710 dbi_conn_close (connection);
711 return (-1);
712 }
713 }
715 db->connection = connection;
716 return (0);
717 } /* }}} int cdbi_connect_database */
719 static int cdbi_read_database (cdbi_database_t *db) /* {{{ */
720 {
721 size_t i;
722 int success;
723 int status;
725 unsigned int db_version;
727 status = cdbi_connect_database (db);
728 if (status != 0)
729 return (status);
730 assert (db->connection != NULL);
732 db_version = dbi_conn_get_engine_version (db->connection);
733 /* TODO: Complain if `db_version == 0' */
735 success = 0;
736 for (i = 0; i < db->queries_num; i++)
737 {
738 /* Check if we know the database's version and if so, if this query applies
739 * to that version. */
740 if ((db_version != 0)
741 && (udb_query_check_version (db->queries[i], db_version) == 0))
742 continue;
744 status = cdbi_read_database_query (db, db->queries[i]);
745 if (status == 0)
746 success++;
747 }
749 if (success == 0)
750 {
751 ERROR ("dbi plugin: All queries failed for database `%s'.", db->name);
752 return (-1);
753 }
755 return (0);
756 } /* }}} int cdbi_read_database */
758 static int cdbi_read (void) /* {{{ */
759 {
760 size_t i;
761 int success = 0;
762 int status;
764 for (i = 0; i < databases_num; i++)
765 {
766 status = cdbi_read_database (databases[i]);
767 if (status == 0)
768 success++;
769 }
771 if (success == 0)
772 {
773 ERROR ("dbi plugin: No database could be read. Will return an error so "
774 "the plugin will be delayed.");
775 return (-1);
776 }
778 return (0);
779 } /* }}} int cdbi_read */
781 static int cdbi_shutdown (void) /* {{{ */
782 {
783 size_t i;
785 for (i = 0; i < databases_num; i++)
786 {
787 if (databases[i]->connection != NULL)
788 {
789 dbi_conn_close (databases[i]->connection);
790 databases[i]->connection = NULL;
791 }
792 cdbi_database_free (databases[i]);
793 }
794 sfree (databases);
795 databases_num = 0;
797 udb_query_free (queries, queries_num);
798 queries = NULL;
799 queries_num = 0;
801 return (0);
802 } /* }}} int cdbi_shutdown */
804 void module_register (void) /* {{{ */
805 {
806 plugin_register_complex_config ("dbi", cdbi_config);
807 plugin_register_init ("dbi", cdbi_init);
808 plugin_register_read ("dbi", cdbi_read);
809 plugin_register_shutdown ("dbi", cdbi_shutdown);
810 } /* }}} void module_register */
812 /*
813 * vim: shiftwidth=2 softtabstop=2 et fdm=marker
814 */