Comment on page
StackState Self-hosted v5.0.x
Metrics are collected from Splunk by executing Splunk saved searches that have been specified in the StackState Agent V1 Splunk Metrics check configuration. In order to receive Splunk metrics data in StackState, you will therefore need to add configuration to both Splunk and StackState Agent V1.
The Splunk Metrics check on StackState Agent V1 will execute all configured Splunk saved searches periodically. Data will be requested from the last received metric timestamp up until now.
StackState Agent V1 executes the Splunk saved searches configured in the Splunk Metrics Agent check configuration file and pushes retrieved data to StackState as a telemetry stream. The following fields from the results of a saved search are sent to StackState:
Splunk Metrics Agent check configuration
| table _time VMName Value
| eval VMName = upper(VMName)
| rename VMName as metricCpuUsageAverage, Value as valueCpuUsageAverage
| eval type = "CpuUsageAverage"
The example Splunk saved search above would result in the following metric data in StackState:
To enable the Splunk Metrics integration and begin collecting metrics data from your Splunk instance, the Splunk Metrics check must be configured on StackState Agent V1. The check configuration provides all details required for the Agent to connect to your Splunk instance and execute a Splunk saved search.
To configure the Splunk Metrics Agent check:
- 1.Edit the StackState Agent V1 configuration file
- 2.Under instances, add details of your Splunk instance:
- url - The URL of your Splunk instance.
- tags - Optional. Can be used to apply specific tags to all reported metrics in StackState.
- 3.Under saved_searches, add details of each Splunk saved search that the check should execute. Each saved search can retrieve one metric:
- name - The name of the Splunk saved search to execute.
- metric_name_field - The field in the Splunk results that will contain the metric name. Default
- metric_value_field - The field in the Splunk results that will contain numerical data. Default
- match: - Regex used for selecting Splunk saved search queries. Default
- app - The Splunk app in which the saved searches are located. Default
- request_timeout_seconds - Default
- search_max_retry_count - Default
- search_seconds_between_retries - Default
- batch_size - Default
- initial_history_time_seconds - Default
- max_restart_history_seconds - Default
- max_query_chunk_seconds - Default
- parameters - Used in the Splunk API request. The default parameters provided make sure the Splunk saved search query refreshes. Default
- 5.Save the configuration file.
- 6.Restart StackState Agent V1 to apply the configuration changes.
- 7.Once the Agent has restarted, wait for the Agent to collect data and send it to StackState.
To prevent sending duplicate metrics over multiple check runs, received saved search records must be uniquely identified for comparison. By default, a record is identified by the Splunk default fields
_cd. This behavior can be customized for each saved search by specifying
unique_key_fieldsin the Splunk Metrics Agent check configuration. Note that the specified
unique_key_fieldsfields are mandatory fields for each record returned by the Splunk saved search.
If it is not possible to uniquely identify a record by a combination of specific fields, the whole record can be used by setting
unique_key_fields: (an empty list).
To disable the Splunk Metrics Agent check:
- 1.Remove or rename the Agent integration configuration file, for example:mv conf.d/splunk_metrics.yaml conf.d/splunk_metrics.yaml.bak
- 2.Restart the StackState Agent to apply the configuration changes.