Announcements‎ > ‎

Databases, graphs and lagarto-max

posted Nov 2, 2012, 4:38 PM by Daniel Berenguer
We've been regularly receiving questions about the best way to maintain data logs locally from lagarto-max. Since lagarto-max provides a way for users to develop their own custom scripts, people has been able to implement different database/logging engines on lagarto and even create graphs using some of the most popular tools (RDDtool, JCCKit, xls spreadsheet, etc.). However, we've wanted to go a step further and decided to add a way to log and plot values natively from lagarto-max.

Database view
Figure 1 : database view

In order to isolate users from the burden of having to create tables and run queries from Python, lagarto-max now provides simple graphical mechanisms to manage a SQLite database via Web. The above picture shows two database tables, each one storing values from specific lagarto endpoints (wireless SWAP values in this case).

table edition page
Figure 2 : table edition page

Each new table can be easily configured to log network values at a given interval. One of the main advantages about using SQLite or any other SQL-based database is that we'll be able to query the database for specific date/time ranges or simply request the last values matching given conditions. Once the table is created, lagarto-max immediately starts to update its contents at the configured interval.

graph view
Figure 3 : graph view

What happens then? Our SQLite database stored in database/lagarto.db can be queried by any other application but for anyone wanting to create custom graphs, lagarto-max also provides specific Web pages for this purpose. The above is a global view of graphs created from lagarto-max, each graph pointing to a database table.

graph edition view

Figure 4 : graph edition view

Graphs can be configured to show multiple columns from a given database table. Graphs can also be set to show values between two dates or simply plot the latest stored values ("Latest samples to plot" parameter in the above page).

example of graph
Figure 5 : example of graph

After creating and configuring our graph, we can then display it from the main graph panel. If we want to embed the chart into a different networked application, we can even remove all the unnecessary web resources by simply linking to

We'll see in a future tutorial how to embed graphs created from lagarto-max into custom OpenRemote panels.

The graphing tool used by lagarto-max is JCCKit, a powerful Java applet providing a high degree of customization. Being a java applet, this means that graphs are run by the web browser. Our lagarto computer will only have to worry about sending the correct values to the browser via Ajax.