1+ runs :
2+ using : " composite"
3+ steps :
4+ - name : Wait for start Wazuh Cluster
5+ shell : bash
6+ run : sleep 120
7+
8+ - name : Check Wazuh indexer start
9+ shell : bash
10+ run : |
11+ status_green="`curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s | grep green | wc -l`"
12+ if [[ $status_green -eq 1 ]]; then
13+ curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s
14+ else
15+ curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:admin -k -s
16+ exit 1
17+ fi
18+ status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`"
19+ status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep "green" | wc -l`"
20+ if [[ $status_index_green -eq $status_index ]]; then
21+ curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
22+ else
23+ curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
24+ exit 1
25+ fi
26+
27+ - name : Check Wazuh indexer nodes
28+ shell : bash
29+ run : |
30+ nodes="`curl -XGET "https://0.0.0.0:9200/_cat/nodes" -u admin:admin -k -s | wc -l`"
31+ if [[ $nodes -eq 1 ]]; then
32+ echo "Wazuh indexer nodes: ${nodes}"
33+ else
34+ echo "Wazuh indexer nodes: ${nodes}"
35+ exit 1
36+ fi
37+
38+ - name : Check documents into wazuh-alerts index
39+ shell : bash
40+ run : |
41+ docs="`curl -XGET "https://0.0.0.0:9200/wazuh-alerts*/_doc/_search" -u admin:admin -k -s | jq -r ".hits.total.value"`"
42+ if [[ $docs -gt 100 ]]; then
43+ echo "wazuh-alerts index documents: ${docs}"
44+ else
45+ echo "wazuh-alerts index documents: ${docs}"
46+ exit 1
47+ fi
48+
49+ - name : Check Wazuh templates
50+ shell : bash
51+ run : |
52+ qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics" | wc -l`"
53+ templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics"`"
54+ if [[ $qty_templates -eq 3 ]]; then
55+ echo "wazuh templates:"
56+ echo "${templates}"
57+ else
58+ echo "wazuh templates:"
59+ echo "${templates}"
60+ exit 1
61+ fi
62+
63+ - name : Check Wazuh manager start
64+ shell : bash
65+ run : |
66+ services="`curl -k -s -X GET "https://0.0.0.0:55000/manager/status?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}" | jq -r .data.affected_items | grep running | wc -l`"
67+ if [[ $services -gt 9 ]]; then
68+ echo "Wazuh Manager Services: ${services}"
69+ echo "OK"
70+ else
71+ echo "Wazuh indexer nodes: ${nodes}"
72+ curl -k -X GET "https://0.0.0.0:55000/manager/status?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}" | jq -r .data.affected_items
73+ exit 1
74+ fi
75+ env :
76+ TOKEN : $(curl -s -u wazuh-wui:wazuh-wui -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
77+
78+ - name : Check Wazuh dashboard service URL
79+ shell : bash
80+ run : |
81+ status=$(curl -XGET --silent https://0.0.0.0:443/app/status -k -u admin:admin -I -s | grep -E "^HTTP" | awk '{print $2}')
82+ if [[ $status -eq 200 ]]; then
83+ echo "Wazuh dashboard status: ${status}"
84+ else
85+ echo "Wazuh dashboard status: ${status}"
86+ exit 1
87+ fi
88+
89+ - name : Check Errors in ossec.log
90+ shell : bash
91+ run : |
92+ log=$(sudo awk 'BEGIN{IGNORECASE=1} /ERROR|CRITICAL/' /var/ossec/logs/ossec.log)
93+ if [[ -z "$log" ]]; then
94+ echo "No errors in ossec.log"
95+ else
96+ echo "Errors in ossec.log:"
97+ echo "${log}"
98+ exit 1
99+ fi
100+
101+ - name : Check Errors from filebeat
102+ shell : bash
103+ run : |
104+ filebeatout=$(sudo filebeat test output)
105+ filebeatstatus=$(echo "${filebeatout}" | grep -c OK)
106+ if [[ filebeatstatus -eq 7 ]]; then
107+ echo "No errors in filebeat"
108+ else
109+ echo "Errors in filebeat"
110+ echo "${filebeatout}"
111+ exit 1
112+ fi
0 commit comments