set_remote_munin_server_ip.sh: add bind address to munin configuration file /etc/munin/munin-node.conf if needed.
This commit is contained in:
parent
626b651349
commit
5b64969bd2
@ -546,6 +546,18 @@ if [[ -f "$MUNIN_CONF_FILE" ]]; then
|
|||||||
done < "${MUNIN_CONF_FILE}.BAK.${backup_date}"
|
done < "${MUNIN_CONF_FILE}.BAK.${backup_date}"
|
||||||
echo_ok
|
echo_ok
|
||||||
|
|
||||||
|
if $(grep -q -E "^\s*host\s+\*" "$MUNIN_CONF_FILE" 2>/dev/null) ; then
|
||||||
|
primary_inet4_addr="$(ip route get 1 | awk '{print $NF;exit}')"
|
||||||
|
echononl "$MUNIN_CONF_FILE: bind munin to adress '${primary_inet4_addr}'.."
|
||||||
|
perl -i -n -p -e "s/^(\s*host\s+\*.*)/#\1\nhost ${primary_inet4_addr}/" "$MUNIN_CONF_FILE" 2> $log_file
|
||||||
|
if [[ $? -eq 0 ]] ; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
error "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
Loading…
Reference in New Issue
Block a user