Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Monitor business metrics with Red Hat Process Automation Manager, Elasticsearch, and Kibana

May 4, 2020
Sadhana Nandakumar
Related topics:
JavaDevOpsMicroservicesEvent-driven

    Red Hat Process Automation Manager is a platform for developing containerized microservices and applications that automate business decisions and processes. Combining process- and task-level SLA metrics plus case-related breakdowns can be beneficial for identifying trends and reorganizing the workforce as necessary. So, a critical piece of a business process system is having real-time insights into what is happening, and both monitoring KPI metrics and responding to problem trends is an integral part of operations.

    Integration with Elasticsearch improves our search capabilities and provides a unified reporting environment for the business. Maciej Swiderski blogged about how we can potentially use Elasticsearch to capture KPI metrics and provide for full-text search capabilities. This article extends the idea and walks through how to enable integration with Elasticsearch on a Red Hat OpenShift environment, and how to represent the KPIs in a graphical business-friendly dashboard using Kibana.

    Preparing the demo environment

    Let’s install the necessary components for this demonstration on Red Hat OpenShift, which enables efficient container orchestration and allows rapid container provisioning, deployment, scaling, and management.

    Setting up Elastic and Kibana

    Let's make use of the Elastic cluster Operator to set up Elastic/Kibana on OpenShift:

    $ oc apply -f https://download.elastic.co/downloads/eck/1.0.1/all-in-one.yaml 
    $ oc new-project elastic

    Now, we can deploy an Elastic instance:

    $ cat <<EOF | oc apply -n elastic -f -
    # This sample sets up an Elasticsearch cluster with an OpenShift route
    apiVersion: elasticsearch.k8s.elastic.co/v1
    kind: Elasticsearch
    metadata:
      name: elasticsearch-sample
    spec:
      version: 7.6.2
      nodeSets:
      - name: default
        count: 1
        config:
          node.master: true
          node.data: true
          node.ingest: true
          node.store.allow_mmap: false
    ---
    
    apiVersion: route.openshift.io/v1
    kind: Route
    metadata:
      name: elasticsearch-sample
    spec:
      #host: elasticsearch.example.com # override if you don't want to use the host that is automatically generated by OpenShift (<route-name>[-<namespace>].<suffix>)
      tls:
        termination: passthrough # Elasticsearch is the TLS endpoint
        insecureEdgeTerminationPolicy: Redirect
      to:
        kind: Service
        name: elasticsearch-sample-es-http
    EOF

    Next, let us deploy a Kibana instance:

    $ cat <<EOF | oc apply -n elastic -f -
    apiVersion: kibana.k8s.elastic.co/v1
    kind: Kibana
    metadata:
      name: kibana-sample
    spec:
      version: 7.6.2
      count: 1
      elasticsearchRef:
        name: "elasticsearch-sample"
      podTemplate:
        spec:
          containers:
          - name: kibana
            resources:
              limits:
                memory: 1Gi
                cpu: 1
    ---
    apiVersion: v1
    kind: Route
    metadata:
      name: kibana-sample
    spec:
      #host: kibana.example.com # override if you don't want to use the host that is automatically generated by OpenShift (<route-name>[-<namespace>].<suffix>)
      tls:
        termination: passthrough # Kibana is the TLS endpoint
        insecureEdgeTerminationPolicy: Redirect
      to:
        kind: Service
        name: kibana-sample-kb-http
    EOF

    We can now access the Kibana dashboard from the route exposed:

    $ oc get route -n elastic
    

    The credentials for logging into Kibana can be found under Secrets for the Elastic project, as shown in Figure 1.

    The login credentials for Kibana are available in Secrets
    Figure 1: The login credentials for Kibana are available in Secrets.

    Setting up the Elasticsearch event emitter 

    The event emitter integration code is a single Java class that implements the EventEmitter interface. A basic implementation of the emitter can be found here. By default process, task, and case metrics are pushed on to the corresponding indexes on Elastic:

    if (view instanceof ProcessInstanceView) {
        index = "processes";
        type = "process";
        id = ((ProcessInstanceView) view).getCompositeId();
    } else if (view instanceof TaskInstanceView) {
        index = "tasks";
        type = "task";
        id = ((TaskInstanceView) view).getCompositeId();
    } else if (view instanceof CaseInstanceView) {
        index = "cases";
        type = "case";
        id = ((CaseInstanceView) view).getCompositeId();
    }
    content.append("{ \"index\" : { \"_index\" : \"" + index + "\", \"_type\" : \"" + type + "\", \"_id\" : \"" + id + "\" } }\n");
    content.append(json);
    

    We can now extend this basic implementation and allow for HTTPS authentication because the Elastic instance on OpenShift is exposed over HTTPS:

    protected CloseableHttpClient buildClient() throws Exception{
       HttpClientBuilder builder = HttpClients.custom();
       if (elasticSearchUser != null && elasticSearchPassword != null) {
           SSLContextBuilder builder1 = new SSLContextBuilder();
           builder1.loadTrustMaterial(null, new TrustStrategy() {
               @Override
               public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                   return true;
               }
           });
           CredentialsProvider provider = new BasicCredentialsProvider();
           UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(elasticSearchUser, elasticSearchPassword);
           provider.setCredentials(AuthScope.ANY, credentials);
           SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(builder1.build(), new NoopHostnameVerifier());
           builder.setDefaultCredentialsProvider(provider);
           builder.setSSLSocketFactory(sslConnectionSocketFactory).build();
       }
       return builder.build();
    }

    Please note that for the purpose of this demonstration, we bypassed the certificate check and used the basic authentication mechanism. For a production use case, it is necessary to authenticate with a valid certificate.

    We can now build a custom Docker image with the event emitter JAR on the KIE server war’s classpath:

    FROM docker-registry.default.svc:5000/openshift/rhpam-kieserver-rhel8:7.5.0
    COPY contrib/jbpm-event-emitters-elasticsearch-7.36.0-SNAPSHOT.jar /opt/eap/standalone/deployments/ROOT.war/WEB-INF/lib/jbpm-event-emitters-elasticsearch-7.36.0-SNAPSHOT.jar
    USER root
    RUN chownjboss:root /opt/eap/standalone/deployments/ROOT.war/WEB-INF/lib/jbpm-event-emitters-elasticsearch-7.36.0-SNAPSHOT.jar && \
    chmod 664 /opt/eap/standalone/deployments/ROOT.war/WEB-INF/lib/jbpm-event-emitters-elasticsearch-7.36.0-SNAPSHOT.jar
    USER jboss

    We also need to pass the corresponding metadata for the Elastic cluster using the JAVA_OPTS Kie Server property:

    $ oc set env dc/{{ pam_app_name }}-kieserver JAVA_OPTS_APPEND=>\"-Dorg.jbpm.event.emitters.elasticsearch.url=https://{{routeelastic.stdout}} -Dorg.jbpm.event.emitters.elasticsearch.user=elastic -Dorg.jbpm.event.emitters.elasticsearch.password={{elasticpwd.stdout}}\" -n {{ OCP_PROJECT }}

    Business activity monitoring

    Now that we are done with the setup, let us quickly look at to visualize the process, task, and case metrics using Kibana. Let us begin by logging into Business Central and pulling a project from the Try Samples section, as shown in Figures 2 and 3.

    Business Central -&gt; Space -&gt; MySpace -&gt; Projects -&gt; dropdown list box -&gt; Try Sample
    Figure 2: Pulling up the Try Samples section.
    The Try Samples project as it appears in MySpace
    Figure 3: The Try Samples section contains a variety of options.

    For this example, we will build and deploy the Mortgage_Process project. We will use this project for metrics visualization. Let us now kickstart a process using the process start form:

    Enter the details into the process start form
    Figure 4: Enter the details into the process start form.

    The process is created, as shown in Figure 5.

    The MortgageApprovalProcess in the Process Instance perspective
    Figure 5: The MortgageApprovalProcess in the Process Instance perspective.

    Now, log into the Kibana dashboard. We will start with a basic visualization for both processes and tasks. Kibana templates provide an exportable JSON format for sharing graphical reports across instances of Kibana. A sample template can be found here. Import the template from the Kibana dashboard's Saved Objects section, under the Management option.

    We now have a sample dashboard available for processes (Figure 6) and tasks (Figure 7).

    Dashboard showing the sample project's processes.
    Figure 6: The new sample Processes dashboard.
    Dashboard showing the sample project's tasks
    Figure 7: The new sample Tasks dashboard.

    As these tasks are worked on and the processes head to completion, their status and updates are pushed to Elastic, as shown in Figure 8.

    dashboard showing tasks broken down in 4 ways
    Figure 8: Track the progress of your tasks and processes through their dashboards.

    Now let us create custom metrics from the process data. We can assume that we need to filter out the cases where property price is over 2 million and property age is less than 25 years. Kibana provides a convenient way to create full-text searches and then lets us convert the result to a visualization.

    Open the raw data section of Kibana and create a custom query to filter out the data, as shown in Figure 9.

    Kibana's raw section with two fields chosen and used in a custom query
    Figure 9: Create your custom filter.

    We can easily convert this data into a visualization by saving this search and creating a bar chart out of it, as shown in Figures 10 and 11.

    Kibana's New Vertical Bar / Choose a source dialog box.
    Figure 10: Create a bar chart.
    Kibana showing your new bar chart.
    Figure 11: Your new bar chart.

    Similar visualizations can be created for cases, too. A sample case visualization using KPI metrics for the case can be set up as shown in Figure 12.

    Dashboard showing cases broken down in 4 ways
    Figure 12: The sample case visualization.

    A complete example of the setup can be found here.

    Summary

    By setting up an integration with Elasticsearch, we can visualize data from the business automation engine side-by-side with the metrics from other disparate systems. Doing this also provides for faster, more scalable, business-friendly visualizations fit for operations management.

    References

    Elasticsearch empowers jBPM

    Deploying Elastic and Kibana on Openshift

    Last updated: June 26, 2020

    Recent Posts

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.