A process can have multiple threads, all executing at the same time. It is a unit of execution in concurrent programming. A thread shares the data segment, code segment, files, etc. with its peer threads. It is an execution unit that is part of a process. A thread is lightweight and can be managed independently by a scheduler. Process and thread have two types of monitoring metrics groups which are listed below:

- Process Stats: This monitor monitors process monitoring and process I/O stats and will only work if the CMON version is greater than or equal to 4.2.0.
- Process Count by State: This monitor will provide the total number of processes in each state.

Note: You can see the monitor information for specific monitors by clicking on the Information icon provided alongside the monitor type.

## Platform/OS Supported

- Ubuntu 16
- Ubuntu 20
- RHEL (Version: 6.7,7.5 and 7.9)
- SUSE

## Pre-Requisites

1. The machine agent (CMON) should be running o

   ## n the target server i.e. the machine from where you want to get OS related data.

TTo check the CMON status, execute the following command:
/etc/init.d/cmon status

If CMON is running successfully, you will get an output like this: cmon is running with PID(<pid_number>)

2. Test should be running. Check the status of the test run(TR) via the following command: nsu_show_storm.

## Monitor Group Configuration

### Common Configuration

All metrics in both monitors have the following common fields which are optional:

- Frequency: Each sample will come in a selected frequency in the graph. It can be 10 secs, 10 minutes, 1 hour, 4 hours, or 1 day.
- Other Arguments: This is for enabling debug mode or passing any extra argument in JSON.

## Monitor Group-Specific Configuration

The following monitor groups have additional configuration fields, described below:

- Process Stats:
  - Process Name: Enter the process name which you want to search.
  - Search through Criteria: The criteria through which you search process details. We have the following criteria:
    - PID: Process ID via which you want to search your process.
    - File Name: Used to search processes via the complete file name from where the process is being executed.
    - Search Pattern: It is the pattern to be searched.
    - Search Pattern of Regex: A regular expression is a form of advanced searching that looks for specific patterns.
    - Use Command- Searching through command.
    - Search Attributes: The path/PID/command you want to show the process details.
  - Occurrence: All the processes are selected in this.
  - Include Child Processes: This field is to determine whether to include the child process or not.

Notes:

- TCP Queue Stats: It has the following fields:
  - Local IP Port: Provide an IP port from where you want to capture TCP queue stats.
  - Foreign IP Port: Provide a destination address where the application is deployed that you want to capture TCP queue stats.
- Network Bandwidth: It has the following fields:
  - Host: Provide the NetCloud hostname.
  - Port: Provide the corresponding NC port for the NC host.

## Deploy Monitors

Once you have provided the details , you can perform the following operations:

- Add: To add the Process and thread monitor, you have to click on the ADD Add
- Edit: To modify existing monitor details in the table, you have to click on the Edit Edit
- Delete: To delete the monitor, you have to click on the Delete Delete

## Deploy Monitors

Deploy the configured monitors using our machine agent. The following fields need to be filled in to deploy:

- Tier: Tier is used to select the tier on which the monitor(s) will be deployed. Select the required tier from the drop-down list.
- Server: You can select the server(s) of the selected tier on which the configured monitor(s) will get deployed.

Based on the requirement, you can select any one of the following:

- All: Deploy the configured monitors on all the servers of the selected tier.
- Any: Select any one of the servers where monitors will be deployed.
- Specified Server: Select one or multiple servers of the chosen tier on which the monitor(s) will be deployed. It means that with monitors whether we require all servers, any server, or a specified server.
- Exclude Server: In this field, you have to select one or more servers that you want to exclude.
- Exclude Tier: In this field, you have to select one or more tiers that you want to exclude.

Notes:

- If you want to add more tiers and servers, then you can click on the Add Agent Tier-Server
- Once you have selected all the fields, you have to click on the Add Add button to add the tier and server.
- On clicking the add button, the tier server will be added in the table.
- You can perform the following actions in the table which are listed below:
  1. Edit: In edit option, you can edit the configuration. To perform this operation, you have to click on the Edit Monitor Configuration Once you have edited the configuration, you have to click on the Update Update button to update the table. You can also click on the
     Cancel Cancel button if you don’t want to edit the window.
  2. Delete: In delete, you can delete the configuration. To perform this operation, you have to click on the Delete button
  3. Test Monitor:
     - In test monitor, you have to select tier, server, frequency, and duration from the dialog box and then click on the Test Monitor Once you click on the test button, the test will start and the Open Dashboard Open Dashboard button will be enabled and the monitor log will be displayed.
     - Once you click on the open dashboard button, a new dashboard will open in a separate tab where you can see the data.

## Validation

Once the Process and Thread monitors are configured, you can validate by either checking the monitor homepage where a section for Process and Thread monitors along with details like total, running, and failed monitors is given, or check for the configured monitors from the metric tree, against the tier/server/instance for which this metric is configured.