Integrating firewalld into node_exporter script

Signed-off-by: Georg <georg@lysergic.dev>
This commit is contained in:
Georg Pfuetzenreuter 2021-07-25 22:50:43 +02:00
parent 333c4a82b8
commit 74f3b0a11f
Signed by: Georg
GPG Key ID: 1DAF57F49F8E8F22

View File

@ -27,6 +27,13 @@ ExecStart=/opt/node_exporter/node_exporter --web.listen-address=":9200"
WantedBy=multi-user.target
EOF
systemctl enable --now node_exporter
if [ -x $(command -v firewall-cmd) ]
then
firewall-cmd --zone=internal --add-port=9200/tcp --permanent
firewall-cmd --reload
else
echo "No firewalld, skipping."
fi
echo "OK"
else
echo "Found traces of an existing installation. Aborted."