Skip to content

Commit

Permalink
Add unsuccessful metrics to docs metrics (kuskoman#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
satk0 authored Mar 13, 2024
1 parent accfc10 commit d3c67fe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
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
26 changes: 26 additions & 0 deletions scripts/add_metrics_to_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,32 @@ 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'
# "logstash pid should be always 1 AFAIK" ~ Kuskoman, 2024
local logstashPID
logstashPID=1

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

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

# 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 $logstashPID"

}

failureConfigChange

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

Expand Down

0 comments on commit d3c67fe

Please sign in to comment.