Created
July 16, 2018 06:22
-
-
Save naa0yama/a373183b5933b03e95f7979cd38b735c to your computer and use it in GitHub Desktop.
Docker で blackbox_exporter の icmp をするメモ ref: https://qiita.com/FoxBoxsnet/items/b4f5dd9b1d9469570b4b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Permissions | |
The ICMP probe requires elevated privileges to function: | |
Windows: Administrator privileges are required. | |
Linux: root user or CAP_NET_RAW capability is required. | |
Can be set by executing setcap cap_net_raw+ep blackbox_exporter | |
BSD / OS X: root user is required. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest | |
LABEL maintainer "Naoki Aoyama<n.aoyama@homesoc.io>" | |
LABEL Description="blackbox_exporter docker image" Vendor="HomeSOC Organization" Version="1.1" | |
ARG BLACKBOX_EXPORTER_VERSION="0.12.0" | |
RUN \ | |
apk add --no-cache \ | |
ca-certificates \ | |
&& apk add --no-cache --virtual build-install \ | |
libcap \ | |
curl \ | |
bash \ | |
wget \ | |
\ | |
&& mkdir -p /etc/blackbox_exporter \ | |
&& curl -sfSL "https://github.com/prometheus/blackbox_exporter/releases/download/v${BLACKBOX_EXPORTER_VERSION}/blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz" \ | |
-o "blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz" \ | |
&& tar -zxvf "blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz" \ | |
&& cp "blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64/blackbox_exporter" /bin \ | |
&& rm -rf "blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64" \ | |
&& rm -f "blackbox_exporter-${BLACKBOX_EXPORTER_VERSION}.linux-amd64.tar.gz" \ | |
\ | |
&& setcap cap_net_raw+ep /bin/blackbox_exporter | |
COPY blackbox.yml /etc/blackbox_exporter/config.yml | |
EXPOSE 9115/tcp | |
ENTRYPOINT [ "/bin/blackbox_exporter" ] | |
CMD [ "--config.file=/etc/blackbox_exporter/config.yml" ] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modules: | |
# ----------------------------------------------- | |
# ICMP | |
# ----------------------------------------------- | |
# ----------------------------------------------- | |
# ICMP v4 | |
# ----------------------------------------------- | |
icmp_v4: | |
prober: icmp | |
icmp: | |
preferred_ip_protocol: 'ip4' | |
#source_ip_address: "127.0.0.1" | |
# ----------------------------------------------- | |
# ICMP v6 | |
# ----------------------------------------------- | |
icmp_v6: | |
prober: icmp | |
icmp: | |
preferred_ip_protocol: 'ip6' | |
#source_ip_address: "127.0.0.1" | |
# ----------------------------------------------- | |
# HTTP | |
# ----------------------------------------------- | |
# ----------------------------------------------- | |
# HTTP IPv4 | |
# ----------------------------------------------- | |
http_2xx_v4: | |
prober: http | |
timeout: 5s | |
http: | |
# Accepted status codes for this probe. Defaults to 2xx. | |
valid_status_codes: | |
- 200 | |
# Accepted HTTP versions for this probe. | |
valid_http_versions: | |
- "HTTP/1.1" | |
- "HTTP/2" | |
# The HTTP method the probe will use. | |
method: "GET" | |
# The HTTP headers set for the probe. | |
headers: | |
Accept-Language: en-US | |
# Whether or not the probe will follow any redirects. | |
no_follow_redirects: false | |
# Probe fails if SSL is present. | |
fail_if_ssl: false | |
# Probe fails if SSL is not present. | |
fail_if_not_ssl: false | |
# Probe fails if response matches regex. | |
#fail_if_matches_regexp: | |
# [ - <regex>, ... ] | |
# Probe fails if response does not match regex. | |
#fail_if_not_matches_regexp: | |
# [ - <regex>, ... ] | |
# Configuration for TLS protocol of HTTP probe. | |
tls_config: | |
# Disable target certificate validation. | |
insecure_skip_verify: false | |
# The HTTP basic authentication credentials for the targets. | |
#basic_auth: | |
# [ username: <string> ] | |
# [ password: <secret> ] | |
# The bearer token for the targets. | |
#[ bearer_token: <secret> ] | |
# The bearer token file for the targets. | |
#[ bearer_token_file: <filename> ] | |
# HTTP proxy server to use to connect to the targets. | |
#[ proxy_url: <string> ] | |
# The preferred IP protocol of the HTTP probe (ip4, ip6). | |
preferred_ip_protocol: "ip4" | |
# The body of the HTTP request used in probe. | |
#body: [ <string> ] | |
# ----------------------------------------------- | |
# HTTP IPv6 | |
# ----------------------------------------------- | |
http_2xx_v6: | |
prober: http | |
timeout: 5s | |
http: | |
# Accepted status codes for this probe. Defaults to 2xx. | |
valid_status_codes: | |
- 200 | |
# Accepted HTTP versions for this probe. | |
valid_http_versions: | |
- "HTTP/1.1" | |
- "HTTP/2" | |
# The HTTP method the probe will use. | |
method: "GET" | |
# The HTTP headers set for the probe. | |
headers: | |
Accept-Language: en-US | |
# Whether or not the probe will follow any redirects. | |
no_follow_redirects: false | |
# Probe fails if SSL is present. | |
fail_if_ssl: false | |
# Probe fails if SSL is not present. | |
fail_if_not_ssl: false | |
# Probe fails if response matches regex. | |
#fail_if_matches_regexp: | |
# [ - <regex>, ... ] | |
# Probe fails if response does not match regex. | |
#fail_if_not_matches_regexp: | |
# [ - <regex>, ... ] | |
# Configuration for TLS protocol of HTTP probe. | |
tls_config: | |
# Disable target certificate validation. | |
insecure_skip_verify: false | |
# The HTTP basic authentication credentials for the targets. | |
#basic_auth: | |
# [ username: <string> ] | |
# [ password: <secret> ] | |
# The bearer token for the targets. | |
#[ bearer_token: <secret> ] | |
# The bearer token file for the targets. | |
#[ bearer_token_file: <filename> ] | |
# HTTP proxy server to use to connect to the targets. | |
#[ proxy_url: <string> ] | |
# The preferred IP protocol of the HTTP probe (ip4, ip6). | |
preferred_ip_protocol: "ip6" | |
# The body of the HTTP request used in probe. | |
#body: [ <string> ] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment