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; }
|