Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README templates #10564

Merged
merged 5 commits into from
Nov 8, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def create(ctx, name, integration_type, location, non_interactive, quiet, dry_ru
f"\n # The project's main homepage."
f"\n url='https://github.com/DataDog/integrations-{repo_choice}',"
)
config = construct_template_fields(name, repo_choice, **template_fields)
config = construct_template_fields(name, repo_choice, integration_type, **template_fields)

files = create_template_files(integration_type, root, config, read=not dry_run)
file_paths = [file.file_path.replace(f'{root}{path_sep}', '', 1) for file in files]
Expand Down
53 changes: 53 additions & 0 deletions datadog_checks_dev/datadog_checks/dev/tooling/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,59 @@
'wmi_check',
]

CHECK_LINKS = """\
[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://app.datadoghq.com/account/settings#agent
[3]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[4]: https://github.com/DataDog/integrations-core/blob/master/check/datadog_checks/check/data/conf.yaml.example
[5]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[6]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[7]: https://github.com/DataDog/integrations-core/blob/master/check/metadata.csv
[8]: https://github.com/DataDog/integrations-core/blob/master/check/assets/service_checks.json
[9]: https://docs.datadoghq.com/help/
"""

LOGS_LINKS = """\
[1]: https://docs.datadoghq.com/help/
[2]: https://app.datadoghq.com/account/settings#agent
[3]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[4]: **LINK_TO_INTEGRATION_SITE**
[5]: https://github.com/DataDog/integrations-core/blob/master/logs/assets/service_checks.json
"""

JMX_LINKS = """\
[1]: **LINK_TO_INTEGERATION_SITE**
[2]: https://app.datadoghq.com/account/settings#agent
[3]: https://github.com/DataDog/integrations-core/blob/master/jmx/datadog_checks/jmx/data/conf.yaml.example
[4]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[5]: https://docs.datadoghq.com/integrations/java/
[6]: https://docs.datadoghq.com/help/
[7]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[8]: https://github.com/DataDog/integrations-core/blob/master/jmx/assets/service_checks.json
"""

SNMP_TILE_LINKS = """\
[1]: https://docs.datadoghq.com/network_performance_monitoring/devices/data
[2]: https://docs.datadoghq.com/network_performance_monitoring/devices/setup
[3]: https://github.com/DataDog/integrations-core/blob/master/snmp_tile/assets/service_checks.json
[4]: https://docs.datadoghq.com/help/
[5]: https://www.datadoghq.com/blog/monitor-snmp-with-datadog/
"""

TILE_LINKS = """\
[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://app.datadoghq.com/account/settings#agent
[3]: https://docs.datadoghq.com/help/
"""

integration_type_links = {
'check': CHECK_LINKS,
'logs': LOGS_LINKS,
'jmx': JMX_LINKS,
'snmp_tile': SNMP_TILE_LINKS,
'tile': TILE_LINKS,
}

# If a file changes in a PR with any of these file extensions,
# a test will run against the check containing the file
TESTABLE_FILE_PATTERNS = ('*.py', '*.ini', '*.in', '*.txt', '*.yml', '*.yaml', '**/tests/*')
Expand Down
9 changes: 7 additions & 2 deletions datadog_checks_dev/datadog_checks/dev/tooling/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
write_file,
write_file_binary,
)
from .constants import integration_type_links
from .utils import get_license_header, kebab_case_name, normalize_package_name

TEMPLATES_DIR = path_join(os.path.dirname(os.path.abspath(__file__)), 'templates', 'integration')
Expand All @@ -27,7 +28,7 @@ def get_valid_templates():
return sorted(templates)


def construct_template_fields(integration_name, repo_choice, **kwargs):
def construct_template_fields(integration_name, repo_choice, integration_type, **kwargs):
normalized_integration_name = normalize_package_name(integration_name)
check_name_kebab = kebab_case_name(integration_name)

Expand All @@ -42,7 +43,7 @@ def construct_template_fields(integration_name, repo_choice, **kwargs):

2. Run `ddev release build {normalized_integration_name}` to build the package.

3. [Download the Datadog Agent](https://app.datadoghq.com/account/settings#agent).
3. [Download the Datadog Agent][2].
yzhan289 marked this conversation as resolved.
Show resolved Hide resolved

4. Upload the build artifact to any host with an Agent and
run `datadog-agent integration install -w
Expand All @@ -61,6 +62,7 @@ def construct_template_fields(integration_name, repo_choice, **kwargs):
support_type = 'core'
test_dev_dep = '-e ../datadog_checks_dev'
tox_base_dep = '-e../datadog_checks_base[deps]'
integration_links = integration_type_links.get(integration_type)
elif repo_choice == 'marketplace':
check_name = normalize_package_name(f"{kwargs.get('author')}_{normalized_integration_name}")
# Updated by the kwargs passed in
Expand All @@ -73,6 +75,7 @@ def construct_template_fields(integration_name, repo_choice, **kwargs):
support_type = 'partner'
test_dev_dep = 'datadog-checks-dev'
tox_base_dep = datadog_checks_base_req
integration_links = ''
yzhan289 marked this conversation as resolved.
Show resolved Hide resolved
else:
check_name = normalized_integration_name
author = 'U.N. Owen'
Expand All @@ -82,6 +85,7 @@ def construct_template_fields(integration_name, repo_choice, **kwargs):
support_type = 'contrib'
test_dev_dep = 'datadog-checks-dev'
tox_base_dep = datadog_checks_base_req
integration_links = integration_type_links.get(integration_type)
config = {
'author': author,
'check_class': f"{''.join(part.capitalize() for part in normalized_integration_name.split('_'))}Check",
Expand All @@ -97,6 +101,7 @@ def construct_template_fields(integration_name, repo_choice, **kwargs):
'support_type': support_type,
'test_dev_dep': test_dev_dep,
'tox_base_dep': tox_base_dep,
'integration_links': integration_links,
}
config.update(kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ This check monitors [{integration_name}][1] through the Datadog Agent.

## Setup

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.
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][3] for guidance on applying these instructions.

### Installation

{install_info}

### Configuration

1. Edit the `{check_name}.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your {check_name} performance data. See the [sample {check_name}.d/conf.yaml][3] for all available configuration options.
1. Edit the `{check_name}.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your {check_name} performance data. See the [sample {check_name}.d/conf.yaml][4] for all available configuration options.

2. [Restart the Agent][4].
2. [Restart the Agent][5].

### Validation

[Run the Agent's status subcommand][5] and look for `{check_name}` under the Checks section.
[Run the Agent's status subcommand][6] and look for `{check_name}` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][6] for a list of metrics provided by this check.
See [metadata.csv][7] for a list of metrics provided by this check.

### Events

Expand All @@ -36,18 +36,11 @@ The {integration_name} integration does not include any events.

The {integration_name} integration does not include any service checks.

See [service_checks.json][7] for a list of service checks provided by this integration.
See [service_checks.json][8] for a list of service checks provided by this integration.

## Troubleshooting

Need help? Contact [Datadog support][8].
Need help? Contact [Datadog support][9].


[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[3]: https://github.com/DataDog/integrations-{repo_choice}/blob/master/{check_name}/datadog_checks/{check_name}/data/conf.yaml.example
[4]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[5]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[6]: https://github.com/DataDog/integrations-{repo_choice}/blob/master/{check_name}/metadata.csv
[7]: https://github.com/DataDog/integrations-core/blob/master/{check_name}/assets/service_checks.json
[8]: https://docs.datadoghq.com/help/
{integration_links}
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ This check monitors [{integration_name}][1].

1. Edit the `{check_name}.d/conf.yaml` file, in the `conf.d/` folder at the root of your
Agent's configuration directory to start collecting your {check_name} performance data.
See the [sample {check_name}.d/conf.yaml][2] for all available configuration options.
See the [sample {check_name}.d/conf.yaml][3] for all available configuration options.

This check has a limit of 350 metrics per instance. The number of returned metrics is indicated when running the Datadog Agent [status command][3].
You can specify the metrics you are interested in by editing the [configuration][2].
To learn how to customize the metrics to collect visit the [JMX Checks documentation][4] for more detailed instructions.
If you need to monitor more metrics, contact [Datadog support][5].
This check has a limit of 350 metrics per instance. The number of returned metrics is indicated when running the Datadog Agent [status command][4].
You can specify the metrics you are interested in by editing the [configuration][3].
To learn how to customize the metrics to collect visit the [JMX Checks documentation][5] for more detailed instructions.
If you need to monitor more metrics, contact [Datadog support][6].

2. [Restart the Agent][6]
2. [Restart the Agent][7]

### Validation

[Run the Agent's `status` subcommand][3] and look for `{check_name}` under the Checks section.
[Run the Agent's `status` subcommand][4] and look for `{check_name}` under the Checks section.

## Data Collected

Expand All @@ -41,17 +41,11 @@ The {integration_name} integration does not include any events.

The {integration_name} integration does not include any service checks.

See [service_checks.json][7] for a list of service checks provided by this integration.
See [service_checks.json][8] for a list of service checks provided by this integration.

## Troubleshooting

Need help? Contact [Datadog support][5].
Need help? Contact [Datadog support][6].


[1]: **LINK_TO_INTEGERATION_SITE**
[2]: https://github.com/DataDog/integrations-{repo_choice}/blob/master/{check_name}/datadog_checks/{check_name}/data/conf.yaml.example
[3]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[4]: https://docs.datadoghq.com/integrations/java/
[5]: https://docs.datadoghq.com/help/
[6]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[7]: https://github.com/DataDog/integrations-core/blob/master/{check_name}/assets/service_checks.json
{integration_links}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

This integration monitors [{integration_name}][3].
This integration monitors [{integration_name}][4].

## Setup

Expand Down Expand Up @@ -45,7 +45,7 @@ This integration monitors [{integration_name}][3].

Change the `path` and `service` parameter values and configure them for your environment.

3. [Restart the Agent][2].
3. [Restart the Agent][3].

### Events

Expand All @@ -55,13 +55,10 @@ The {integration_name} integration does not include any events.

The {integration_name} integration does not include any service checks.

See [service_checks.json][4] for a list of service checks provided by this integration.
See [service_checks.json][5] for a list of service checks provided by this integration.

## Troubleshooting

Need help? Contact [Datadog support][1].

[1]: https://docs.datadoghq.com/help/
[2]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[3]: **LINK_TO_INTEGRATION_SITE**
[4]: https://github.com/DataDog/integrations-core/blob/master/{check_name}/assets/service_checks.json
{integration_links}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ Additional helpful documentation, links, and articles:
* [Monitor SNMP with Datadog][5]


[1]: https://docs.datadoghq.com/network_performance_monitoring/devices/data
[2]: https://docs.datadoghq.com/network_performance_monitoring/devices/setup
[3]: https://github.com/DataDog/integrations-core/blob/master/{check_name}/assets/service_checks.json
[4]: https://docs.datadoghq.com/help/
[5]: https://www.datadoghq.com/blog/monitor-snmp-with-datadog/
{integration_links}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ This check monitors [{integration_name}][1].

## Troubleshooting

Need help? Contact [Datadog support][2].
Need help? Contact [Datadog support][3].

[1]: **LINK_TO_INTEGRATION_SITE**
[2]: https://docs.datadoghq.com/help/
{integration_links}