Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clickhouse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@

This check monitors [ClickHouse][1] through the Datadog Agent.

Enable [Database Monitoring][11] (DBM) for enhanced insights into query performance and database health. In addition to the standard integration, Datadog DBM provides query-level metrics, live and historical query snapshots, query explain plans, query errors, and parts and merges observability.

**Note**: Database Monitoring for ClickHouse is in Preview.

**Minimum Agent version:** 7.16.0

## Setup

<div class="alert alert-info">This page describes the standard ClickHouse Agent integration. If you are looking for the Database Monitoring product for ClickHouse, see <a href="https://docs.datadoghq.com/database_monitoring/setup_clickhouse/" target="_blank">Database Monitoring for ClickHouse</a>.</div>

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates][2] for guidance on applying these instructions.

### Installation
Expand Down Expand Up @@ -116,3 +122,4 @@ Need help? Contact [Datadog support][10].
[8]: https://github.com/DataDog/integrations-core/blob/master/clickhouse/metadata.csv
[9]: https://github.com/DataDog/integrations-core/blob/master/clickhouse/assets/service_checks.json
[10]: https://docs.datadoghq.com/help/
[11]: https://docs.datadoghq.com/database_monitoring/setup_clickhouse/
10 changes: 10 additions & 0 deletions proxmox/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ files:
example: true
display_default: false
required: false
- name: infrastructure_mode
description: |
The infrastructure mode to use. Valid values are 'full' (default) and 'basic'.
fleet_configurable: true
value:
type: string
example: full
enum:
- full
- basic
- name: resource_filters
display_priority: 1
description: |
Expand Down
1 change: 1 addition & 0 deletions proxmox/changelog.d/24008.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add infra_mode tag to proxmox metrics.
7 changes: 6 additions & 1 deletion proxmox/datadog_checks/proxmox/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ALLOWED_FILTER_PROPERTIES,
ALLOWED_FILTER_TYPES,
EVENT_TYPE_TO_TITLE,
INFRA_MODE_METRIC,
NODE_RESOURCE,
OK_STATUS,
PERF_METRIC_NAME,
Expand Down Expand Up @@ -138,7 +139,11 @@ def _submit_resource_metrics(self, resource, tags, hostname):
metric_value = resource.get(metric_name)
metric_method = self.count if metric_name in RESOURCE_COUNT_METRICS else self.gauge
if metric_value is not None:
metric_method(f'{metric_name_remapped}', metric_value, tags=tags, hostname=hostname)
metric_tags = tags
infra_mode = self.config.infrastructure_mode
if metric_name_remapped == INFRA_MODE_METRIC and hostname and infra_mode != 'full':
metric_tags = list(tags) + [f'infra_mode:{infra_mode}']
metric_method(f'{metric_name_remapped}', metric_value, tags=metric_tags, hostname=hostname)

def _get_vm_hostname(self, vm_id, vm_name, node):
try:
Expand Down
4 changes: 4 additions & 0 deletions proxmox/datadog_checks/proxmox/config_models/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def instance_enable_legacy_tags_normalization():
return True


def instance_infrastructure_mode():
return 'full'


def instance_kerberos_auth():
return 'disabled'

Expand Down
1 change: 1 addition & 0 deletions proxmox/datadog_checks/proxmox/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class InstanceConfig(BaseModel):
enable_legacy_tags_normalization: Optional[bool] = None
extra_headers: Optional[MappingProxyType[str, Any]] = None
headers: Optional[MappingProxyType[str, Any]] = None
infrastructure_mode: Optional[Literal['full', 'basic']] = None
kerberos_auth: Optional[Literal['required', 'optional', 'disabled']] = None
kerberos_cache: Optional[str] = None
kerberos_delegate: Optional[bool] = None
Expand Down
2 changes: 2 additions & 0 deletions proxmox/datadog_checks/proxmox/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@
ALLOWED_FILTER_PROPERTIES = ['resource_name']
ADDITIONAL_FILTER_PROPERTIES = ['hostname']
ALLOWED_FILTER_TYPES = ['include', 'exclude']

INFRA_MODE_METRIC = 'cpu'
5 changes: 5 additions & 0 deletions proxmox/datadog_checks/proxmox/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ instances:
#
# empty_default_hostname: true

## @param infrastructure_mode - string - optional - default: full
## The infrastructure mode to use. Valid values are 'full' (default) and 'basic'.
#
# infrastructure_mode: full

## @param collected_task_types - list of strings - optional - default: ['qmstart', 'qmstop', 'qmshutdown', 'qmreboot', 'qmigrate', 'qmsuspend', 'vzstart', 'vzshutdown', 'vzsuspend', 'startall', 'stopall', 'suspendall', 'aptupdate']
## Which Proxmox task types to collect.
##
Expand Down
28 changes: 28 additions & 0 deletions proxmox/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,34 @@ def test_events(get_current_datetime, dd_run_check, aggregator, instance, collec
assert len(aggregator.events) == len(expected_events)


@pytest.mark.parametrize(
('infrastructure_mode', 'expected_count'),
[
pytest.param('basic', 2, id='basic mode adds infra_mode tag'),
pytest.param('full', 0, id='full mode does not add infra_mode tag'),
pytest.param(None, 0, id='unset mode does not add infra_mode tag'),
],
)
@pytest.mark.usefixtures('mock_http_get')
def test_infra_mode_tag(dd_run_check, aggregator, instance, infrastructure_mode, expected_count):
instance = copy.deepcopy(instance)
if infrastructure_mode is not None:
instance['infrastructure_mode'] = infrastructure_mode
check = ProxmoxCheck('proxmox', {}, [instance])
dd_run_check(check)

aggregator.assert_metric_has_tag_prefix('proxmox.cpu', 'infra_mode:', count=expected_count)

# assert that no container metrics have an infra_mode tag
for metric in aggregator.metrics('proxmox.cpu'):
if 'proxmox_type:container' in metric.tags:
assert not any(t.startswith('infra_mode:') for t in metric.tags)
# assert only the cpu metric has an infra_mode tag
for metric_name in ALL_METRICS:
if metric_name != 'proxmox.cpu':
aggregator.assert_metric_has_tag_prefix(metric_name, 'infra_mode:', count=0)


@pytest.mark.parametrize(
('resource_filters, expected_vms, expected_nodes'),
[
Expand Down
Loading