Configuration of NetAgent
Configure NetAgent through its basic, conf, and logger property files.
Configuration of NetAgent#
Follow the steps below to configure NetAgent:
1. basic.properties: This file contains the minimum configuration required for the network agent to operate.
- agent.identifier:
- Mandatory field
- Must match the ComponentAgent identifier for the respective component instance
For example:
CA_203.0.113.13
-
config.file.name:
- Ensure the file name is correct
- Default: conf.properties
-
config.log.warns:
- Enables logging of warnings
- Allowed values: true/false
2. conf.properties: This file contains detailed configurations.
Sections include:
a. Global
- fetch.all.ips.time: NetAgent fetches IPs daily at the configured time (Default: 06:00).
fetch.all.ips.time = 06:00
- fetch.all.listenports.time: NetAgent fetches Ports (LISTEN State) at the configured time ( Default: 15 mins)
fetch.all.listenports.time = 15
- fetch.listenports.script: Script path (Default: ./scripts/getalllistenports.sh)
- stats.log.time: Stats write interval (Default: 1 minute)
stats.log.time = 1
- kpi.prefix: KPI prefix (Default: cbsg_)
kpi.prefix = cbsg_
b. DataCapture
i. name: Configures the human-readable name for the DataCapture module.
- We can give any name in case of multiple DataCapture sections configured. Each DataCapture module can have a unique name.
For example:
ens192_capture
ii. interface.name: Network interface name for monitoring TCP data.
For example:
ens192
iii. capture.filter: Specifies the ports or range of ports to monitor.
- It can have a single port or a range of ports separated by a semicolon.
For example:
capture.filter = hostports: 192.0.2.139:8084;192.0.2.139:8095
or
capture.filter = ports: 8080;8081-8088;8089-8095
or
capture.filter = raw: host 192.0.2.139 and port 8084
iv. capture.delay: Controls CPU utilization by pausing capture threads after a specified number of packets.
- Keeps the CPU utilization under control.
- Unit: Count.
- Default: 3000 (Min: 0 (disabled), Max: 1,000,000).
For example:
capture.delay = 1000
v. capture.buffer.size: Buffer size used by the capture library (libpcap).
- Unit: 1 KB
- Default: 10240 KB (10 MB), Min: 1024 (1MB), Max: 262144 (256MB).
For example: Configuring 1024 uses a 1 MB buffer size.
capture.buffer.size = 20480
vi. capture.snap.size: Number of bytes to capture per packet.
- Configure enough length to capture data up to the TCP header.
- Unit: Count.
- Default: 128 (Min: 64, Max: 512).
vii. output.queue.name: Queue name to push data to the dispatcher thread (check the dispatcher section).
- Must match the queue name from the Queue section (check the queue section for queue configuration).
For example:
output.queue.name = capture
viii. input.file.name: Specifies a pcap file for packet processing.
- This thread will not capture live data.
- The thread will exit after pushing the packets to the dispatcher.
For example:
input.file.name = /tmp/cli-reset-49572.pcap
ix. output.file.name: Used to capture the data and store it in a pcap file.
For example:
output.file.name = /<path-to>/output.pcap
x. output.file.max.count: Maximum number of pcap files to save.
- Unit: Count (Default: 8, Min: 1, Max: 32).
For example:
output.file.max.count = 4
xi. output.file.max.size: Configures pcap file output (maximum size) and rotation settings.
- Unit: Bytes [Default: 4194304 (4MB), Min: 131071 (128KB), Max: 134217728 (128MB)]
For example:
output.file.max.size = 4194304 (4 MB)
x. packet.pool.min.size: Minimum number of packet objects to be created.
- Unit: Count (Default: 4096, Min: 16)
For Example:
packet.pool.min.size = 32768
xi. packet.pool.max.size: Maximum number of packet objects that can be created.
- Unit: Count (Default: 4096, Max: 2^56)
For Example:
packet.pool.max.size = 262144
xii. logger: Redirects logs for this capture thread to a specific logger.
- Define a logger in logger.properties, and use the name field here.
- Default: capture
c. DataDispatcher
i. name: Human-readable name to identify this dispatcher thread.
- Default: Section name
ii. input.queue.name: This section specifies the queue name from which to read captured data.
- Match it to the queue name configured in one of the data captures.
- This should match the name from any of the queue sections (check the queue section for more details of queue configuration).
For example:
input.queue.name = capture
iii. output.queue.name: Specifies queue names for reading packets and writing processed data.
- Match it to the input queue name configured in one of the data processors.
- Must match the corresponding queues from the Queue section (check the queue section for more details of queue configuration).
For Example:
output.queue.name = processor1
iv. logger
- Redirects logs for this dispatcher thread to a specific logger.
- Default: dispatcher
d. DataProcessor
i. name: Human-readable name for the processor thread.
- Default: Section name
For Example:
name = loopback_processor
ii. threadpool.size: Number of worker threads for processing packet data.
- Unit: Count (Default: 4, Max: 1024)
- Don’t configure more than 80% of the total CPU cores.
threadpool.size = 4
iii. data.push.time: Interval to format KPI, forensic data, and push to the Data sender.
- Unit: Minutes (Default: 1, Min: 1, Max: 120)
For Example:
data.push.time = 1
iv. data.push.time.delay: Delay before pushing the data to the data sender.
- Unit: Seconds (Default: 5, Min: 0 (No delay), Max: 59)
For example:
data.push.time.delay = 5
v. session.cleanup.time
- Interval to clean up idle TCP sessions
- Unit: Minutes (Default: 5, Min: 1, Max: 720)
- Default: 5 minutes
For example:
session.cleanup.time = 5
vi. input.queue.name: This section specifies the queue name from which to read captured data.
- Match it to the queue name configured in the output queue of one of the data dispatchers
- Must match the corresponding queues from the Queue section (check the queue section for more details of queue configuration)
For example:
input.queue.name = processor1
vii. output.queue.name: Specifies queue names for reading and writing data (formatted KPI and forensic data).
- Match it to the input queue name configured in the data sender
- Must match the corresponding queues from the Queue section (check the queue section for more details of queue configuration)
For example:
output.queue.name = kpi_forensic
viii. time.unit: Time unit used for timestamps.
- Unit: microseconds (ms)
For example:
time.unit =
ix. timestamp.format: Configures timestamp formats and units.
- Default: “%Y-%m-%d %H:%M:%S”
For example:
timestamp.format =
x. logger
- Redirects logs for this processor thread to a specific logger
- Define a logger in logger.properties, and use the name field here
- Default: processor
e. DataSender
i. name: Human-readable name for the sender thread.
- Default: Section name
ii. input.queue.name: Specifies the queue for reading formatted KPI and forensic data.
- Match it to the output queue name configured in the processor section
- Must match the corresponding queues from the Queue section (check the queue section for more details)
For Example:
input.queue.name = kpi_forensic
iii. kpi.pipe.name: Name the pipe to send KPI data to the ComponentAgent.
- Default: /tmp/na_kpi_pipe
- Internally, two pipes of data and ack will be created to exchange data
For example:
kpi.pipe.name = /opt/Agents/NetAgent/na_kpi_pipe
iv. kpi.pipe.reopen.error.count: Reopen the KPI named pipe when there are continuous errors.
- Unit: Count
- Default: 30 (Min: 5, Max: 100)
For example:
kpi.pipe.reopen.error.count = 50
v. forensics.pipe.name: Named pipes for sending KPI and forensic data to the ComponentAgent.
- Default: /tmp/na_kpi_pipe
Note: Internally, two pipes of data and ack will be created to exchange data.
For Example:
forensics.pipe.name = /opt/Agents/NetAgent/na_forensic_pipe
vi. forensics.pipe.reopen.error.count: Reopen the forensic named pipe when there are continuous errors.
- Unit: Count
- Default: 15 (Min: 1, Max: 100)
For Example:
forensics.pipe.reopen.error.count = 50
vii. data.pool.min.size: Minimum number of KPI/Forensic message objects to be created.
- Unit: Count
- Default: 16 (Min: 8)
For Example:
data.pool.min.size = 64
viii. data.pool.max.size: Maximum number of KPI/Forensic message objects to be created.
- Unit: Count
- Default: 16 (Max: 512)
For Example:
data.pool.max.size = 256
ix. kpi.retry.count: Retry sending the KPI message if there is no acknowledgment received from the ComponentAgent.
- Unit: Count
- Default: 3 (Min: 1, Max: 16)
For Example:
kpi.retry.count = 5
x. kpi.send.window.size: Maximum number of KPI messages that can be sent to the KPI named pipe without receiving acknowledgment from the ComponentAgent.
- Unit: Count
- Default: 12 (Min: 12, Max: 1024)
For Example:
kpi.send.window.size = 12
xi. kpi.max.store: Maximum number of KPI messages that can be stored before writing to the KPI named pipe.
- This count is over the send window size (these messages are yet to be written to the pipe)
- Unit: Count
- Default: 15 (Min: 1, Max: 120)
For Example:
kpi.max.store = 15
xii. kpi.store.file: This feature is not implemented yet in NetAgent v1.0.5.5. This field can be ignored as of now.
xiii. forensic.retry.count: Retry sending the Forensic message if no acknowledgment is received from the ComponentAgent.
- Unit: Count
- Default: 3 (Min: 1, Max: 16)
For Example:
forensic.retry.count = 5
xiv. forensic.max.store: Maximum number of Forensic messages that can be stored for each TCP server IP/Port.
- For each server IP/Port, the respective minutes of data will be available in forensics
- Unit: Count
- Default: 5 (Min: 1, Max: 120)
For Example:
forensic.max.store = 5
xv. forensic.store.file: This feature is not implemented yet in NetAgent v1.0.5.5. This field can be ignored as of now.
xvi. wait.msg.cleanup.check.interval: Interval to check the unacked messages and clean up older messages.
- Unit: Minutes
- Default: 1 (Min: 1, Max: 10)
For Example:
wait.msg.cleanup.check.interval = 1
xvii. wait.msg.cleanup.time: Clean up unacked messages older than specified minutes.
- Unit: Minutes
- Default: 5 (Min: 3, Max: 30)
For Example:
wait.msg.cleanup.time = 5
xviii. logger
- Redirects logs for this sender thread to a specific logger
- Define a logger in logger.properties, and use the name field here
- Default: sender
f. Queue (Queue1, Queue2, Queue3, Queue4 and etc)
i. name: Human-readable name to identify this data sender thread.
- This name is used while configuring the input/output queue name in other sections
- Default: Section name
For Example:
name = processor1
ii. queue.type
- Possible values: memory and network.
- Memory: Data is stored/exchanged in the memory of the process.
- Network: Data is exchanged over a network.
- Default: memory.
For Example:
queue.type = memory
# or
queue.type = network
iii. queue.mode
- Supported values: standalone and group
- standalone: A single queue will be created. Used between capture->dispatcher, processor->sender.
- group: A group of queues will be created based on the processor thread count. Used between the dispatcher->processor.
- Default: standalone
For Example:
queue.mode = group
iv. queue.size.max: Maximum elements to store in the queue before dropping.
- Unit: Count
- Default: 10000 (Min: 100, Max: 10000000)
For Example:
queue.size.max = 65536
v. logger: Used to redirect this specific capture thread’s logs to a separate logger
- Define a logger in logger.properties, and use the name field here
- Default: queue
3. logger.properties: This is the logger configuration used by the network agent:
a. SectionName: Used as a log file name
- If empty, the section name will be used
- name=<file name>
i. ext: Extension of the log file
- Default: .log
ii. level: Log levels
- Allowed values: error, warn, debug
- Default: warn
iii. rotation.count: Number of files to retain during log rotation
- Default: 5 (Min: 1, Max: 128)
iv. rotation.size: Log size per file while log rotation.
- Format: <number><M/m/K/k/B/b>
- Default: 2M (Min: 512K, Max: 50M)
v. location: Log file location
- Default: ./logs (one level above bin directory)
vi. timestamp.format
- Date timestamp format used while writing logs
- Default: “%Y-%m-%d %H:%M:%S”
vii. print.to.console
- Print log messages to the terminal.
- Default: false
- Enable only for debugging
Integrating NetAgent with ComponentAgent#
Follow the steps below to integrate NetAgent with ComponentAgent:
1. Execute DB Migration: Add TCP server category/component to HEAL OOB list.
2. Create Required Entities in Control Center (CC): Create an account, application, service, and host instance
3. Create Component Instances:
- Create a component instance for each monitored port
- Type: “TCP server”
- Map instances to a host instance
4. Map ComponentAgent Identifier: Map identifier to host and TCP server instances.
5. Install and Configure Agents:
- Install ComponentAgent and NetAgent
- Configure both agents
Note: Use the HTTP endpoint when creating the ComponentAgent.
6. Pipe Configuration
named.pipe.path.write=/tmp/na_kpi_pipe_ack
named.pipe.path.read=/tmp/na_kpi_pipe_data
forensic.named.pipe.path.read=/tmp/na_forensic_pipe_data
forensic.named.pipe.path.write=/tmp/na_forensic_pipe_ack
7. NetAgent conf.properties Configuration
a. DataSender Section: Configure kpi.pipe.name and forensics.pipe.name
Default Pipes:
- /tmp/na_kpi_pipe_data
- /tmp/na_kpi_pipe_ack
- /tmp/na_forensic_pipe_data
- /tmp/na_forensic_pipe_ack
For Example:
kpi.pipe.name = /<path-to>/na_kpi_pipe
forensics.pipe.name = /<path-to>/na_kpi_pipe
b. DataCapture Section: Configure capture filters are as follows,
capture.filter = ports: 8080;8081-8088;8089-8095
# or
capture.filter = raw: host 192.0.2.139 and port 8084
# or
capture.filter = hostports: 192.0.2.139:8084;192.0.2.139:8095
Configure interface:
interface.name = ens192
8. Start NetAgent Service
9. Test Pipes Using Readers: Execute the kpireader and forensicreader from NetAgent’s bin directory.
Note: Ensure the ComponentAgent is stopped before performing this test.
./kpireader
./forensicreader ip1:port1 ip1:port2 ip2:port3...
Stop readers from using Ctrl + C.
10. Start ComponentAgent Service.
Note: Ensure the kpireader and forensicreader are stopped.