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

Add unsuccessful metrics to docs metrics #313

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
restart: unless-stopped
volumes:
- logstash-data:/usr/share/logstash/data
- ./.docker/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro
- ./.docker/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
- ./.docker/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
depends_on:
- elasticsearch
Expand Down
24 changes: 24 additions & 0 deletions scripts/add_metrics_to_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ function getMetrics() {
done
}

function failureConfigChange() {
local logstashCID
logstashCID=$( docker ps -a | grep 'logstash-exporter-logstash-1' | awk '{print $1}' )
local logstashConf
logstashConf='/usr/share/logstash/pipeline/logstash.conf'

docker exec -it "$logstashCID" sh -c "echo 'Wrong Config' >> $logstashConf"

# reload logstash
# "logstash pid should be always 1 AFAIK" ~ Kuskoman, 2024
docker exec -it "$logstashCID" sh -c "kill -1 1"
kuskoman marked this conversation as resolved.
Show resolved Hide resolved

# bring back previous config
# walk around with 'cp' to avoid replacing config inside container
docker exec "$logstashCID" sh -c "sed '\$d' $logstashConf > /tmp/prev_logstash.conf"
docker exec "$logstashCID" sh -c "cp /tmp/prev_logstash.conf $logstashConf"

# reload logstash
docker exec -it "$logstashCID" sh -c "kill -1 1"

}

failureConfigChange

FILE=README.md
while IFS= read -r line; do LINES+=("$line"); done < $FILE

Expand Down
Loading