<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Blackbox_exporter_icmp</id>
	<title>Blackbox exporter icmp - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Blackbox_exporter_icmp"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Blackbox_exporter_icmp&amp;action=history"/>
	<updated>2026-04-08T02:19:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Blackbox_exporter_icmp&amp;diff=5292&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;Dockerfile ``` # Use a lightweight base image FROM alpine:latest  # Install necessary packages RUN apk add --no-cache \     libcap \     curl  # Download and install Blackbox...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Blackbox_exporter_icmp&amp;diff=5292&amp;oldid=prev"/>
		<updated>2024-06-13T18:31:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Dockerfile ``` # Use a lightweight base image FROM alpine:latest  # Install necessary packages RUN apk add --no-cache \     libcap \     curl  # Download and install Blackbox...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Dockerfile&lt;br /&gt;
```&lt;br /&gt;
# Use a lightweight base image&lt;br /&gt;
FROM alpine:latest&lt;br /&gt;
&lt;br /&gt;
# Install necessary packages&lt;br /&gt;
RUN apk add --no-cache \&lt;br /&gt;
    libcap \&lt;br /&gt;
    curl&lt;br /&gt;
&lt;br /&gt;
# Download and install Blackbox Exporter&lt;br /&gt;
ENV BLACKBOX_EXPORTER_VERSION 0.23.0&lt;br /&gt;
RUN wget https://github.com/prometheus/blackbox_exporter/releases/download/v${BLACKBOX_EXPORTER_VERSION}/blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz &amp;amp;&amp;amp; \&lt;br /&gt;
    tar -xzf blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz &amp;amp;&amp;amp; \&lt;br /&gt;
    mv blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64/blackbox_exporter /usr/local/bin/blackbox_exporter &amp;amp;&amp;amp; \&lt;br /&gt;
    rm -rf blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64*&lt;br /&gt;
&lt;br /&gt;
# Set the capability to allow ICMP&lt;br /&gt;
RUN setcap cap_net_raw+ep /usr/local/bin/blackbox_exporter&lt;br /&gt;
&lt;br /&gt;
# Create a user with UID 1000&lt;br /&gt;
RUN adduser -D -u 1000 nonrootuser&lt;br /&gt;
&lt;br /&gt;
# Create a configuration file for Blackbox Exporter&lt;br /&gt;
COPY blackbox.yml /etc/blackbox_exporter/config.yml&lt;br /&gt;
&lt;br /&gt;
# Set the permissions&lt;br /&gt;
RUN chown nonrootuser:nonrootuser /etc/blackbox_exporter/config.yml&lt;br /&gt;
&lt;br /&gt;
# Expose the port&lt;br /&gt;
EXPOSE 9115&lt;br /&gt;
&lt;br /&gt;
# Run the exporter as the non-root user&lt;br /&gt;
USER nonrootuser&lt;br /&gt;
&lt;br /&gt;
# Command to run the Blackbox Exporter&lt;br /&gt;
CMD [&amp;quot;blackbox_exporter&amp;quot;, &amp;quot;--config.file=/etc/blackbox_exporter/config.yml&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# More steps&lt;br /&gt;
```&lt;br /&gt;
Step 2: Create a Configuration File&lt;br /&gt;
Create a blackbox.yml configuration file in the same directory as your Dockerfile.&lt;br /&gt;
&lt;br /&gt;
yaml&lt;br /&gt;
Copy code&lt;br /&gt;
modules:&lt;br /&gt;
  icmp:&lt;br /&gt;
    prober: icmp&lt;br /&gt;
    timeout: 5s&lt;br /&gt;
Step 3: Build the Docker Image&lt;br /&gt;
Build the Docker image using the Dockerfile.&lt;br /&gt;
&lt;br /&gt;
sh&lt;br /&gt;
Copy code&lt;br /&gt;
docker build -t blackbox-exporter-icmp .&lt;br /&gt;
Step 4: Run the Docker Container&lt;br /&gt;
Run the container with the appropriate user and expose the port.&lt;br /&gt;
&lt;br /&gt;
sh&lt;br /&gt;
Copy code&lt;br /&gt;
docker run -d -p 9115:9115 --name blackbox-exporter-icmp blackbox-exporter-icmp&lt;br /&gt;
Step 5: Verify the Setup&lt;br /&gt;
Check the Blackbox Exporter:&lt;br /&gt;
&lt;br /&gt;
Verify that the Blackbox Exporter is running and capable of performing ICMP probes by visiting the probe endpoint in your browser or using curl.&lt;br /&gt;
&lt;br /&gt;
sh&lt;br /&gt;
Copy code&lt;br /&gt;
curl &amp;quot;http://localhost:9115/probe?target=example.com&amp;amp;module=icmp&amp;quot;&lt;br /&gt;
Configure Prometheus:&lt;br /&gt;
&lt;br /&gt;
Add a scrape configuration in your prometheus.yml to scrape the Blackbox Exporter.&lt;br /&gt;
&lt;br /&gt;
yaml&lt;br /&gt;
Copy code&lt;br /&gt;
scrape_configs:&lt;br /&gt;
  - job_name: 'blackbox'&lt;br /&gt;
    metrics_path: /probe&lt;br /&gt;
    params:&lt;br /&gt;
      module: [icmp]&lt;br /&gt;
    static_configs:&lt;br /&gt;
      - targets:&lt;br /&gt;
        - example.com&lt;br /&gt;
    relabel_configs:&lt;br /&gt;
      - source_labels: [__address__]&lt;br /&gt;
        target_label: __param_target&lt;br /&gt;
      - source_labels: [__param_target]&lt;br /&gt;
        target_label: instance&lt;br /&gt;
      - target_label: __address__&lt;br /&gt;
        replacement: blackbox-exporter-icmp:9115&lt;br /&gt;
Reload Prometheus:&lt;br /&gt;
```&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>