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 5f0c272343
commit 9c35dec520

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."