blackbox

package
v0.0.0-...-8beb6bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlackboxCommonPanelQueries = map[string]parser.Expr{
	"BlackboxProbeSucess": promql.MaxBy(
		"probe_success",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
	),
	"BlackboxProbeSucessCount": promqlbuilder.Count(
		vector.New(
			vector.WithMetricName("probe_success"),
			vector.WithLabelMatchers(
				label.New("job").EqualRegexp("$job"),
			),
		),
	),
	"BlackboxProbeSucessPercent": promqlbuilder.Div(
		&parser.ParenExpr{
			Expr: promqlbuilder.Or(
				promqlbuilder.Count(
					promqlbuilder.Eqlc(
						vector.New(
							vector.WithMetricName("probe_success"),
							vector.WithLabelMatchers(
								label.New("job").EqualRegexp("$job"),
							),
						),
						&parser.NumberLiteral{Val: 1},
					),
				),
				promqlbuilder.Vector(0),
			),
		},
		promqlbuilder.Count(
			vector.New(
				vector.WithMetricName("probe_success"),
				vector.WithLabelMatchers(
					label.New("job").EqualRegexp("$job"),
				),
			),
		),
	),
	"BlackboxProbeHTTPSSL": promqlbuilder.Div(
		promqlbuilder.Count(
			promqlbuilder.Eqlc(
				vector.New(
					vector.WithMetricName("probe_http_ssl"),
					vector.WithLabelMatchers(
						label.New("job").EqualRegexp("$job"),
					),
				),
				&parser.NumberLiteral{Val: 1},
			),
		),
		promqlbuilder.Count(
			vector.New(
				vector.WithMetricName("probe_http_version"),
				vector.WithLabelMatchers(
					label.New("job").EqualRegexp("$job"),
				),
			),
		),
	),
	"BlackboxAvgProbeDuration": promqlbuilder.Avg(
		vector.New(
			vector.WithMetricName("probe_duration_seconds"),
			vector.WithLabelMatchers(
				label.New("job").EqualRegexp("$job"),
			),
		),
	),
	"BlackboxProbeUptime": promql.MaxBy(
		"probe_success",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeUptimeMonthly": promqlbuilder.AvgOverTime(
		matrix.New(
			vector.New(
				vector.WithMetricName("probe_success"),
				vector.WithLabelMatchers(
					label.New("job").EqualRegexp("$job"),
					label.New("instance").EqualRegexp("$instance"),
				),
			),
			matrix.WithRangeAsString("30d"),
		),
	),
	"BlackboxProbeHttpDuration": promqlbuilder.Sum(
		promql.AvgBy(
			"probe_http_duration_seconds",
			[]string{"phase", "instance"},
			label.New("job").EqualRegexp("$job"),
			label.New("instance").EqualRegexp("$instance"),
		),
	).By("instance"),
	"BlackboxAvgProbeDurationSeconds": promql.AvgBy(
		"probe_duration_seconds",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeHttpPhases": promql.AvgBy(
		"probe_http_duration_seconds",
		[]string{"phase"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeIcmpPhases": promql.AvgBy(
		"probe_icmp_duration_seconds",
		[]string{"phase"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeStatusCode": promql.MaxBy(
		"probe_http_status_code",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeTLSVersion": promql.MaxBy(
		"probe_tls_version_info",
		[]string{"instance", "version"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeSSLExpiry": promqlbuilder.Sub(
		promql.MinBy(
			"probe_ssl_earliest_cert_expiry",
			[]string{"instance"},
			label.New("job").EqualRegexp("$job"),
			label.New("instance").EqualRegexp("$instance"),
		),
		promqlbuilder.Time(),
	),
	"BlackboxProbeRedirects": promql.MaxBy(
		"probe_http_redirects",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeHTTPVersion": promql.MaxBy(
		"probe_http_version",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeAverageDuration": promql.AvgBy(
		"probe_duration_seconds",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
	"BlackboxProbeAverageDNSLookupPerInstance": promql.AvgBy(
		"probe_dns_lookup_time_seconds",
		[]string{"instance"},
		label.New("job").EqualRegexp("$job"),
		label.New("instance").EqualRegexp("$instance"),
	),
}

Functions

func OverrideBlackboxPanelQueries

func OverrideBlackboxPanelQueries(queries map[string]parser.Expr)

OverrideBlackboxPanelQueries overrides the BlackboxCommonPanelQueries global. Refer to panel queries in the map, that you'd like to override. The convention of naming followed, is to use Panel function name (with _suffix, in case panel has multiple queries)

func ProbeAverageDNSLookupPerInstance

func ProbeAverageDNSLookupPerInstance(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeAverageDNSLookupPerInstance creates a panel that will show the time (in seconds) spent on DNS resolution during a probe.

The panel uses the following Prometheus metrics: - probe_dns_lookup_time_seconds: time (in seconds) spent on DNS resolution during a probe.

The panel shows: - The average time in seconds spent on DNS resolution during a probe.

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeAverageDuration

func ProbeAverageDuration(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeAverageDuration creates a panel option for displaying the Average of probe duration in seconds

The panel uses the following Prometheus metrics: - probe_duration_seconds: measures the total time it takes to execute the probe

The panel shows: - Calculates the Average of time the probe took to execute

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeAverageDurationInstance

func ProbeAverageDurationInstance(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeAverageDurationInstance creates a panel that will show Average Probe Duration in seconds

The panel uses the following Prometheus metrics: - probe_duration_seconds: measures the total time it takes to execute the probe

The panel shows: - The Average Probe Duration in Seconds by Instance

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeDurationSeconds

func ProbeDurationSeconds(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeDurationSeconds creates Probes duration states for http duration and total probes duration

The panel uses the following Prometheus metrics: - probe_duration_seconds: measures the total time it takes to execute the probe - probe_http_duration_seconds: measures the duration of the HTTP request/response phase of a probe.

The panel shows: - The sum of average HTTP durations per phase, grouped by each instance. - The average total probe duration per instance for all matching targets

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeHTTPSSL

func ProbeHTTPSSL(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeHTTPSSL creates a panel option for displaying a Proportion HTTP probes that successfully used SSL

The panel uses the following Prometheus metrics: - probe_http_ssl: whether an SSL/TLS connection was successfully established - probe_http_version: reports the HTTP version returned by the probed endpoint

The panel shows: - Calculates the percentage of count(probe_http_ssl) == 1 / count(probe_http_version)

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeHTTPVersion

func ProbeHTTPVersion(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeHTTPVersion creates a panel that will show the HTTP version returned by the probed endpoint

The panel uses the following Prometheus metrics: - probe_http_version: reports the HTTP version returned by the probed endpoint

The panel shows: - The most recent HTTP version used in probes

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbePhases

func ProbePhases(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbePhases creates Probes duration states for http duration and total probes duration

The panel uses the following Prometheus metrics: - probe_icmp_duration_seconds: measures the duration of the ICMP probe. - probe_http_duration_seconds: measures the duration of the HTTP request/response phase of a probe.

The panel shows: - The average total probe duration per instance for all matching targets

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeRedirects

func ProbeRedirects(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeRedirects creates a panel that will show the number of HTTP redirects followed by the Blackbox Exporter during probes

The panel uses the following Prometheus metrics: - probe_http_redirects: count of HTTP redirect responses

The panel shows: - HTTP redirects followed by the Blackbox Exporter during probes, grouped by instance

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeSSLExpiry

func ProbeSSLExpiry(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeSSLExpiry creates a panel that will show when SSL Cert Will Expire

The panel uses the following Prometheus metrics: - probe_tls_version_info: shows the Unix timestamp (in seconds) of the earliest expiring certificate in the SSL/TLS

The panel shows: - The time until the certificate expirates

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeStatusCode

func ProbeStatusCode(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeStatusCode creates a panel that will show the last status code returned by the probe target

The panel uses the following Prometheus metrics: - probe_http_status_code: HTTP status code returned by the probed target

The panel shows: - The latest value for status code

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeStatusMap

func ProbeStatusMap(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

func ProbeSuccessCount

func ProbeSuccessCount(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeSuccessCount creates a panel option for displaying a counter of all Probe Success

The panel uses the following Prometheus metrics: - probe_success: indicates if the probe succeeded

The panel shows: - Counter of all existing probe_success, so the number of endpoints being probed

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeSuccessPercent

func ProbeSuccessPercent(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeSuccessPercent creates a panel option for displaying a Percentage of success probes from all executed probes

The panel uses the following Prometheus metrics: - probe_success: indicates if the probe succeeded

The panel shows: - Calculates the percentage of count(probe_success == 1) / count(probe_success)

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeTLSVersion

func ProbeTLSVersion(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeTLSVersion creates a panel that will show the TLS version

The panel uses the following Prometheus metrics: - probe_tls_version_info: indicates which TLS version was negotiated with the target

The panel shows: - For each instance and TLS version, it returns the most recent value.

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeUptimeMonthly

func ProbeUptimeMonthly(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeUptimeMonthly creates The Probe Uptime for 30 days

The panel uses the following Prometheus metrics: - probe_success: indicates if the probe succeeded

The panel shows: - Calculates the Max value for the probe_success by instance for 30 days

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

func ProbeUptimeSuccess

func ProbeUptimeSuccess(datasourceName string, labelMatchers ...*labels.Matcher) panelgroup.Option

ProbeUptimeSuccess creates The Probe Uptime

The panel uses the following Prometheus metrics: - probe_success: indicates if the probe succeeded

The panel shows: - Calculates the Max value for the probe_success by instance

Parameters:

  • datasourceName: The name of the Prometheus data source.
  • labelMatchers: A variadic parameter for Prometheus label matchers to filter the query.

Returns:

  • panelgroup.Option: A panel option that can be added to a panel group.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL