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

Add Blackbox Exporter support to Mentix #1190

Merged
merged 4 commits into from
Oct 1, 2020
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
5 changes: 5 additions & 0 deletions changelog/unreleased/mentix-bbe-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add Blackbox Exporter support to Mentix

This update extends Mentix to export a Prometheus SD file specific to the Blackbox Exporter which will be used for initial health monitoring. Usually, Prometheus requires its targets to only consist of the target's hostname; the BBE though expects a full URL here. This makes exporting two distinct files necessary.

https://github.com/cs3org/reva/pull/1190
8 changes: 4 additions & 4 deletions docs/content/en/docs/config/http/services/mentix/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ connector = "gocdb"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="exporters" type="[]string" default="[webapi,prom_filesd]" %}}
{{% dir name="exporters" type="[]string" default="[webapi,cs3api,siteloc,promsd]" %}}
Mentix exposes its gathered data by using one or more _exporters_. Such exporters can, for example, write the data to a file in a specific format, or offer the data via an HTTP endpoint.

Supported values are:
Expand All @@ -41,8 +41,8 @@ Supported values are:
Mentix exposes its data via an HTTP endpoint using the `webapi` exporter. Data can be retrieved at the configured relative endpoint (see [here](webapi)). The web API currently doesn't support any parameters but will most likely be extended in the future.
- **cs3api** Similar to the WebAPI exporter, the `cs3api` exporter exposes its data via an HTTP endpoint. Data can be retrieved at the configured relative endpoint (see [here](cs3api)). The data is compliant with the CS3API `ProviderInfo` structure.
- **siteloc** The Site Locations exporter `siteloc` exposes location information of all sites to be consumed by Grafana at the configured relative endpoint (see [here](siteloc)).
- **prom_filesd**
[Prometheus](https://prometheus.io/) supports discovering new services it should monitor via external configuration files (hence, this is called _file-based service discovery_). Mentix can create such files using the `prom_filesd` exporter. To use this exporter, you have to specify the target output file in the configuration (see [here](prom_filesd)). You also have to set up the discovery service in Prometheus by adding a scrape configuration like the following example to the Prometheus configuration (for more information, visit the official [Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config)):
- **promsd**
[Prometheus](https://prometheus.io/) supports discovering new services it should monitor via external configuration files (hence, this is called _file-based service discovery_). Mentix can create such files using the `promsd` exporter. To use this exporter, you have to specify the target output files in the configuration (see [here](promsd)). You also have to set up the discovery service in Prometheus by adding a scrape configuration like the following example to the Prometheus configuration (for more information, visit the official [Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config)):
``` scrape_configs:
- job_name: 'sciencemesh'
file_sd_configs:
Expand All @@ -52,7 +52,7 @@ Mentix exposes its data via an HTTP endpoint using the `webapi` exporter. Data c

{{< highlight toml >}}
[http.services.mentix]
exporters = ["webapi", "prom_filesd"]
exporters = ["webapi", "promsd"]
{{< /highlight >}}
{{% /dir %}}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "promsd"
linkTitle: "promsd"
weight: 10
description: >
Configuration for the Prometheus SD exporter of the Mentix service
---

{{% pageinfo %}}
When using the Prometheus SD exporter, the output filenames have to be configured first.
{{% /pageinfo %}}

{{% dir name="metrics_output_file" type="string" default="" %}}
The target filename of the generated Prometheus File SD scrape config for metrics.
{{< highlight toml >}}
[http.services.mentix.promsd]
metrics_output_file = "/var/shared/prometheus/sciencemesh.json"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="blackbox_output_file" type="string" default="" %}}
The target filename of the generated Prometheus File SD scrape config for the blackbox exporter.
{{< highlight toml >}}
[http.services.mentix.promsd]
blackbox_output_file = "/var/shared/prometheus/blackbox.json"
{{< /highlight >}}
{{% /dir %}}
14 changes: 8 additions & 6 deletions examples/mentix/mentix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ enabled_services = ["mentix"]
[http.services.mentix]
connector = "gocdb"
exporters = ["webapi", "cs3api", "siteloc"]
# Enable the Prometheus File Service Discovery:
# exporters = ["webapi", "cs3api", "siteloc", "prom_filesd"]
# Enable the Prometheus Service Discovery:
# exporters = ["webapi", "cs3api", "siteloc", "promsd"]
update_interval = "15m"

[http.services.mentix.gocdb]
Expand All @@ -24,7 +24,9 @@ endpoint = "/cs3"
[http.services.mentix.siteloc]
endpoint = "/loc"

# Configure the Prometheus File Service Discovery:
# [http.services.mentix.prom_filesd]
# Prometheus must be configured to read the following file:
# output_file = "/usr/share/prom/sciencemesh_services.json"
# Configure the Prometheus Service Discovery:
# [http.services.mentix.promsd]
# The following files must be made available to Prometheus.
# They can then be used as the file_sd source of a job.
# metrics_output_file = "/usr/share/prom/sciencemesh_metrics.json"
# blackbox_output_file = "/usr/share/prom/sciencemesh_blackbox.json"
7 changes: 4 additions & 3 deletions pkg/mentix/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ type Configuration struct {
Endpoint string `mapstructure:"endpoint"`
} `yaml:"siteloc"`

PrometheusFileSD struct {
OutputFile string `mapstructure:"output_file"`
} `mapstructure:"prom_filesd"`
PrometheusSD struct {
MetricsOutputFile string `mapstructure:"metrics_output_file"`
BlackboxOutputFile string `mapstructure:"blackbox_output_file"`
} `mapstructure:"promsd"`
}

// Init sets sane defaults
Expand Down
4 changes: 2 additions & 2 deletions pkg/mentix/config/ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ const (
ExporterIDCS3API = "cs3api"
// ExporterIDSiteLocations is the identifier for the Site Locations exporter.
ExporterIDSiteLocations = "siteloc"
// ExporterIDPrometheusFileSD is the identifier for the Prometheus File SD exporter.
ExporterIDPrometheusFileSD = "prom_filesd"
// ExporterIDPrometheusSD is the identifier for the PrometheusSD SD exporter.
ExporterIDPrometheusSD = "promsd"
)
2 changes: 1 addition & 1 deletion pkg/mentix/exporters/prometheus/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package prometheus

// ScrapeConfig represents a scrape configuration in Prometheus.
// ScrapeConfig represents a scrape configuration in PrometheusSD.
type ScrapeConfig struct {
Targets []string `json:"targets"`
Labels map[string]string `json:"labels"`
Expand Down
155 changes: 0 additions & 155 deletions pkg/mentix/exporters/promfilesd.go

This file was deleted.

Loading