From aec0aa7bf66668906282f7c58eb8026b52ab5a0d Mon Sep 17 00:00:00 2001 From: Dawris Date: Tue, 10 Dec 2024 13:06:01 +0100 Subject: [PATCH] Cambios journalbeat --- script/script.sh | 86 ++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/script/script.sh b/script/script.sh index f62d519..caecafa 100755 --- a/script/script.sh +++ b/script/script.sh @@ -36,6 +36,49 @@ bash ./mkcerts.sh cp CA/certs/ca.crt.pem /etc/ssl/certs/ ln -s /etc/ssl/certs/ca.crt.pem /etc/ssl/certs/"$(openssl x509 -in /etc/ssl/certs/ca.crt.pem -hash -noout).0" +# Configurar Journalbeat + +# Verificar si la URL es accesible +curl -I --connect-timeout 10 --max-time 30 "https://artifacts.elastic.co/downloads/beats/journalbeat/journalbeat-oss-7.12.1-amd64.deb" -o /dev/null -s +if [[ $? -ne 0 ]]; then + echo "ERROR: No se puede resolver la URL. Verifica tu conexión a Internet o la disponibilidad del servidor." + exit 1 # Detener el script +fi + +echo "La URL es accesible. Continuando..." + +curl --connect-timeout 10 --max-time 60 -L -o /tmp/journalbeat-oss-7.12.1-amd64.deb https://artifacts.elastic.co/downloads/beats/journalbeat/journalbeat-oss-7.12.1-amd64.deb +dpkg -i /tmp/journalbeat-oss-7.12.1-amd64.deb +cp CA/certs/oglog-jb.mytld.crt.pem /etc/journalbeat/ +cp CA/private/oglog-jb.mytld.key.nopass.pem /etc/journalbeat/oglog-jb.mytld.key.pem +cat >/etc/journalbeat/journalbeat.yml < /etc/apt/sources.list.d/opensearch-2.x.list @@ -120,49 +163,6 @@ EOF sed -i -e '/^ARGS/s%"$%--web.config.file=/etc/prometheus/web-config.yml"%' /etc/default/prometheus systemctl restart prometheus -# Configurar Journalbeat - -# Verificar si la URL es accesible -curl -I --connect-timeout 10 --max-time 30 "https://artifacts.elastic.co/downloads/beats/journalbeat/journalbeat-oss-7.12.1-amd64.deb" -o /dev/null -s -if [[ $? -ne 0 ]]; then - echo "ERROR: No se puede resolver la URL. Verifica tu conexión a Internet o la disponibilidad del servidor." - exit 1 # Detener el script -fi - -echo "La URL es accesible. Continuando..." - -curl --connect-timeout 10 --max-time 60 -L -o /tmp/journalbeat-oss-7.12.1-amd64.deb https://artifacts.elastic.co/downloads/beats/journalbeat/journalbeat-oss-7.12.1-amd64.deb -dpkg -i /tmp/journalbeat-oss-7.12.1-amd64.deb -cp CA/certs/oglog-jb.mytld.crt.pem /etc/journalbeat/ -cp CA/private/oglog-jb.mytld.key.nopass.pem /etc/journalbeat/oglog-jb.mytld.key.pem -cat >/etc/journalbeat/journalbeat.yml <