Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 update deployment scripts #24

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions deploy/Dockerfile-post_start

This file was deleted.

31 changes: 27 additions & 4 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -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/ | |
6 changes: 0 additions & 6 deletions deploy/post_start.sh

This file was deleted.

22 changes: 9 additions & 13 deletions deploy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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