Skip to content

Commit 84743f7

Browse files
authored
Merge pull request #24 from K-Yo/run
🔨 update deployment scripts
2 parents 1e7fef8 + d4d75a4 commit 84743f7

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

deploy/Dockerfile-post_start

Lines changed: 0 additions & 3 deletions
This file was deleted.

deploy/README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1+
# Test bench
2+
3+
This repository holds the files necessary to test splunk_exporter.
4+
5+
Through docker-compose, it starts the exporter, a prometheus instance, a grafana instance and a splunk instance.
6+
7+
## prerequisites
8+
9+
- bash
10+
- docker-compose
11+
- envsubst (part of `gettext` package)
12+
- jq
13+
- curl
14+
- grep
15+
16+
## run
17+
18+
```shell
19+
bash run.sh
20+
```
21+
122
## Access
223

324
All instances are exposed on your host.
425

526
This is not a production environment.
627

7-
Splunk: http://localhost:8000/ user: admin pass: splunkadmin
8-
Grafana: http://localhost:3000/ user: admin pass: admin
9-
Prometheus: http://localhost:9090/
10-
Splunk Exporter: http://localhost:9115/
28+
| Service | URL | Credentials |
29+
| --------------- | ---------------------- | --------------------------------- |
30+
| Splunk | http://localhost:8000/ | user: `admin` pass: `splunkadmin` |
31+
| Grafana | http://localhost:3000/ | user: `admin` pass: `admin` |
32+
| Prometheus | http://localhost:9090/ | |
33+
| Splunk Exporter | http://localhost:9115/ | |

deploy/post_start.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

deploy/run.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@ set -e
55
# print commands
66
set -v
77

8+
# initiate conf file
9+
touch ./splunk_exporter.yml
810

911
# Start the stack
10-
docker compose up -d
12+
docker compose up -d prometheus grafana splunk
1113

1214
# Wait for splunk to be initialized
1315
until docker logs -n1 splunk 2>/dev/null | grep -q -m 1 '^Ansible playbook complete'; do sleep 0.2; done
1416

1517
# Generate api key
16-
post_start_image=$(docker build -q - < Dockerfile-post_start)
17-
touch ./splunk_exporter.yml
18-
docker run \
19-
--rm \
20-
--volume ./post_start.sh:/post_start.sh:ro \
21-
--volume ./splunk_exporter.yml:/splunk_exporter.yml:rw \
22-
--volume ./splunk_exporter.yml.src:/splunk_exporter.yml.src:ro \
23-
--entrypoint bash \
24-
--entrypoint /post_start.sh \
25-
--network deploy_monitoring \
26-
$post_start_image
27-
18+
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')
19+
cat splunk_exporter.yml.src | envsubst > splunk_exporter.yml
20+
21+
# start splunk_exporter
22+
docker compose up -d
23+
# curl -X POST http://splunk_exporter:9115/-/reload

0 commit comments

Comments
 (0)