View source | Discuss this page | Page history | Printable version   

Retail:Monitoring and Management

Back to main page

Contents

Introduction

Bulbgraph.png   Note: Starting from RR18Q2

The monitoring and management functionalities included in the Openbravo Hardware Manager is based in standard technologies:

Java Management Extensions (JMX) Technology. (http://www.oracle.com/technetwork/articles/java/javamanagement-140525.html)

This technology is used to publish information like status, attributes and statistics, and to publish actions like device testing actions. All the information and actions published can be consumed by all monitoring and management tools that support JMX for example JConsole and Java Mission Control.

Java Util Logging (JUL) Technology (https://docs.oracle.com/javase/8/docs/technotes/guides/logging/overview.html)

This technology is used to publish logging events that are raised during the operation of the Hardware manager Logging events can be processed in several ways, the most simple way is just write all logging events to a file, but also can be collected, processed and and stored by tools like Logstash and Fluentd.

System scripts

As system script there are two simple utilities that allow to start and stop the Hardware Manager from the command line. For Windows systems the scripts are start.bat and stop.bat, and for Linux and MacOS systems the scripts are start.sh and stop.sh.

Consuming information and actions using JConsole

JConsole is a basic monitoring application that uses JMX. It is open source and free. It is and standalone application but it comes with the Oracle Java JDK or OpenJDK, it cannot be downloaded independently.

Enabling JMX monitoring

When opened JConsole, it can connect to local java applications or remote java applications. To connect to local applications is enabled by default but to connect to remote applications, remote monitoring has to be enabled in the monitored application. As an example remote monitoring with disabled security can be enabled passing the following parameters to the monitored application:

-Dcom.sun.management.jmxremote.port=portNum
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false 

Where portNum is the port the application will listen for remote JMX connections. This remote monitoring can also be secured with user and password, and encrypted. To set these parameters you have to set the environment variable HWMANAGER_OPT. In Linux it can be set this way:

export HWMANAGER_OPT = " \
 -Dcom.sun.management.jmxremote.port=5000 \
 -Dcom.sun.management.jmxremote.ssl=false \
 -Dcom.sun.management.jmxremote.authenticate=false"

For the details about this configuration refer to the JMX documentation: https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

Connecting with JConsole

When opening JConsole the following dialog appears:

Newconnection.png


Here you can select any of the local processes running or a remote host or port listening for JMX connections. The JMX name exposed by the Hardware Manager is the main java class: org.openbravo.poshw.Main.

Java VM general charts

In the Overview tab there are general performance charts showing the heap memory usage, threads, classes loaded and CPU usage.

Vmgeneralcharts.png

Java VM information

In the VM Summary tab there is general information of the Java VM used to run the Hardware Manager like the version, vendor name, live threads, current heap memory, operating system details, and application arguments.

Vminformation.png

Hardware manager information and actions

In the MBeans tab there are detailed Java VM monitoring information and also all the Hardware Manager published information and actions. The Hardware Manager monitoring information is in the package com.openbravo.pos.monitor. Here there are several samples of screenshots showing Hardware Manager monitoring information.


Hminformation.png

Hminformation1.png Hminformation2.png Hminformation3.png Hminformation4.png Hminformation5.png

Here there is a sample screenshot showing Hardware Manager management actions for printers and cash drawers.

Consuming logging events using the Elastic logging stack

Logstash / Elasticsearch / Kibana is a logging stack by Elastic https://www.elastic.co/ that allows to collect, process and store, logging events coming from different sources. These three tools are open source and free to use.

Configuring logging in the Hardware Manager

Logging is configured in the Hardware Manager in the file logging.properties. By default logging is disabled but it is pre-configured to publish logging events to the console, file or a remote server. For example to enable logging to the console add the following line:

handlers=java.util.logging.ConsoleHandler

To enable logging to file add the following line:

handlers=java.util.logging.FileHandler

To enable logging to a remote server add the following lines. This is the configuration to use to publish to the elastic logging stack.

handlers=java.util.logging.SocketHandler
java.util.logging.SocketHandler.host=remote-host
java.util.logging.SocketHandler.port=remote-port

To configure the level of the logging events published it has to be done at root level and/or in each logging handlers. The logging levels available are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER and FINEST.

.level=INFO
java.util.logging.SocketHandler.level=WARNING

For detailed information, refer to the following document: http://tutorials.jenkov.com/java-logging/configuration.html

Installing and running the logging stack

The three applications of the stack can be downloaded from the Elastic web page https://www.elastic.co/ There are packages for Windows and Linux.

Logstash is the dynamic data collection pipeline of the stack. To configure Logstash there is needed to edit a logstash.config file. The sections to configure are the input sources, filters and output destinations. The following configuration sample file listens logging data in a server port and sends the data to the console in ruby format and to an elasticsearch database:

input { 
  tcp {
    port => 8200
    codec => "json"
  }     
}
filter {
}
output {
  stdout { codec => rubydebug }
  elasticsearch { hosts => "http://localhost:9200" }
}

To run logstash execute the following command

bin/logstash -f logstash.config

For detailed information to configure logstash go the document: https://www.elastic.co/products/logstash

Elasticsearch is the database where log events are stored. Is a distributed, JSON-based search and analytics engine.

To run elasticsearch with its default configuration execute the following command:

bin/elasticsearch

For detailed information to configure elasticsearch go to the document: https://www.elastic.co/products/elasticsearch

Finally Kibana is the user interface of the stack if offers all the configuring and managing aspects of the logging stack. To configure kibana there is needed at least to configure the location of the elasticsearch database. To do it edit the file config/kibana.yml and add the following line:

elasticsearch.url: "http://localhost:9200"

To run kibana first execute the following command:

bin/kibana

And then open a browser and go to http://localhost:5601 The user interface will appear and you can see all the functionalities available to inspect and analyse the logging data provided by one or all the hardware manager applications that publish the logging events to the logging stack.

For detailed information to configure and operate kibana go to the document: https://www.elastic.co/products/kibana


Kibana.png

Appendix. Information published

Java VM information

In every java application the java.lang.management package provides the interface for monitoring and managing the Java VM. This API provides access to the following types of information.

General Hardware Manager information

The com.openbravo.pos.monitor provides the following information in the ApplicationStats object.

Printers information

The com.openbravo.pos.monitor provides the following information in the DevicePrinterProxy_% object. There is one object for configured printer.

Display information

The com.openbravo.pos.monitor provides the following information in the DeviceDisplay_proxy object.

Payment device information

The com.openbravo.pos.monitor provides the following information in the DevicePaymentProxy object.

Processes information

The com.openbravo.pos.monitor provides the following information in the DeviceProcessProxy_% object. There is one object for running process like the PDF printing process.

Timing statistics

The com.openbravo.pos.monitor provides the following information in the StopWatch Stats_% object. There is one object for functionality monitored.

The functionalities with timing statistics are:

Counter statistics

The com.openbravo.pos.monitor provides the following information in the CounterStats_% object. There is one object for quantities monitored. Currently only payment amounts are using counter statistics.

The functionalities with counter statistics are:

Appendix. Actions published

General actions

Printer actions

Customer display actions

Payment actions

Appendix. Logging events published

Severe level

Warning level

Fine level

General

Printer devices

Display devices

Payment devices

Finer level

Printer devices

Display devices

Payment devices

Retrieved from "http://wiki.openbravo.com/wiki/Retail:Monitoring_and_Management"

This page has been accessed 4,214 times. This page was last modified on 21 December 2017, at 12:31. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.