diff --git a/src/im_mad/remotes/common.d/monitord-client.rb b/src/im_mad/remotes/common.d/monitord-client.rb index 4438305657..2cc9ca9e3c 100644 --- a/src/im_mad/remotes/common.d/monitord-client.rb +++ b/src/im_mad/remotes/common.d/monitord-client.rb @@ -254,6 +254,15 @@ begin pubkey = config.elements['NETWORK/PUBKEY'].text.to_s hostid = config.elements['HOST_ID'].text.to_s + if host == 'auto' + host = ENV['SSH_CLIENT'].split.first + + if host.to_s.empty? + puts 'NETWORK/MONITOR_ADDRESS is "auto", but SSH_CLIENT unknown' + exit(-1) + end + end + probes = { :system_host_udp => { :period => config.elements['PROBES_PERIOD/SYSTEM_HOST'].text.to_s, diff --git a/src/monitor/etc/monitord.conf b/src/monitor/etc/monitord.conf index 78b38d54d2..5064029db7 100644 --- a/src/monitor/etc/monitord.conf +++ b/src/monitor/etc/monitord.conf @@ -60,6 +60,9 @@ LOG = [ # # addresss : network address to bind the UDP listener to. # monitor_address: agents will send updates to this monitor address +# if "auto" is used, agents will detect the address +# from the ssh connection frontend -> host ($SSH_CLIENT), +# "auto" is not usable for HA setup # # port : listening port # threads : number of processing threads @@ -68,7 +71,7 @@ LOG = [ #******************************************************************************* NETWORK = [ ADDRESS = "0.0.0.0", - MONITOR_ADDRESS = 127.0.0.1, + MONITOR_ADDRESS = "auto", PORT = 4124, THREADS = 8, PUBKEY = "",