summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b126ba)
raw | patch | inline | side by side (parent: 0b126ba)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 19:16:25 +0000 (20:16 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 19:16:25 +0000 (20:16 +0100) |
src/frontend/grammar.y | patch | blob | history | |
t/unit/frontend/parser_test.c | patch | blob | history |
diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y
index b400f9acc51736fc43ebed4cb7a02ea6b03036af..97be55d0c7dfa5b397fade235888bafe4f505a27 100644 (file)
--- a/src/frontend/grammar.y
+++ b/src/frontend/grammar.y
%type <expr> expression
-%type <integer> object_type_plural
+%type <integer> object_type object_type_plural
%type <integer> iterable
%type <integer> field
* Retrieve detailed information about a single host.
*/
fetch_statement:
- FETCH HOST_T STRING filter_clause
+ FETCH object_type STRING filter_clause
{
- /* TODO: support other types as well */
-
$$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
conn_fetch_t, conn_fetch_destroy));
- CONN_FETCH($$)->type = SDB_HOST;
+ CONN_FETCH($$)->type = $2;
CONN_FETCH($$)->host = $3;
CONN_FETCH($$)->name = NULL;
CONN_FETCH($$)->filter = CONN_MATCHER($4);
$$->cmd = CONNECTION_FETCH;
}
+ |
+ FETCH object_type STRING '.' STRING filter_clause
+ {
+ $$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
+ conn_fetch_t, conn_fetch_destroy));
+ CONN_FETCH($$)->type = $2;
+ CONN_FETCH($$)->host = $3;
+ CONN_FETCH($$)->name = $5;
+ CONN_FETCH($$)->filter = CONN_MATCHER($6);
+ $$->cmd = CONNECTION_FETCH;
+ }
;
/*
}
;
+object_type:
+ HOST_T { $$ = SDB_HOST; }
+ |
+ SERVICE_T { $$ = SDB_SERVICE; }
+ |
+ METRIC_T { $$ = SDB_METRIC; }
+ ;
+
object_type_plural:
HOSTS_T { $$ = SDB_HOST; }
|
index d33917a3bd4311b1f6fdf78d67057f8597f95bae..ec8264c82b6c495bd1e9ff2f0a250d7e32cc8280 100644 (file)
{ "FETCH host 'host'", -1, 1, CONNECTION_FETCH },
{ "FETCH host 'host' FILTER "
"age > 60s", -1, 1, CONNECTION_FETCH },
+ { "FETCH service "
+ "'host'.'service'", -1, 1, CONNECTION_FETCH },
+ { "FETCH metric "
+ "'host'.'metric'", -1, 1, CONNECTION_FETCH },
{ "LIST hosts", -1, 1, CONNECTION_LIST },
{ "LIST hosts -- foo", -1, 1, CONNECTION_LIST },
"age > 60s", -1, -1, 0 },
{ "FETCH host 'host' MATCHING "
"host = 'host'", -1, -1, 0 },
+ { "FETCH service 'host'",-1, -1, 0 },
+ { "FETCH metric 'host'", -1, -1, 0 },
+ { "FETCH host "
+ "'host'.'localhost'", -1, -1, 0 },
{ "FETCH foo 'host'", -1, -1, 0 },
{ "FETCH foo 'host' FILTER "
"age > 60s", -1, -1, 0 },