- /* Valid FLUSH commands. */
- {
- "FLUSH",
- NULL,
- CMD_OK,
- CMD_FLUSH,
- },
- {
- "FLUSH identifier=myhost/magic/MAGIC",
- NULL,
- CMD_OK,
- CMD_FLUSH,
- },
- {
- "FLUSH identifier=magic/MAGIC",
- &default_host_opts,
- CMD_OK,
- CMD_FLUSH,
- },
- {
- "FLUSH timeout=123 plugin=\"A\"",
- NULL,
- CMD_OK,
- CMD_FLUSH,
- },
- /* Invalid FLUSH commands. */
- {
- /* Missing hostname; no default. */
- "FLUSH identifier=magic/MAGIC",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- /* Missing 'identifier' key. */
- "FLUSH myhost/magic/MAGIC",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- /* Invalid timeout. */
- "FLUSH timeout=A",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- /* Invalid identifier. */
- "FLUSH identifier=invalid",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- /* Invalid option. */
- "FLUSH invalid=option",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
-
- /* Valid GETVAL commands. */
- {
- "GETVAL myhost/magic/MAGIC",
- NULL,
- CMD_OK,
- CMD_GETVAL,
- },
- {
- "GETVAL magic/MAGIC",
- &default_host_opts,
- CMD_OK,
- CMD_GETVAL,
- },
-
- /* Invalid GETVAL commands. */
- {
- "GETVAL magic/MAGIC",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "GETVAL",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "GETVAL invalid",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
-
- /* Valid LISTVAL commands. */
- {
- "LISTVAL",
- NULL,
- CMD_OK,
- CMD_LISTVAL,
- },
-
- /* Invalid LISTVAL commands. */
- {
- "LISTVAL invalid",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
-
- /* Valid PUTVAL commands. */
- {
- "PUTVAL magic/MAGIC N:42",
- &default_host_opts,
- CMD_OK,
- CMD_PUTVAL,
- },
- {
- "PUTVAL myhost/magic/MAGIC N:42",
- NULL,
- CMD_OK,
- CMD_PUTVAL,
- },
- {
- "PUTVAL myhost/magic/MAGIC 1234:42",
- NULL,
- CMD_OK,
- CMD_PUTVAL,
- },
- {
- "PUTVAL myhost/magic/MAGIC 1234:42 2345:23",
- NULL,
- CMD_OK,
- CMD_PUTVAL,
- },
- {
- "PUTVAL myhost/magic/MAGIC interval=2 1234:42",
- NULL,
- CMD_OK,
- CMD_PUTVAL,
- },
- {
- "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23",
- NULL,
- CMD_OK,
- CMD_PUTVAL,
- },
-
- /* Invalid PUTVAL commands. */
- {
- "PUTVAL magic/MAGIC N:42",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL invalid N:42",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL myhost/magic/MAGIC A:42",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL myhost/magic/MAGIC 1234:A",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL myhost/magic/MAGIC",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL 1234:A",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- {
- "PUTVAL myhost/magic/UNKNOWN 1234:42",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- /*
- * As of collectd 5.x, PUTVAL accepts invalid options.
- {
- "PUTVAL myhost/magic/MAGIC invalid=2 1234:42",
- NULL,
- CMD_PARSE_ERROR,
- CMD_UNKNOWN,
- },
- */
-
- /* Invalid commands. */
- {
- "INVALID",
- NULL,
- CMD_UNKNOWN_COMMAND,
- CMD_UNKNOWN,
- },
- {
- "INVALID interval=2",
- NULL,
- CMD_UNKNOWN_COMMAND,
- CMD_UNKNOWN,
- },
+ /* Valid FLUSH commands. */
+ {
+ "FLUSH", NULL, CMD_OK, CMD_FLUSH,
+ },
+ {
+ "FLUSH identifier=myhost/magic/MAGIC", NULL, CMD_OK, CMD_FLUSH,
+ },
+ {
+ "FLUSH identifier=magic/MAGIC", &default_host_opts, CMD_OK, CMD_FLUSH,
+ },
+ {
+ "FLUSH timeout=123 plugin=\"A\"", NULL, CMD_OK, CMD_FLUSH,
+ },
+ /* Invalid FLUSH commands. */
+ {
+ /* Missing hostname; no default. */
+ "FLUSH identifier=magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ /* Missing 'identifier' key. */
+ "FLUSH myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ /* Invalid timeout. */
+ "FLUSH timeout=A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ /* Invalid identifier. */
+ "FLUSH identifier=invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ /* Invalid option. */
+ "FLUSH invalid=option", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+
+ /* Valid GETVAL commands. */
+ {
+ "GETVAL myhost/magic/MAGIC", NULL, CMD_OK, CMD_GETVAL,
+ },
+ {
+ "GETVAL magic/MAGIC", &default_host_opts, CMD_OK, CMD_GETVAL,
+ },
+
+ /* Invalid GETVAL commands. */
+ {
+ "GETVAL magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "GETVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "GETVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+
+ /* Valid LISTVAL commands. */
+ {
+ "LISTVAL", NULL, CMD_OK, CMD_LISTVAL,
+ },
+
+ /* Invalid LISTVAL commands. */
+ {
+ "LISTVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+
+ /* Valid PUTVAL commands. */
+ {
+ "PUTVAL magic/MAGIC N:42", &default_host_opts, CMD_OK, CMD_PUTVAL,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC N:42", NULL, CMD_OK, CMD_PUTVAL,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC 1234:42", NULL, CMD_OK, CMD_PUTVAL,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC 1234:42 2345:23", NULL, CMD_OK, CMD_PUTVAL,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC interval=2 1234:42", NULL, CMD_OK,
+ CMD_PUTVAL,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23", NULL,
+ CMD_OK, CMD_PUTVAL,
+ },
+
+ /* Invalid PUTVAL commands. */
+ {
+ "PUTVAL magic/MAGIC N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL invalid N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC A:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ },
+ {
+ "PUTVAL myhost/magic/UNKNOWN 1234:42", NULL, CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
+ },
+ /*
+ * As of collectd 5.x, PUTVAL accepts invalid options.
+ {
+ "PUTVAL myhost/magic/MAGIC invalid=2 1234:42",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
+ },
+ */
+
+ /* Invalid commands. */
+ {
+ "INVALID", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
+ },
+ {
+ "INVALID interval=2", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
+ },