Hi Alberto, Adding your own table is possible. You need to add some entries to /controller/src/analytics/viz.sandesh It does not need the collector to be rebuilt, but it does require rebuilding contrail-analytics-api.
I’m going to assume the table name “ObjectAlberto” (instead of “ObjectTableName”) I’m going to make this UVE accessible via the Analytics API as follows: http://xx.xx.xx.xx:8081/analytics/uves/albertos I’m going to make the ObjectLog visible via the Analytics Query API as well (as you mentioned in your email) Based on this API, from the command line of the analytics node you will be able to do this: contrail-logs --object-type alberto 1. Changes in controller/src/analytics/viz.sandesh const string ALBERTO_TABLE = “ObjectAlberto" const string ALBERTO_DISPLAY_NAME = “Alberto" ... const map<string, string> UVE_MAP = { ... “alberto" : ALBERTO_TABLE, } ... const map<string, objtable_info> _OBJECT_TABLES = { ALBERTO_TABLE : { 'objtable_display_name' : ALBERTO_DISPLAY_NAME 'log_query_name' : “alberto" } } 2. Rebuild contrail-analytics-api sb/controller/src$ scons -u opserver 3. Install and test on target You should rebuild the contrail-analytics package and install it on your target. For this kind of change, there is an alternative installation method as well, given below: This is the generated file that will change when you rebuild: sb/controller/src$ ls ../../build/debug/opserver/opserver/sandesh/viz/constants.py You can copy it onto your analytics node. It will be at a location such as: /usr/lib/python2.7/dist-packages/opserver/sandesh/viz/constants.py After overwriting the file (you should take a backup first, just in case), restart contrail-analytics-api: service contrail-analytics-api restart 4. Test the UVE Analytics API and Analytics Query API after starting your application and connecting to the collector. Regards, Anish On 4/23/15, 1:34 AM, "[email protected]" <[email protected]> wrote: >Hello Anish, > >Thanks for your reply. What we are going to do is a little application >that sends it's own metrics to the collector so we can retrieve that >data using de Analytics API. > >For example: > > struct TestAgent { > 1: string name(key="ObjectTableName") > 2: optional i32 valueToBeSent1 > } > > uve sandesh TestTrage { > 1: TestAgent data; > } > >This kind of message should be stored in some way in Cassandra >databases and be available to the API users. I understand that >(key="ObjectTableName") makes reference to a new table with that name >that can be queried from the API. For me that is the concept of >"custom table", tables that are administrator/developer defined >different from base contrail tables. > >It would be retrieved with a POST query to the API similar to this: >{ > "end_time": "now", > "select_fields": [ > "valueToBeSent1" > ], > "sort_fields": [], > "start_time": "now-60m", > "table": "ObjectTableName", > "where": [ > [ > { > "name": "Source", > "op": 1, > "suffix": null, > "value": "GeneratorApplication", > "value2": null > } > ] > ] >} > >Is this possible? If it is, do I have to do any step apart from send >the structure using the code generated by Sandesh compiler? > >If it is not possible, is there any workaround? The only way that >comes to my mind is that we could query directly to message table, >filter the messages we don't want and process the XMLs but that >solution wouldn't be clean. > > >I hope I explained it correctly. Thank you for your assistance. > >Best regards, >Alberto Gutiérrez. > >Quoting Anish Mehta <[email protected]>: > >> >> The schemas for new Sandesh types do not need to be compiled or loaded >> onto the Collector. >> The collector gets XML-encoded messages from the generators and stores >> them according to their sandesh types and the contained annotations. >> >> Sandesh Types and how they work are explained here: >> http://www.opencontrail.org/sandesh-a-sdn-analytics-interface/ >> >> >> I¹m not sure what you mean by ³custom tables². >> Please send us a sample sandesh file and describe what you are trying to >> do, and we can discuss further. >> >> >> Regards, >> >> Anish >> >> On 4/22/15, 6:53 AM, "[email protected]" <[email protected]> wrote: >> >>> Dear all, >>> >>> When creating a new sandesh structure, do I need to send somehow the >>> schema to the collectors so they will understand it or it will be >>> added automatically with the first message it recieves? >>> >>> >>> Thanks for your attention, >>> Alberto. >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> >>>http://lists.opencontrail.org/mailman/listinfo/dev_lists.opencontrail.or >>>g >> >> > _______________________________________________ Dev mailing list [email protected] http://lists.opencontrail.org/mailman/listinfo/dev_lists.opencontrail.org
