diff --git a/app/Http/Controllers/Widgets/ServiceTemplateController.php b/app/Http/Controllers/Widgets/ServiceTemplateController.php index f11c557531..3e807093c5 100644 --- a/app/Http/Controllers/Widgets/ServiceTemplateController.php +++ b/app/Http/Controllers/Widgets/ServiceTemplateController.php @@ -113,8 +113,8 @@ class ServiceTemplateController extends Controller $query->where('service_template_id', '!=', $serviceTemplate->service_template_id); }), ], - 'service_template_type' => 'required|in:dynamic,static', 'device_group_id' => 'integer', + 'service_template_type' => 'string', 'service_template_param' => 'string', 'service_template_ip' => 'string', 'service_template_desc' => 'string', diff --git a/doc/Extensions/Services.md b/doc/Extensions/Services.md index 78a15d7cef..e79b31f86c 100644 --- a/doc/Extensions/Services.md +++ b/doc/Extensions/Services.md @@ -36,8 +36,7 @@ discover intervals. ## Service Auto Discovery -To automatically apply service checks that are discovered to devices -and to automatically apply Service Templates. +To automatically create services for devices with available checks. You need to enable the discover services within config.php with the following: @@ -45,6 +44,17 @@ You need to enable the discover services within config.php with the following: $config['discover_services'] = true; ``` +## Service Templates Auto Discovery + +To automatically create services for devices with configured +Service Templates. + +You need to enable the discover services within config.php with the following: + +```php +$config['discover_services_templates'] = true; +``` + ## Setup Service checks is now distributed aware. If you run a distributed diff --git a/includes/discovery/services.inc.php b/includes/discovery/services.inc.php index 2b54c14781..91f783b175 100644 --- a/includes/discovery/services.inc.php +++ b/includes/discovery/services.inc.php @@ -1,13 +1,13 @@ pluck('service_template_id') as $service_template) { + discover_service_template($service_template['service_template_id']); } +} +if (Config::get('discover_services')) { // FIXME: use /etc/services? $known_services = [ 22 => 'ssh', diff --git a/misc/config_definitions.json b/misc/config_definitions.json index 7261b5c3c0..59cc95d430 100644 --- a/misc/config_definitions.json +++ b/misc/config_definitions.json @@ -932,6 +932,10 @@ "default": false, "type": "boolean" }, + "discover_services_templates": { + "default": false, + "type": "boolean" + }, "discovery_by_ip": { "default": false, "type": "boolean"