services-cli

The services-cli utility enables you to control, monitor, and troubleshoot the following services from the command line.

For more information, see Control-M/EM Services.

You can send commands to all services, expect third party services, such as Kafka and Zookeeper. The commands are transferred via Kafka and are managed by the protocol translator service. The availability of the commands infrastructure depends directly on the availability of Kafka, ZooKeeper and protocol translator services. For more information, about the commands, services-cli Commands.

Running the Services-cli Utility

This procedure describes how to run the services-cli utility, which enables you control and monitor services.

Begin

  1. Do one of the following:

    • UNIX: Log in to a Control-M/EM account.

    • Windows: Open a command prompt window where Control-M/EM is installed.

  2. Type one of the following commands:

    • UNIX: em services-cli

    • Windows: services-cli

      [-l <list> | -st <status> | -dt <details> | -stop <stop the service> | -c <command string> |

      -h <help>

      Options:

      [-s <service> | i<instance> specific service}

For information about the available commands, see services-cli Commands.

services-cli Parameters

The following table describes the services-cli command parameters:

Command

Description

-l

Lists the available services

-st

Displays the status of the services

-dt

Displays the details of the services

-stop

Stops the service

-c

Sends a command string to service running on a specific instance.

You must add -s <service> and i <instance>. Use -l to view the available instances

-h

Displays the services-cli usage

services-cli Commands

The following table describes the commands which are available when using the services-cli utility:

Command

Description

Usage

help

Displays the services available commands

help <COMMAND>

heap

Displays the java heap state of the running service

heap

pstack

Displays the stack trace of threads of the running service

pstack

diagl

Sets the logging level for the service at runtime. The logging level is reset when restarting the service.

The default command sets the root log level of the running process, but the log level can be set for a specific java class or a specific package, when specifying a full class name or full name parameters.

Log level values:

  • 1: ERROR

  • 2: WARN

  • 3: INFO

  • 4: DEBUG

  • 5: TRACE

diagl [-c <className>] [-p <packageName>] -l <logLevel>

  • -c: --class-name=<className>

  • Set the logging level for specific class—full path to java class, case sensitive

  • -l: -level, --level, --log-level=<logLevel>

  • -p: --package-name=<packageName>

  • Set the logging level for the entire specified package (full path to package, case sensitive)

stop

Enables you to shut down the service immediately

stop

services-cli Command Examples

The following examples describe the command line examples using the services-cli utility in Unix:

  • To view the help through an SCA instance, type the following:

    em services-cli -s services-configuration-Agent -i sca-4c838632-1 -c “help”

  • To set the log level to ERROR for all SCA instances, type the following:

    em services-cli -s services-configuration-Agent -i all -c “diagl -l ERROR”

  • To set the diagl level for all SCA instances, type the following:

    em services-cli -s services-configuration-Agent -i all -c “diagl -level 1”

The following examples describe the command line examples using the services-cli utility in Windows:

  • To set all validation services instances log level to WARN, type the following:

    services-cli -s validation-service -i all -c “diagl -level WARN”

  • To set the diagl level for all validation services, type the following:

    services-cli -s validation-service -i all -c “diagl -level 2”

  • To send the stop command to a Control-M Reports instance, type the following:

    services-cli –s reporting-facility -i rf-d351b48b-1 –c “stop”

Stop the Services Configuration Agent Example

In this example, we want to stop the services configuration Agent on a particular instance running on Microsoft Windows.

Find the service instance name by typing the following:

services-cli -st

The following appears:

Services Configuration Agent (services-configuration-Agent) : 45bef625

Desired state = Up : Actual state = Up

To view all the commands that are supported by the services configuration Agent, type the following:

services-cli -c help -s services-configuration-Agent -i 45bef625

The following appears:

Copy

 "RESPONSE": " 
Commands:\r 
set-desired-state    Set a service or services desired state
help            Display service available commands\r 
pstack            Display the stack trace of threads\r
stop            Stop the service\r 
diagl            Set the logging level
Run 'help COMMAND' for more information on a command. 

}

To stop the the service type the following:

services-cli -c stop -s services-configuration-Agent -i 45bef625

To stop all Services configuration Agents, type the following: services-cli -stop -s services-configuration-Agent