diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py b/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py index 6920d6b244ca2..ef027a037c2ae 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py @@ -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] diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/constants.py b/datadog_checks_dev/datadog_checks/dev/tooling/constants.py index ff8ca5fe7499d..6903a749871ce 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/constants.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/constants.py @@ -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/*') diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/create.py b/datadog_checks_dev/datadog_checks/dev/tooling/create.py index 14de99f7a3ca1..d93c8741bacb9 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/create.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/create.py @@ -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') @@ -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) @@ -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]. 4. Upload the build artifact to any host with an Agent and run `datadog-agent integration install -w @@ -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 @@ -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 = '' else: check_name = normalized_integration_name author = 'U.N. Owen' @@ -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", @@ -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) diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/check/{check_name}/README.md b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/check/{check_name}/README.md index fbdb3eb03e86f..9655b8c858f58 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/check/{check_name}/README.md +++ b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/check/{check_name}/README.md @@ -6,7 +6,7 @@ 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 @@ -14,19 +14,19 @@ Follow the instructions below to install and configure this check for an Agent r ### 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 @@ -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} \ No newline at end of file diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/jmx/{check_name}/README.md b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/jmx/{check_name}/README.md index 312a37b5d7bf6..cbb397f88ec99 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/jmx/{check_name}/README.md +++ b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/jmx/{check_name}/README.md @@ -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 @@ -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} \ No newline at end of file diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/logs/{check_name}/README.md b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/logs/{check_name}/README.md index 600d18a61185e..7c896a2891f53 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/logs/{check_name}/README.md +++ b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/logs/{check_name}/README.md @@ -2,7 +2,7 @@ ## Overview -This integration monitors [{integration_name}][3]. +This integration monitors [{integration_name}][4]. ## Setup @@ -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 @@ -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} \ No newline at end of file diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/snmp_tile/snmp_{check_name}/README.md b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/snmp_tile/snmp_{check_name}/README.md index c56c58c76398c..855d26b4bc841 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/snmp_tile/snmp_{check_name}/README.md +++ b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/snmp_tile/snmp_{check_name}/README.md @@ -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} diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/tile/{check_name}/README.md b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/tile/{check_name}/README.md index 6b02b514a570a..69535448c2b29 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/tile/{check_name}/README.md +++ b/datadog_checks_dev/datadog_checks/dev/tooling/templates/integration/tile/{check_name}/README.md @@ -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}