Configuring Inventory Processor
Settings Description
Inventory Processor is the executable module file responsible for populating the asset database. The standard executable file name is: moduleInventory-<version>.
Configuration File
To run Inventory Processor, a configuration file named config.yml must be present in the module folder. It contains the following parameters:
| Parameter | Description | Required |
|---|---|---|
opensearch | List of OpenSearch cluster servers. | Yes |
username | Username for connection. | Yes |
password | Password for connection. | Yes |
cert | CA certificate for authentication verification. | Yes |
join_events_with_null_value | Skip empty keys during the aggregation stage. | No |
include_assets | List of asset configurations requiring processing. If not specified, all configurations will be processed. | No |
Example config.yml content:
opensearch: ['https://172.16.0.60:9200']
username: 'admin'
password: 'pass'
cert: 'root-ca.pem'
join_events_with_null_value: false
include_assets:
- asset_name: 'Hosts'
search_fields: ['hostname']
- asset_name: 'Users'
search_fields: ['username']
If you need to hide the password from the Inventory configuration file, the username and password parameters can be omitted from the configuration file and specified via environment variables instead:
SM_INV_USERNAME and SM_INV_PASSWORD.
Environment variable values override parameters set in the configuration file. To pass environment variables to a cron job, define them in the /home/opensearch/.profile file and run the cron job via bash. Access to the /home/opensearch/.profile file should be strictly limited, allowing only the root user and the user running the service to read it.
Example crontab for the opensearch user:
* * * * * bash -l -c "cd /app/inventory; ./moduleInventory"
Example /home/opensearch/.profile:
export SM_INV_USERNAME=admin
export SM_INV_PASSWORD=VeryStrongPassword
Launch Parameters
The Inventory Processor executable supports the following launch parameters:
-v- display version-log- duplicate log output to console (optional)-with-index- fast search for partial similarity candidates (optional)-bulk-changes- send asset changes via bulk request (optional)
./moduleInventory -v
./moduleInventory -log -with-index -bulk-changes
./moduleInventory -with-index -bulk-changes
./moduleInventory
Setup Process
To configure Inventory Processor, open a terminal as the root user to execute commands.
In the terminal, perform the following steps:
- Create a working directory. For example, the directory
/app/inventory/.
mkdir /app/inventory
- Copy the Inventory Processor executable
moduleInventoryto the working directory - Change the group and owner of the working directory and its contents to the group and user
that will run Inventory Processor, e.g.,
opensearch
chown -R opensearch:opensearch /app/inventory/moduleInventory
- УSet execute permissions for the
moduleInventoryfile.
chmod +x /app/inventory/moduleInventory
- In the Inventory Processor working directory, create the config.yml file and fill it out according to the Configuration File section
- To periodically update the asset database, configure a cron job