JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc

Task: Distribute Analysis Work Over Specific Machines

Whenever you are running a parallel analysis with a remote-requesting master the analysis is potentially distributed: the analysis master will request slaves from the hub as it requires them, and will obtain some (possibly empty) set of new slaves from launch daemons in the hub's analysis cloud register.

In some cases you may want to deliberately set up an analysis that is distributed over a particular set of machines, rather than opportunistically picking up help from whichever launch daemons happen to already be part of the hub's analysis cloud. This task describes the steps to undertake in these cases.

Most of the work in this task is concerned with establishing bidirectional relationships between the analysis and the launch daemons that will contribute slaves.

For more information, see the manual section on Distributed Analysis.

CodeSonar SaaS Note: with CodeSonar SaaS, you will generally perform remote-managed analyses using the launch daemons provided in your hub's saas launchd group, rather than performing CodeSonar analyses on machines within your organization and managing your own launch daemons. With this typical CodeSonar SaaS usage, you will not need to perform manual load balancing, so the procedures described in this page will not be necessary.



Overview

To set up an analysis that is distributed across a specific set of machines you will first ensure that CodeSonar launch daemons are running on all machines in the set, then run an analysis that is configured to request slaves from all those launch daemons.

Most of the work in this task is concerned with establishing bidirectional relationships between the analysis and the launch daemons that will contribute slaves.

For the sake of this task, we suppose the following.

Permissions Needed

You will need the following permissions.

Additional permissions

These permissions are not required to set up and run the distributed analysis of ProjectX, but provide access to analysis information and functionality. You will therefore need these permissions if you want to browse analysis results.

Set Up and Run a Distributed Analysis

The procedure for setting up and running a distributed analysis can be divided into four stages.

A. Select the machines that will contribute to the analysis

The first step is to choose which machines you will distribute the analysis across. Note that there must be at least one machine, or else the analysis will not be able to make any progress.

Once you have identified the machines you will use, go on to Stage B.

B. Start launch daemons

Next, you will start a launch daemon on each machine that you selected in stage A.

  1. First, check to see if you are already running launch daemons on any of your selected machines.
    1. If the Web GUI is not already open, open it now.
    2. Sign in as a user with the required permissions.
    3. Navigate to the Analysis Cloud page:
      1. Click the Settings link at the top right of the page.
        The Settings page will open.
      2. Change to the Other Links tab.
      3. Click the Analysis Cloud link.
        The Analysis Cloud page will open.
    4. Inspect the table of launch daemons. For each machinename that you selected in Stage A, look for a table entry for which:
      • Machine is machinename
      • Hub User is alex
      • User is your system user name on machinename
      • Status is Online
    For each machinename that does not have such a table entry, you will start a new launch daemon in the next step.
  2. On each machinename on which a suitable launch daemon is not already running:
    1. Sign in as sysalex.
    2. Execute the following codesonar install-launchd command.
      codesonar install-launchd -auth password -hubuser alex hubmach:7340 -max-processes auto
      • Enter the password for the alex hub user account when prompted.
      • [Windows only] If the command seems to be taking a long time to complete, it is probably waiting for service authentication: the service authentication dialog may be hidden under other windows.
  3. Reload the Analysis Cloud page and inspect the table of launch daemons.
  4. Add the Path column to the table:
    1. Click on any column heading to open the column management menu.
    2. Select Path from the Show> submenu.
    The table will update to include the Path column.
  5. Keep the Analysis Cloud page open. You will need the Path value for the launch daemons later, and you can read them out of the table.

C. Set up and run the analysis

On the machine where you want to run the analysis master, configure and run the analysis as follows.

  1. Change to the directory where you will be running the analysis.
    cd /myprojects/projX
  2. Create a general project configuration file for ProjectX if one does not already exist.
    codesonar create-conf ProjectX
    CodeSonar will create a file called ProjectX.conf in the current working directory.
  3. Edit ProjectX.conf as follows.
    1. Add the following rules.
      REQUEST_REMOTE_ANALYSIS_SLAVES=Yes
      
      ANALYSIS_SLAVES=Auto
      
    2. For each launch daemon in your selected set, a rule of the form REMOTE_ANALYSIS_SLAVES_LAUNCHDS+=launchd_path, where launchd_path is the launch daemon Path as shown in the Analysis Cloud page.

      For example:

      REMOTE_ANALYSIS_SLAVES_LAUNCHDS += /sysalex@machineA
      REMOTE_ANALYSIS_SLAVES_LAUNCHDS += /sysalex@machineB
      REMOTE_ANALYSIS_SLAVES_LAUNCHDS += /sysalex@machineC
      
    3. If necessary, add a rule of the form ANALYSIS_MASTER_LISTEN_INTERFACE+=accessible_interface, where accessible_interface is an interface on the analysis master that all the machines in your selected set can access.
      Note that this is not always necessary: the default behavior when REQUEST_REMOTE_ANALYSIS_SLAVES=Yes and ANALYSIS_MASTER_LISTEN_INTERFACE is not specified is to listen on all interfaces on a port allocated by the operating system. You therefore only need to set ANALYSIS_MASTER_LISTEN_INTERFACE in the following cases.
      • A configuration file used by the analysis (such as the general template configuration file) has been customized to specify a restrictive interface that some of your selected machines cannot access, so you need to override it with a more permissive setting.
      • The default behavior is too permissive for your security needs, so you need to override it with a more restrictive setting, while still ensuring that the specified interface can be accessed by all your selected machines.
      For example:
      ANALYSIS_MASTER_LISTEN_INTERFACE=[::]
      # or
      ANALYSIS_MASTER_LISTEN_INTERFACE=[::]:1234
      
    (See the documentation for REQUEST_REMOTE_ANALYSIS_SLAVES, REMOTE_ANALYSIS_SLAVES_LAUNCHDS, and ANALYSIS_SLAVES , and ANALYSIS_MASTER_LISTEN_INTERFACE for more information.)
  4. Execute the analysis command.
    codesonar analyze ProjectX -auth password -hubuser alex hubmach:7340 make projX

The analysis master will build and analyze the project, requesting slaves from the hub as required and specifying (due to your REMOTE_ANALYSIS_SLAVES_LAUNCHDS setting) that those slaves should be from the launch daemons you selected.

Links

 

To report problems with this documentation, please visit https://support.codesecure.com/.