Add Wazuh indexer check with Attempts

This commit is contained in:
Victor Carlos Erenu
2025-12-23 23:50:24 +07:00
parent 1aa5a2acc4
commit b120c4c8c8
+24 -14
View File
@@ -147,14 +147,19 @@ jobs:
- name: Check Wazuh indexer start - name: Check Wazuh indexer start
run: | run: |
sleep 240 for i in {1..10}; do
status_green="`curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s | grep -E "green|yellow" | wc -l`" echo "Checking Wazuh indexer health (Attempt $i/10)"
if [[ $status_green -eq 1 ]]; then RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u admin:admin -k -s)
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s
else if echo "$RESPONSE" | grep -qE "green|yellow"; then
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s echo "Cluster Online"
exit 1 echo "$RESPONSE"
exit 0
fi fi
echo "Waiting for cluster to be online"
[ $i -lt 10 ] && sleep 60
done
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`" status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`"
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green|yellow" | wc -l`" status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green|yellow" | wc -l`"
if [[ $status_index_green -eq $status_index ]]; then if [[ $status_index_green -eq $status_index ]]; then
@@ -344,14 +349,19 @@ jobs:
- name: Check Wazuh indexer start - name: Check Wazuh indexer start
run: | run: |
sleep 360 for i in {1..10}; do
status_green="`curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s | grep green | wc -l`" echo "Checking Wazuh indexer health (Attempt $i/10)"
if [[ $status_green -eq 1 ]]; then RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u admin:admin -k -s)
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s
else if echo "$RESPONSE" | grep -qE "green|yellow"; then
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s echo "Cluster Online"
exit 1 echo "$RESPONSE"
exit 0
fi fi
echo "Waiting for cluster to be online"
[ $i -lt 10 ] && sleep 60
done
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`" status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`"
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green" | wc -l`" status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green" | wc -l`"
if [[ $status_index_green -eq $status_index ]]; then if [[ $status_index_green -eq $status_index ]]; then