This commit is contained in:
Kameron Kenny 2024-06-23 15:07:34 -04:00
commit f842310528
No known key found for this signature in database
GPG Key ID: E5006629839D2276
4 changed files with 107 additions and 0 deletions

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM prom/blackbox-exporter
LABEL version="20240623.1.1"
LABEL description="blackbox exporter for prometheus"
COPY config/blackbox.yml /blackbox.yml

48
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,48 @@
pipeline {
agent {
label 'pi501.in.thelinuxpro.net'
}
stages {
stage("verify tooling") {
steps {
sh '''
docker version
docker info
docker compose version
'''
}
}
stage("Build Containers and push to registry") {
steps {
script {
sh 'docker compose build --push'
}
}
}
stage('Create contexts') {
steps {
sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"'
}
}
stage('Start container') {
steps {
script {
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
if (status_s != 0) {
sh 'docker --context pi502 compose up -d'
sh 'docker --context pi502 compose ps'
} else {
echo 'skip'
}
}
}
}
}
}

38
config/blackbox.yml Normal file
View File

@ -0,0 +1,38 @@
modules:
http_2xx:
prober: http
http:
preferred_ip_protocol: "ip4"
https_2xx:
prober: http
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: [] # defaults to 200
method: GET
follow_redirects: true
fail_if_ssl: false
fail_if_not_ssl: true
tls_config:
insecure_skip_verify: false
preferred_ip_protocol: "ip4" # defaults to "ip6"
http_301:
prober: http
http:
preferred_ip_protocol: "ip4"
valid_status_codes: [ 301 ]
dns_thelinux_pro__A:
prober: dns
timeout: 5s
preferred_ip_protocol: "ip4"
dns:
query_name: "thelinux.pro"
query_type: "A"
valid_rcodes:
- NOERROR
dns_thelinux_pro__SOA:
prober: dns
timeout: 5s
preferred_ip_protocol: "ip4"
dns:
query_name: "thelinux.pro"
query_type: "SOA"

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
networks:
infra_dev_net:
external: true
services:
blackbox-exporter:
build:
dockerfile: Dockerfile
image: docker-registry1.in.thelinuxpro.net:5000/tlp/blackbox-exporter:20240623.1.1
container_name: blackbox-exporter
command: '--config.file=/blackbox.yml'
restart: unless-stopped
networks:
infra_dev_net:
ipv4_address: 10.99.23.35