Performing Functions By Using a Command Line

Overview

You can issue commands to call SAS Environment Manager script files, which enable you to perform actions such as running the ETLs, installing kits, or enabling new HTTP checks. The files (.sh files for UNIX and .bat files for Windows) are provided in the directory [levelroot]/Web/SASEnvironmentManager/emi-framework/bin (UNIX) or [Levelroot]\Web\SASEnvironmentManager\emi-framework\bin (Windows). Some commands are for commonly used functions, and others are for utilities or functions that are used infrequently. The following commands are provided:
  • commonly used commands
    • emi_init
    • master_acm_etl
    • master_apm_etl
    • validate
  • utility commands
    • agentClone
    • apm_init
    • create_event
    • create_http_checks
    • ev_kit_installer
    • exportDataMart
    • fedInit
    • runSASJob
    • updateFedDataMart
    • ugipInit
Specify the -h option on any command to display the Help.
Note: The /emi-framework/bin directory contains additional commands that are not documented in this chapter. These commands are used by internal SAS Environment Manager processes, and are not intended to be run separately. Do not run these undocumented commands unless directed to by SAS Technical Support.

Working with Commonly Used Commands

Initializing the EMI Framework Using emi_init

Use the emi_init command to initialize the EMI framework (provided as part of extended monitoring), or to enable the ACM ETL, APM ETL, or solution kits ETL. Issue this command as part of the process of initializing and enabling the components of the Service Architecture. See Initializing and Enabling the Service Architecture for more information about using this command.
The syntax of the command is: emi_init(.sh|.bat) [-dfhisv] [(—–enable|—–disable) <ACM,APM,ALL>] [—–vafeed <ON|OFF>] [—–resetDB —–resetFlags]
Options are:
-d (--debug)
enables debug output
-f (--force)
re-initializes the framework and overwrites settings
-h (--help)
displays help for the command
-i (--initialize)
initializes the framework
-s (--status)
reports the operational status of the EMI framework
-v (--verbose)
enables verbose output
- -enable <[APM,ACM,ALL]>
specifies the components to enable. ALL enables the APM, ACM, and solution kits ETL.
- -disable <[APM,ACM,ALL]>
specifies the components to disable. ALL disables the APM, ACM, and solution kits ETL.
--vafeed <ON|OFF>
enables or disables the nightly feed of data mart tables to a drop zone directory, where they are autoloaded into SAS Visual Analytics
-- resetDB
resets the data mart and purges all data; you cannot recover the data after issuing this command
Note: If you run the command emi_init –f --resetDB, you must restart your SAS Application servers. If you do not restart the servers, logs are collected without the original header information for the logs. In order for the ETL process to be able to fully parse and characterize the contents of the log files, the header information must be present.
--resetFlags
resets the flags that identify the components that have been initialized and enabled

Running the APM ETL Processes By Using master_apm_etl

The APM ETL processes are specified to run at 1 AM by default (this time can be changed in SAS Environment Manager). Use the master_apm_etl command if you want to run the processes manually or at another time. The command runs the processes to extract the information from the SAS logs and load it into the data mart. You can use a scheduler to issue the command at a specified time to run the ETL processes at a time other than the default. You can also issue the command yourself to run the processes immediately. However, because the SAS logs roll over at midnight, whenever the ETL processes run after midnight, they always use the same data that was collected during the previous 24 hours.
Although you can run the ETL process at any time, the reports use data from the last time the ETL process was run.
The syntax of the command is: master_apm_init(.sh|.bat) [-dhv -–evdebug <0–3>]
Options are:
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-v (--verbose)
enables verbose output
--evdebug <0–3>
specifies the debug level for SAS sessions

Running the ACM ETL Processes Using master_acm_etl

The ACM ETL processes are specified to run at 12 midnight by default (this time can be changed in SAS Environment Manager). Use the master_acm_etl command if you want to run the processes manually or at another time. The command runs the processes to extract the ACM data and load it into the data mart. You can use a scheduler to issue the command at a specified time to run the ETL processes at a time other than the default. You can also issue the command yourself to run the processes immediately.
Although you can run the ETL process at any time, the reports use data from the last time the ETL process was run.
The syntax of the command is: master_acm_init(.sh|.bat) [-dhv -–evdebug <0–3>]
Options are:
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-v (--verbose)
enables verbose output
--evdebug <0–3>
specifies the debug level for SAS sessions

Validating the SAS Environment Manager Framework By Using validate

Use the validate command to validate the structure of the SAS Environment Manager framework and to find any errors or changes. This command runs during the initialization process to verify that the framework is correct before anything new is added. The command has four levels:
1
verifies that the command-line interface is functioning properly
2
validates connections to the SAS execution environment and the SAS Environment Manager server
3
verifies that the framework is initialized and functioning properly and that all enabled ETL components are running successfully
4
checks all of the files associated with SAS Environment Manager that should not be changed and notes any changes to any of these files
The syntax of the command is: validate(.sh|.bat) [-qvdh] [–l <1|2|3|4>] [-p| -–userPolicy <IGNORE|WARN|ERROR>]
Options are:
-q (--quiet)
specifies that the command should run in quiet mode
-v (--verbose)
enables verbose output
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-l --level <1|2|3|4>
specifies the level of validation to perform; default value is 1
-p --userPolicy <IGNORE|WARN|ERROR>
specifies the policy if the current user does not match the install user

Working with Utility Commands

Cloning an Agent By Using agentClone

Use the agentClone command to create a machine-neutral bundle (TAR or ZIP) file of the SAS Environment Manager agent. This script enables SAS Environment Manager to monitor machines in your environment that do not have SAS deployed on the machines (such as grid nodes, machines that contain databases used by SAS, or machines in a Hadoop cluster).
To use this script to monitor a machine in your environment, follow these steps:
  1. Use the agentClone script to create the TAR or ZIP bundle.
  2. Copy the bundle file to a server (such as a SAS grid server) that is not part of the standard SAS environment installed by the SAS Deployment Wizard. This machine is referred to as the target machine in this procedure.
  3. Extract the file.
  4. Verify that the directory /agent/Logs exists on the target machine. Create the directory if it does not exist.
  5. Compare the values for JAVA_HOME and JAVA_HQ_HOME on the target machine against the values on the SAS Environment Manager server. If the values are different on the target machine, change the values in the files hq-agent(.sh |.bat) and hq-agent.nowrapper(.sh |.bat) on the target machine so that they match the value on the SAS Environment Manager server.
  6. Start the agent on the target machine. When you start the agent, it automatically registers with the SAS Environment Manager server.
If you change the password for the sasevs@saspw account on the SAS Environment Manager server, you must update the password value in the agent.setup.camPword property in the agent.properties file on the target machine.
The syntax of the command is: agentClone(.sh|.bat) [-vdh] [–-javahome <javahome>] [-–sasconfig <sasconfig>] [-–sashome <sashome>] [-t <Minimal|Select>] [–w <workingDir>] [bundlefile]
Options are:
-v (--verbose)
enables verbose output
-d (--debug)
enables debug output
-h (--help)
displays help for the command
--javahome <javahome
specifies the default location of Java for the agent bundle
--sasconfig <sasconfig>
specifies the SAS root level directory for the agent bundle
--sashome <sashome>
specifies the SAS home directory for the agent bundle
-t (--type) <Minimal|Select>
specifies whether certain plug-ins are included (Select) or omitted (Minimal) to minimize the size of the clone file and the memory required
-w (--workdir) <workingDir>
specifies the directory to use when constructing the TAR or ZIP file
bundlefile
specifies the name of the TAR or ZIP file that contains the clone of the SAS Environment Manager agent

Initializing the APM Processes By Using apm_init

Use the apm_init command to initialize the APM ETL processes. Manual steps are also required after you run this command. See Enabling and Initializing the APM ETL for complete information about the initialization process.
The syntax of the command is: apm_init(.sh|.bat) [-fvdh -–hostAlias]
Options are:
-d (--debug)
enables debug output
-f (--force)
forces configuration to occur, even if a previous version of APM is found, or if APM has already been initialized
-h (--help)
displays help for the command
--hostAlias
specifies the host alias for the machine
-v (--verbose)
enables verbose output

Creating an Event By Using create_event

Use the create_event command to manually create a SAS Environment Manager event. After it is created, the event appears in the SAS Environment Manager Event Center.
The syntax of the command is: createEvent(.sh|.bat) [-vdh] [-f <file>] [–l <INFO|WARN|ERROR>] [–s <source>]
Options are:
-v (--verbose)
enables verbose output
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-f (--file) <file>
specifies the event file
-l (--level) <INFO|WARN|ERROR>
specifies the level of the event to create (INFO is the default value)
-s (--source)source
specifies the source of the event

Creating an HTTP Check By Using create_http_checks

Use the create_http_checks command to create an HTTP check service based on the definitions in the file httpChecks.json. This file contains all of the predefined HTTP check definitions, but not all of these definitions are created by default. To create one of the definitions:
  1. After you have initialized the framework (part of the extended monitoring initialization), edit the file [levelroot]/Web/SASEnvironmentManager/emi-framework/Conf/httpChecks.json (UNIX) or [Levelroot]\Web\SASEnvironmentManager\emi-framework\Conf\httpCHecks.json (Windows).
  2. Locate the entry for the HTTP check that you want to create. This is an example entry:
    {
        "name": "HTTP Check for SASTheme_default",
        "desc": "[Auto-Generate] HTTP Monitoring URL: /SASTheme_default",
        "enable": "false",
        "method": "GET",
        "port": "7980",
        "sotimeout": "30",
        "platform": "ptnode19.ptest.sas.com",
        "path": "/SASTheme_default",
        "follow": "true",
        "pattern": "SASTheme_default"
      },
    
  3. Change the value of the enable parameter from false to true. "enable": "false",
  4. Save the httpChecks.json file.
  5. Run the create_http_checks command.
To verify that the service has been created, sign on to SAS Environment Manager and select Browsethen selectServices. The new HTTP check service is listed,
The syntax of the command is: create_http_checks(.sh|.bat) [-fxvdh] [-t <taskfile>]
Options are:
-t (--taskfile) <taskfile>
specifies that the HTTP checks should not be generated, but should be based on the specified JSON task file
-f (--force)
re-initializes the HTTP checks and overwrites settings
-x (--noexit)
specifies that the Java virtual machine should not exit after the command is completed
-v (--verbose)
enables verbose output
-d (--debug)
enables debug output
-h (--help)
displays help for the command

Installing a Solution Kit By Using ev_kit_installer

Solution kits provide customized metrics and reports to support specific SAS solutions and applications. Use the ev_kit_installer command to install new solution kits.
The syntax of the command is: ev_kit_installer(.sh|.bat) [-fvdh] [-k <kitname|ALL>]
Options are:
-f (--force)
replaces the existing kit configurations
-v (--verbose)
enables verbose output
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-k (--kitName) <kitname|ALL>
specifies the name of the kit to install, or that all kits should be installed

Exporting Data Mart Contents By Using exportDataMart

You can set up a federated data mart, which merges data from the data marts of several contributor deployments into the data mart of a host deployment. See Creating a Federated Data Mart for complete information. Although you can set up an automatic nightly process to export the changes in a contributor’s data mart, there might be instances when you might want to export the entire contents of the data mart. For example, when you first set up the federated data mart, you can run a complete export to ensure that the federated data mart is complete.
The syntax of the command is: exportDataMart(.sh|.bat) --deploymentID (altDeployment_ID) --runID (altRun_ID)
Options are:
--deploymentID altDeployment_ID
specifies an alternate deployment identifier. This option is useful in cases where multiple deployments use the same deployment identifier.
--runID altRun_ID
specifies an alternate identifier for the export job. The identifier is used in the filename of the TAR file that contains the exported data mart data.

Initializing a Federated Data Mart By Using fedInit

Use the fedInit command to create and initialize a federated data mart. Run this script on the machine that will host the federated data mart directories. After you run this script, you must perform additional steps in order to implement the federated data mart. See Creating a Federated Data Mart for instructions.
The syntax of the command is: fed_init(.sh|.bat) [-vdh] [-—resetDB]
Options are as follows:
-v (--verbose)
enables verbose output.
-d (--debug)
enables debug output.
-h (--help)
displays help for the command.
– – resetDB
resets the federated data mart by purging all of the existing data.
CAUTION:
If you use the – – resetDB option, the deleted data cannot be recovered.

Accessing SAS Environment Manager with a SAS Job By Using runSASJob

Use the runSASJob command to run a SAS program with the SAS autoexec and environment necessary for the program to access the data mart and the EMI framework.
CAUTION:
Do not run this command unless directed to by SAS Technical Support. Running this command incorrectly could corrupt the data mart and cause loss of data.
The syntax of the command is: runSASJob(.sh|.bat) [-bdhv] [––args <args>] [––autocall <autocall_dir>] [––autoexec <(BATCH|APM|KITS|STP) | <autoexec_file>] [––config <config_file>] [––evdebug <0–3>] [––log <log_results_file>] [––nodms] [––printfile <output_file>] [––work <saswork_dir>] [––workdir <working_dir>]
Options are:
-b (--batch)
specifies that the SAS program runs in batch mode (with the SAS options -batch -noterminal)
-d (--debug)
enables debug output
-h (--help)
displays help for the command
-v (--verbose)
enables verbose output
--args <args>
specifies any SAS command line arguments to be appended to the SAS invocation command
--autocall <autocall_dir>
specifies the autocall directory to use
--autoexec <(BATCH|STP) | <autoexec_file>
specifies whether to use a defined autoexec file (such as BATCH or STP) or a specified autoexec file
--config <config_file>
specifies a custom configuration file to use
--evdebug <0–3>
specifies the debug level for the SAS session
--log <log_results_file>
specifies the file to contain the log results
--nodms
specifies that SAS should run in line mode with the framework enabled
--printfile <output_file>
specifies the output file for SAS procedures
--work <saswork_dir>
specifies the SAS Work directory
--workdir <working_dir>
specifies the relative working directory (or parent path) used when running a SAS program

Importing Contributing Data Mart Contents By Using updateFedDataMart

You can set up a federated data mart, which merges data from the data marts of several contributor deployments into the data mart of a host deployment. See Creating a Federated Data Mart for complete information. The contributor deployments export data from their data marts (contained in a TAR file) through automatic or manual processes. After the data is exported, you must copy it to the emi-framework/LandingZone/FedDataMart directory on the host deployment. After the files are in this directory, you can run the updateDataMart script to load the data from the contributor deployments into the federated data mart. By default, the script imports all files that are in the LandingZone directory that follow the naming convention SASEVDM_EXPORT#deployID#runID.tar.
The syntax of the command is: updateFedDataMart(.sh|.bat) --inputfile (filename) --altDeployID (override_ID) --altDeployLabel(override_label)
Options are:
--inputfile filename
specifies a filename to import, rather than having the script search the directory.
--altDeployID override_ID)
specifies an alternate deployment identifier for the file specified by the --inputfile option.
--altDeployLabel override_label
specifies an alternate deployment label for the file specified by the --inputfile option.

Updating a Modified Data Mart By Using ugipInit

If you modified your service architecture and updated to SAS Environment Manager 2.5, you must make manual changes to the service architecture, then run the ugipInit command. See Updating the Service Architecture in SAS Environment Manager 2.5 for complete information.
The syntax of the command is ugipInit.(sh | .bat).
CAUTION:
This command is normally run automatically as part of the upgrade process. Do not run this command unless directed to by SAS Technical Support.