Skip to content
Javier Fuentes edited this page Jun 15, 2016 · 17 revisions

ObsSM 1.0 version

ALMA Log's State Machine Parser

ObsSM: Interpreter

  • Easy build and run
curl https://raw.githubusercontent.com/javierivanov/ObsSM/master/auto_install.sh -o - |sh

Compiling process, normal procedure

The interpreter works on java version >= 1.7 Tested on Ubuntu 15.10, Oracle jdk 7, maven2.

wget https://github.com/javierivanov/ObsSM/archive/master.zip
unzip master.zip
  • Enter to the project folder
cd ObsSM-master/ObsSM/
  • Compile using Maven

You have to have installed Maven for this step. You can check this, trying with the command mvn. Anyway you can install it from here: [https://maven.apache.org]

mvn clean dependency:copy-dependencies package

or

./build.sh

Execute the interpreter

java -cp "target/ObsSM-1.0.jar:target/dependency/*" org.alma.obssm.Run

or

./obssm.sh

How to send logs to the interpreter

ObsSM includes a built-in ElasticSearch retriever, and search data directly from the ES server.

ObsSM: advanced usage

You can also use a command line, for automatization or externals plugins.

Command Line

./obssm.sh -h

Help message:

usage: obssm.sh
 -c,--cmd                                            use a Command Line
                                                     Interface
    --date_from <time stamp from>                    TimeStamp from
    --date_to <time stamp to>                        TimeStamp to
    --elk_server <elk_server>                        Elastic Search Server
    --grep <TimeStamp:Array:text:SourceObject:Etc>   Make a grep from
                                                     Elastic search,
                                                     arguments are
                                                     optional.
 -h,--help                                           show this message
    --listener <ListenerJarFile:ListenerClass>       Transition listener
                                                     (Default:
                                                     DefaultEntryistener)
    --log_translate <json file>                      use a given json file
                                                     to translate log
    --query <query>                                  Query DSL
    --query_filter <json file>                       use a given query
                                                     filter (json) file to
                                                     search through
                                                     ElasticSearch
    --scxml <scxml file>                             use a given scxml
                                                     file to parse a SM
 -v,--verbose                                        show debugging
                                                     messages

|=====================GENERAL RECOMENDATIONS==========================|
|   On all the options use ="". i.e. --query="Array: Array001"        |
|   TimeStamp format is yyyy-MM-ddThh:mm:ss.zzz                       |
|   In grep mode you can select columns of data using:                |
|         --grep="TimeStamp:Array:text"                               |
|                                                                     |
| For more information see:https://github.com/javierivanov/ObsSM/wiki |
|=====================GENERAL RECOMENDATIONS==========================|

Deafult Listener

If you want to see transitions just like command line output.

./obssm.sh -c --date_from="2016-05-22T21:16:22.037" --date_to="2016-05-23T21:16:22.037" --query="*"

Response:

May 27, 2016 5:29:47 PM org.alma.obssm.net.ElasticSearchImpl$1 run
INFO: Elastic Search start
ARRAY: Array001 EVENT: Array.creation TO: ArrayCreated FROM: MainIdle TS: 2016-05-22T21:28:11.266
ARRAY: Array002 EVENT: Array.creation TO: ArrayCreated FROM: MainIdle TS: 2016-05-22T21:43:22.335
ARRAY: Array003 EVENT: Array.creation TO: ArrayCreated FROM: MainIdle TS: 2016-05-22T21:49:46.369
ARRAY: Array002 EVENT: Interferometry.init TO: InterferometryInitializeStarted FROM: ArrayCreated TS: 2016-05-22T21:53:54.610
ARRAY: Array002 EVENT: PointingSubArray.callreference TO: InterferometrySettingUpBegun FROM: InterferometryInitializeStarted TS: 2016-05-22T21:53:54.680
ARRAY: Array002 EVENT: PointingSubArray.callreference TO: PointingSubArrayGettingReferenceCalled FROM: PointingSubArrayConstructorIdle TS: 2016-05-22T21:53:54.680
ARRAY: Array002 EVENT: PointingSubArray.antModecontrollercreated TO: PointingSubArrayControllersCreated FROM: PointingSubArrayGettingReferenceCalled TS: 2016-05-22T21:53:54.749
ARRAY: Array002 EVENT: LocalOscillator.callreference TO: LocalOscillatorGettingReferenceCalled FROM: LocalOscillatorConstructorIdle TS: 2016-05-22T21:53:55.105
ARRAY: Array002 EVENT: LocalOscillator.antModecontrollercreated TO: LocalOscillatorControllersCreated FROM: LocalOscillatorGettingReferenceCalled TS: 2016-05-22T21:53:59.963

Custom Listener

Maybe you want to view transitions with a graphical interface. So it's possible to use a custom Listener. If you want to create your own plugin for a Listener Custom Listeners Developing Guide You want to download the third party plugin here before!

wget https://raw.githubusercontent.com/javierivanov/ObsSM/master/ObsSM_plugins/GraphViewer.jar
./obssm.sh -c --date_from="2016-05-22T21:16:22.037" --date_to="2016-05-23T21:16:22.037" --query="*" --listener="GraphViewer.jar:org.alma.GraphViewer"

As you can see, I'm not a GUI designer, please create your own plugin for visualization.

Custom models

Also you can use a custom SCXML Model, JSON log translate and JSON query base documents: More about models

./obssm.sh -c --query_filter="/path/to/JSON" --scxml="/path/to/SCXML" --log_translate="/path/to/JSON"

Discovery: Transitions

This is an application to discover transitions into the log, generating a SCXML model.

Downloading XML Documents:

  • To select dates for learning, you have to edit the discovery_xml.py file.

**Añadir command line options

python2 Discovery/src/discovery_xml.py [states.json file]

It generates a xml document, so you can save it using:

python2 Discovery/src/discovery_xml.py [states.json file] > [model file]

Downloading Logs from Elastic Search:

Help discovery.py

Usage: discovery.py [options]

Options:
  -h, --help            show this help message and exit
  -f JSON, --file=JSON  JSON Log translate document
  -v, --verbose         Show data from transitions

You can use the obssm.sh in grep mode to obtain logs:

./obssm.sh -c --grep --date_from="2016-05-22T21:16:22.037" --date_to="2016-05-23T21:16:22.037" --query="*"

So, you can use a pipe:

ObsSM/obssm.sh -c --grep --date_from="2016-05-23T20:16:22.037" --date_to="2016-05-23T21:16:22.037" --query="*" | python2 Discovery/src/discovery.py -f json-document.json