1
This commit is contained in:
commit
7eb26fd5fa
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build-dir/
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN apk update && apk add --no-cache supervisor && mkdir -p /opt/blackbox_exporter/etc
|
||||
|
||||
ADD build-dir/${TARGETOS}/${TARGETARCH}/blackbox_exporter /opt/blackbox_exporter/
|
||||
|
||||
ADD supervisord.conf /etc/supervisord.conf
|
||||
|
||||
ADD start-blackbox.sh /start-blackbox.sh
|
||||
|
||||
ADD start.sh /start.sh
|
||||
|
||||
RUN chmod +x /opt/blackbox_exporter/blackbox_exporter
|
||||
|
||||
EXPOSE 9115
|
||||
|
||||
WORKDIR /
|
||||
|
||||
CMD ["/bin/sh", "/start.sh"]
|
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
all: init-buildx build publish
|
||||
|
||||
build:
|
||||
bash build.sh
|
||||
publish:
|
||||
bash publish.sh
|
||||
|
||||
init-buildx: clean-buildx
|
||||
docker buildx create --name mybuilder
|
||||
docker buildx use mybuilder
|
||||
docker buildx inspect --bootstrap
|
||||
docker buildx ls
|
||||
clean-buildx:
|
||||
docker buildx rm mybuilder;true
|
||||
|
65
blackbox.yml
Normal file
65
blackbox.yml
Normal file
@ -0,0 +1,65 @@
|
||||
modules:
|
||||
http_2xx:
|
||||
prober: http
|
||||
|
||||
http_2xx_3xx_403:
|
||||
prober: http
|
||||
http:
|
||||
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
|
||||
valid_status_codes: [ 200, 204, 301,302,307,308,403]
|
||||
no_follow_redirects: false
|
||||
|
||||
http_post_2xx:
|
||||
prober: http
|
||||
http:
|
||||
method: POST
|
||||
tcp_connect:
|
||||
prober: tcp
|
||||
tcp:
|
||||
preferred_ip_protocol: "ip4"
|
||||
pop3s_banner:
|
||||
prober: tcp
|
||||
tcp:
|
||||
query_response:
|
||||
- expect: "^+OK"
|
||||
tls: true
|
||||
tls_config:
|
||||
insecure_skip_verify: false
|
||||
grpc:
|
||||
prober: grpc
|
||||
grpc:
|
||||
tls: true
|
||||
preferred_ip_protocol: "ip4"
|
||||
grpc_plain:
|
||||
prober: grpc
|
||||
grpc:
|
||||
tls: false
|
||||
service: "service1"
|
||||
ssh_banner:
|
||||
prober: tcp
|
||||
tcp:
|
||||
query_response:
|
||||
- expect: "^SSH-2.0-"
|
||||
- send: "SSH-2.0-blackbox-ssh-check"
|
||||
irc_banner:
|
||||
prober: tcp
|
||||
tcp:
|
||||
query_response:
|
||||
- send: "NICK prober"
|
||||
- send: "USER prober prober prober :prober"
|
||||
- expect: "PING :([^ ]+)"
|
||||
send: "PONG ${1}"
|
||||
- expect: "^:[^ ]+ 001"
|
||||
icmp:
|
||||
prober: icmp
|
||||
icmp_ttl5:
|
||||
prober: icmp
|
||||
timeout: 5s
|
||||
icmp:
|
||||
ttl: 5
|
||||
tcp_connect_tls:
|
||||
prober: tcp
|
||||
tcp:
|
||||
tls: true
|
||||
preferred_ip_protocol: "ip4"
|
||||
|
34
build.sh
Normal file
34
build.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "cleaning up"
|
||||
|
||||
rm -vrf build-dir/linux/{amd64,arm64,arm,armv6}
|
||||
|
||||
mkdir -p build-dir/linux/{amd64,arm64,arm,armv6}
|
||||
|
||||
#Download latest version of Rustdesk-server
|
||||
LATEST=$(curl https://api.github.com/repos/prometheus/blackbox_exporter/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
|
||||
|
||||
wget "https://github.com/prometheus/blackbox_exporter/releases/download/${LATEST}/blackbox_exporter-$( echo -n ${LATEST}|sed -e"s@^v@@g").linux-amd64.tar.gz" -O "build-dir/linux/amd64/blackbox_exporter-linux-amd64.tar.gz"
|
||||
cd build-dir/linux/amd64/ && tar xvf "blackbox_exporter-linux-amd64.tar.gz" && cd -
|
||||
chmod +x build-dir/linux/amd64/blackbox_exporter-*.linux-amd64/blackbox_exporter
|
||||
mv -v build-dir/linux/amd64/blackbox_exporter-*.linux-amd64/blackbox_exporter build-dir/linux/amd64/
|
||||
|
||||
wget "https://github.com/prometheus/blackbox_exporter/releases/download/${LATEST}/blackbox_exporter-$( echo -n ${LATEST}|sed -e"s@^v@@g").linux-arm64.tar.gz" -O "build-dir/linux/arm64/blackbox_exporter-linux-arm64.tar.gz"
|
||||
cd build-dir/linux/arm64/ && tar xvf "blackbox_exporter-linux-arm64.tar.gz" && cd -
|
||||
chmod +x build-dir/linux/arm64/blackbox_exporter-*.linux-arm64/blackbox_exporter
|
||||
mv -v build-dir/linux/arm64/blackbox_exporter-*.linux-arm64/blackbox_exporter build-dir/linux/arm64/
|
||||
|
||||
wget "https://github.com/prometheus/blackbox_exporter/releases/download/${LATEST}/blackbox_exporter-$( echo -n ${LATEST}|sed -e"s@^v@@g").linux-armv7.tar.gz" -O "build-dir/linux/arm/blackbox_exporter-linux-armv7.tar.gz"
|
||||
cd build-dir/linux/arm/ && tar xvf "blackbox_exporter-linux-armv7.tar.gz" && cd -
|
||||
chmod +x build-dir/linux/arm/blackbox_exporter-*.linux-armv7/blackbox_exporter
|
||||
mv -v build-dir/linux/arm/blackbox_exporter-*.linux-armv7/blackbox_exporter build-dir/linux/arm/
|
||||
|
||||
wget "https://github.com/prometheus/blackbox_exporter/releases/download/${LATEST}/blackbox_exporter-$( echo -n ${LATEST}|sed -e"s@^v@@g").linux-armv6.tar.gz" -O "build-dir/linux/armv6/blackbox_exporter-linux-armv6.tar.gz"
|
||||
cd build-dir/linux/armv6/ && tar xvf "blackbox_exporter-linux-armv6.tar.gz" && cd -
|
||||
chmod +x build-dir/linux/armv6/blackbox_exporter-*.linux-armv6/blackbox_exporter
|
||||
mv -v build-dir/linux/armv6/blackbox_exporter-*.linux-armv6/blackbox_exporter build-dir/linux/armv6/
|
||||
|
||||
|
||||
|
||||
echo "Downloaded blackbox-exporter files"
|
1
container-name
Normal file
1
container-name
Normal file
@ -0,0 +1 @@
|
||||
blackbox_exporter
|
11
publish.sh
Normal file
11
publish.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
name="$(head -1 container-name)"
|
||||
docker_username="$(head -1 username)"
|
||||
|
||||
docker login
|
||||
docker buildx build -t "${docker_username}/${name}:latest" --platform linux/amd64,linux/arm64,linux/arm/v7 --push .
|
||||
|
||||
set +x
|
3
start-blackbox.sh
Normal file
3
start-blackbox.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
/opt/blackbox_exporter/blackbox_exporter --config.file=/opt/blackbox_exporter/etc/blackbox.yml
|
3
start.sh
Normal file
3
start.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/sh
|
||||
|
||||
/usr/bin/supervisord -c /etc/supervisord.conf
|
21
supervisord.conf
Normal file
21
supervisord.conf
Normal file
@ -0,0 +1,21 @@
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisor.sock
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisor.sock
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
minfds=1024
|
||||
minprocs=200
|
||||
|
||||
[program:blackbox]
|
||||
command=/bin/sh /start-blackbox.sh
|
||||
directory=/data
|
||||
user=root
|
||||
autostart=true
|
||||
autorestart=true
|
Loading…
Reference in New Issue
Block a user