refs #1835 removes oglog environment variable from setup filebeat
parent
ed7eb92764
commit
4fba4757e4
|
@ -148,21 +148,14 @@ def setup_filebeat():
|
||||||
deb_path = "/etc/filebeat/filebeat-oss-7.12.1-amd64.deb"
|
deb_path = "/etc/filebeat/filebeat-oss-7.12.1-amd64.deb"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Instalar Filebeat desde el .deb directamente
|
|
||||||
subprocess.run(["dpkg", "-i", "--force-overwrite", deb_path], check=True)
|
subprocess.run(["dpkg", "-i", "--force-overwrite", deb_path], check=True)
|
||||||
|
|
||||||
# (Opcional) Garantizar permisos adecuados sobre los certificados y configuraciones
|
|
||||||
subprocess.run(["chmod", "644", "/etc/filebeat/ogagent-fb.mytld.crt.pem"], check=True)
|
subprocess.run(["chmod", "644", "/etc/filebeat/ogagent-fb.mytld.crt.pem"], check=True)
|
||||||
subprocess.run(["chmod", "600", "/etc/filebeat/ogagent-fb.mytld.key.pem"], check=True)
|
subprocess.run(["chmod", "600", "/etc/filebeat/ogagent-fb.mytld.key.pem"], check=True)
|
||||||
subprocess.run(["chmod", "644", "/etc/ssl/certs/ca.crt.pem"], check=True)
|
subprocess.run(["chmod", "644", "/etc/ssl/certs/ca.crt.pem"], check=True)
|
||||||
subprocess.run(["chmod", "644", "/etc/filebeat/filebeat.yml"], check=True)
|
subprocess.run(["chmod", "644", "/etc/filebeat/filebeat.yml"], check=True)
|
||||||
|
|
||||||
# Añadir entrada al /etc/hosts
|
print("Filebeat instalado.")
|
||||||
oglog_ip = os.getenv('OGAGENTCFG_OGLOG_IP', '192.168.2.4')
|
|
||||||
with open('/etc/hosts', 'a') as f:
|
|
||||||
f.write(f"{oglog_ip} oglog-os.mytld\n")
|
|
||||||
|
|
||||||
print("Filebeat instalado y ejecutándose correctamente.")
|
|
||||||
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error instalando Filebeat: {e}")
|
print(f"Error instalando Filebeat: {e}")
|
||||||
|
|
Loading…
Reference in New Issue