16 Monitoring Service Controller Using the Scripting Engine

This chapter explains how to monitor Oracle Communications Service Controller using the scripting engine.

Monitor Multiple Managed Server from One Scripting Engine

Make it possible to collect data from multiple managed servers from one scripting engine process. The output MBean statistical data contains information of the managed server's monitoring result and the information about which managed server it comes from.

To start the monitoring. you need to create a MBean scripts in XML format like:

<servers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ScriptDaemon.xsd">
  <player name="pn_1, pn_2" host="10.182.12.218, 10.182.12.218" registryPort="9070, 9071">
    <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
      <get name="SessionCount"></get>
    </mbean>
  </player>
  <player name="pn_2" host="10.182.12.218" registryPort="9071">
    <mbean name="try failed">
      <get name="SessionCount"></get>
    </mbean>
    <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
      <get name="SessionCount"></get>
    </mbean>
  </player>
  <player name="ssu_1" host="10.182.12.218" registryPort="9080">
    <!-- Number inbound event registrations stored on this SSU instance -->
    <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.in,nodeId=*,tier=back">
      <get name="Size"></get>
    </mbean>
    <!-- Number outbound event registrations on this SSU instance -->
    <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.out,nodeId=*,tier=back">
      <get name="Size"></get>
    </mbean>
  </player>
</servers>

Save the MBean scripts to a file e.g. monitoring_runtime.xml

The xml file indicated to monitoring the managed servers whose IP address is 10.182.12.218, 10.182.12.218 and the managed servers' registry ports are 9070, 9071,9080 respectively.

You will find IP and port information in the OCCAS-SC admin console under:

OCSB --> Domain Management --> Servers

The values to use are the ones from the "Host" and "JMX Registry" columns.

Enabling the Scripting Daemon Functions

Copy script.sh (admin_server/script.sh) to a file named scriptDaemon.sh and edit it to look like:

#!/bin/sh
 
OSGI_CONFIG=osgi/script
 
BOOT_CONFIG=properties/script
 
BOOT_OPTS="-Daxia.console.script.daemon=true -Daxia.console.script.daemon.cycle.time=60000 -Daxia.console.script.daemon.cycle.iterations=2000 -Daxia.console.script.daemon.outfile=/work/temp/monitoring_daemon_out.xml -Daxia.console.script=$@"
 
. `pwd`/common.sh

But change the values in the BOOT_OPTS section to fit your requirements.

Run the script with a command similar to the following:

/work/runtimes/ocsc62/admin_server $ ./scriptDaemon.sh scripts/monitoring_runtime.xml

and enter the SSL keystore password when prompted. Here is a sample of the output:

2019-10-09 12:51:20,196 WARN  - Loading the credential store from the current directory because the path to the credential store is not specified. Make sure the property 'axia.credential.store.url' is defined to get rid of this message.
 
2019-10-09 12:51:20,581 INFO  - com.convergin.specific.axia.management.externalMBeanSupport.LoggerUtil.<init>:  log4j started for class: externalMBeanSupportBundleActivator
 
2019-10-09 12:51:20,584 ERROR - com.convergin.specific.axia.management.externalMBeanSupport.externalMBeanSupportBundleActivator.start:  excpetion on ExternalMBeanSupportMgr: java.lang.RuntimeException: domain name property 'wcs.domain' not set.
 
== BEGIN SCRIPT
 
File: monitoring_runtime.xml
 
[scriptdaemon] starting with cycleTime: 10000 iterations: 2000 outfile: /work/temp/monitoring_daemon_out.xml

After the daemon is started, you can commands (for example: Ctrl-Z, bg, or disown) to move the process to the background. You can lower the priority of this process using the nice command. For example:

>nice -n 19 ./scriptDaemon.sh scripts/monitoring_runtime.xml

Note the following details about the scripting engine:

  • The property axia.console.script.daemon.cycle.time is specified in milliseconds.

  • The script will keep on running even if the managed server is shut down for some time.

  • The script will keep on running even if there are problems retrieving the specified MBean attributes.

  • The output file, defined by axia.console.script.daemon.outfile, is opened and closed for each cycle/script execution. This makes it possible to clear the output file by simply removing the output or clear it by doing something like "echo > ocsb_script.out".

  • If you need the script to execute "forever" just use a really large integer value for axia.console.script.daemon.cycle.iterations. If you specify iterations = 999999999 and time = 10000 it will keep the script running for approx 317 years.

Sample Monitoring XML Output

The monitoring output of the scripting engine is an XML file (for example, monitoring_daemon_out.xml). Here is an example of the monitoring output:

<scriptdaemon maxIterations="500000" startTime="2019-10-31 01:43:37.882 CST">
<!--
Hosts summary:
Name:pn_1, Host:10.182.12.218, RegistryPort:9070
Name:pn_2, Host:10.182.12.218, RegistryPort:9071
Name:pn_2, Host:10.182.12.218, RegistryPort:9071
Name:ssu_1, Host:10.182.12.218, RegistryPort:9080
-->
<!--*************************************************************************-->
  <iteration iter="1" maxIterations="500000" time="2019-10-31 01:43:37.910 CST">
    <host name="pn_1" ip="10.182.12.218" registryPort="9070">
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <error>InstanceNotFoundException</error>
      </mbean>
    </host>
    <host name="pn_2" ip="10.182.12.218" registryPort="9071">
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <attribute name="SessionCount">0</attribute>
      </mbean>
    </host>
    <host name="pn_2" ip="10.182.12.218" registryPort="9071">
      <mbean name="try failed">
        <error>javax.management.MalformedObjectNameException: Key properties cannot be empty</error>
      </mbean>
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <attribute name="SessionCount">0</attribute>
      </mbean>
    </host>
    <host name="ssu_1" ip="10.182.12.218" registryPort="9080">
      <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.in,nodeId=*,tier=back">
        <attribute name="Size">5</attribute>
      </mbean>
      <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.out,nodeId=*,tier=back">
        <attribute name="Size">0</attribute>
      </mbean>
    </host>
  </iteration>
<!--*************************************************************************-->
  <iteration iter="2" maxIterations="500000" time="2019-10-31 01:43:48.116 CST">
    <host name="pn_1" ip="10.182.12.218" registryPort="9070">
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <error>InstanceNotFoundException</error>
      </mbean>
    </host>
    <host name="pn_2" ip="10.182.12.218" registryPort="9071">
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <attribute name="SessionCount">0</attribute>
      </mbean>
    </host>
    <host name="pn_2" ip="10.182.12.218" registryPort="9071">
      <mbean name="try failed">
        <error>javax.management.MalformedObjectNameException: Key properties cannot be empty</error>
      </mbean>
      <mbean name="com.convergin:Type=OeRuntime,Version=2.0.0.0,Location=*,Name=oe_instance,CountingMethod=PreviousIntervalDeltaValue">
        <attribute name="SessionCount">0</attribute>
      </mbean>
    </host>
    <host name="ssu_1" ip="10.182.12.218" registryPort="9080">
      <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.in,nodeId=*,tier=back">
        <attribute name="Size">5</attribute>
      </mbean>
      <mbean name="Coherence:type=Cache,service=EBDistributedCache,name=storage.eventbroker.criteria.out,nodeId=*,tier=back">
        <attribute name="Size">0</attribute>
      </mbean>
    </host>
  </iteration>
</scriptdaemon>

Display the Monitoring Results in a Chart

You can use a chard generating tool to create a chart based on the XML output data.

For example, look into the tool jfreechart.

To run jfreechart:

admin_server\Daemon\DiagramGeneration.jar
java -jar DiagramGeneration.jar monitoring_daemon_out.xml ~\script_tool

Where the first parameter is the output XML file and the second parameter is the path to store the generated graphic.