diff --git a/deploy/Dockerfile-post_start b/deploy/Dockerfile-post_start deleted file mode 100644 index 7f45bd8..0000000 --- a/deploy/Dockerfile-post_start +++ /dev/null @@ -1,3 +0,0 @@ -FROM alpine - -RUN apk add curl bash jq gettext \ No newline at end of file diff --git a/deploy/README.md b/deploy/README.md index b40b8a0..24b476e 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,10 +1,33 @@ +# Test bench + +This repository holds the files necessary to test splunk_exporter. + +Through docker-compose, it starts the exporter, a prometheus instance, a grafana instance and a splunk instance. + +## prerequisites + +- bash +- docker-compose +- envsubst (part of `gettext` package) +- jq +- curl +- grep + +## run + +```shell +bash run.sh +``` + ## Access All instances are exposed on your host. This is not a production environment. -Splunk: http://localhost:8000/ user: admin pass: splunkadmin -Grafana: http://localhost:3000/ user: admin pass: admin -Prometheus: http://localhost:9090/ -Splunk Exporter: http://localhost:9115/ +| Service | URL | Credentials | +| --------------- | ---------------------- | --------------------------------- | +| Splunk | http://localhost:8000/ | user: `admin` pass: `splunkadmin` | +| Grafana | http://localhost:3000/ | user: `admin` pass: `admin` | +| Prometheus | http://localhost:9090/ | | +| Splunk Exporter | http://localhost:9115/ | | diff --git a/deploy/post_start.sh b/deploy/post_start.sh deleted file mode 100755 index 888c35a..0000000 --- a/deploy/post_start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# waiting for splunk to finish starting -# sleep 120 -export SPLUNK_TOKEN=$(curl -k -u admin:splunkadmin -X POST https://splunk:8089/services/authorization/tokens?output_mode=json --data name=admin --data audience=splunk_exporter | jq -r '.entry[0].content.token') -cat splunk_exporter.yml.src | envsubst > splunk_exporter.yml -curl -X POST http://splunk_exporter:9115/-/reload \ No newline at end of file diff --git a/deploy/run.sh b/deploy/run.sh index da4a2c2..c8b17e2 100755 --- a/deploy/run.sh +++ b/deploy/run.sh @@ -5,23 +5,19 @@ set -e # print commands set -v +# initiate conf file +touch ./splunk_exporter.yml # Start the stack -docker compose up -d +docker compose up -d prometheus grafana splunk # Wait for splunk to be initialized until docker logs -n1 splunk 2>/dev/null | grep -q -m 1 '^Ansible playbook complete'; do sleep 0.2; done # Generate api key -post_start_image=$(docker build -q - < Dockerfile-post_start) -touch ./splunk_exporter.yml -docker run \ - --rm \ - --volume ./post_start.sh:/post_start.sh:ro \ - --volume ./splunk_exporter.yml:/splunk_exporter.yml:rw \ - --volume ./splunk_exporter.yml.src:/splunk_exporter.yml.src:ro \ - --entrypoint bash \ - --entrypoint /post_start.sh \ - --network deploy_monitoring \ - $post_start_image - +export SPLUNK_TOKEN=$(curl -k -u admin:splunkadmin -X POST https://splunk:8089/services/authorization/tokens?output_mode=json --data name=admin --data audience=splunk_exporter | jq -r '.entry[0].content.token') +cat splunk_exporter.yml.src | envsubst > splunk_exporter.yml + +# start splunk_exporter +docker compose up -d +# curl -X POST http://splunk_exporter:9115/-/reload