Filippo Giunchedi has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373062 )

Change subject: prometheus: add blackbox configuration for prometheus::ops
......................................................................


prometheus: add blackbox configuration for prometheus::ops

Configure basic jobs for blackbox, one for each generic probe configured
at blackbox.yml.

Also add blackbox_exporter itself (the software) to machines running
prometheus::ops. The Prometheus server will talk to blackbox_exporter on
127.0.0.1:9115. It is possible to run blackbox_exporter elsewhere on the
network too, it will complicate the configuration as the job
configuration will need to talk to the site-specific blackbox(es)
instead of 127.0.0.1:9115.

Finally, as first targets for icmp probing, start pinging all bastions
for and from all sites.

Bug: T169860
Change-Id: I34d07db02d37cf1fd259d2defcb7c056e7cff81b
---
M modules/role/manifests/prometheus/ops.pp
1 file changed, 93 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Ayounsi: Looks good to me, but someone else must approve
  Filippo Giunchedi: Looks good to me, approved



diff --git a/modules/role/manifests/prometheus/ops.pp 
b/modules/role/manifests/prometheus/ops.pp
index 015c8c3..39b17c7 100644
--- a/modules/role/manifests/prometheus/ops.pp
+++ b/modules/role/manifests/prometheus/ops.pp
@@ -19,6 +19,98 @@
         },
     }
 
+    include ::prometheus::blackbox_exporter
+    $blackbox_jobs = [
+      {
+        'job_name'        => 'blackbox_icmp',
+        'metrics_path'    => '/probe',
+        'params'          => {
+          'module' => [ 'icmp' ],
+        },
+        'file_sd_configs' => [
+          { 'files' => [ "${targets_path}/blackbox_icmp_*.yaml" ] }
+        ],
+        'relabel_configs' => [
+          { 'source_labels' => ['__address__'],
+            'target_label'  => '__param_target',
+          },
+          { 'source_labels' => ['__param_target'],
+            'target_label'  => 'instance',
+          },
+          { 'target_label' => '__address__',
+            'replacement'  => '127.0.0.1:9115',
+          },
+        ],
+      },
+      {
+        'job_name'        => 'blackbox_tcp',
+        'metrics_path'    => '/probe',
+        'params'          => {
+          'module' => [ 'tcp_connect' ],
+        },
+        'file_sd_configs' => [
+          { 'files' => [ "${targets_path}/blackbox_tcp_*.yaml" ] }
+        ],
+        'relabel_configs' => [
+          { 'source_labels' => ['__address__'],
+            'target_label'  => '__param_target',
+          },
+          { 'source_labels' => ['__param_target'],
+            'target_label'  => 'instance',
+          },
+          { 'target_label' => '__address__',
+            'replacement'  => '127.0.0.1:9115',
+          },
+        ],
+      },
+      {
+        'job_name'        => 'blackbox_http',
+        'metrics_path'    => '/probe',
+        'params'          => {
+          'module' => [ 'http_connect' ],
+        },
+        'file_sd_configs' => [
+          { 'files' => [ "${targets_path}/blackbox_http_*.yaml" ] }
+        ],
+        'relabel_configs' => [
+          { 'source_labels' => ['__address__'],
+            'target_label'  => '__param_target',
+          },
+          { 'source_labels' => ['__param_target'],
+            'target_label'  => 'instance',
+          },
+          { 'target_label' => '__address__',
+            'replacement'  => '127.0.0.1:9115',
+          },
+        ],
+      },
+      {
+        'job_name'        => 'blackbox_https',
+        'metrics_path'    => '/probe',
+        'params'          => {
+          'module' => [ 'https_connect' ],
+        },
+        'file_sd_configs' => [
+          { 'files' => [ "${targets_path}/blackbox_https_*.yaml" ] }
+        ],
+        'relabel_configs' => [
+          { 'source_labels' => ['__address__'],
+            'target_label'  => '__param_target',
+          },
+          { 'source_labels' => ['__param_target'],
+            'target_label'  => 'instance',
+          },
+          { 'target_label' => '__address__',
+            'replacement'  => '127.0.0.1:9115',
+          },
+        ],
+      },
+    ]
+
+    # Ping all bastions from all machines running prometheus::ops
+    file { "${targets_path}/blackbox_icmp_bastions.yaml":
+      content => ordered_yaml([{'targets' => 
$::network::constants::special_hosts[$::realm]['bastion_hosts']}]),
+    }
 
     # Add one job for each of mysql 'group' (i.e. their broad function)
     # Each job will look for new files matching the glob and load the job
@@ -348,7 +440,7 @@
         scrape_configs_extra  => array_concat(
             $mysql_jobs, $varnish_jobs, $memcached_jobs, $hhvm_jobs,
             $apache_jobs, $etcd_jobs, $etcdmirror_jobs, $pdu_jobs,
-            $nginx_jobs
+            $nginx_jobs, $blackbox_jobs
         ),
         global_config_extra   => $config_extra,
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/373062
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I34d07db02d37cf1fd259d2defcb7c056e7cff81b
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Ayounsi <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to