diff --git a/src/im_mad/remotes/lib/nsx.rb b/src/im_mad/remotes/lib/nsx.rb index 26ea3abe23..2bbdd8c8d4 100644 --- a/src/im_mad/remotes/lib/nsx.rb +++ b/src/im_mad/remotes/lib/nsx.rb @@ -41,6 +41,7 @@ class NsxMonitor attr_accessor :nsx_status def initialize(host_id) + @host_id = host_id @nsx_client = nil @nsx_status = '' return unless nsx_ready? @@ -118,8 +119,7 @@ class NsxMonitor def nsx_ready? @one_item = VCenterDriver::VIHelper - .one_item(OpenNebula::Host, - @vi_client.instance_variable_get(:@host_id).to_i) + .one_item(OpenNebula::Host, @host_id.to_i) # Check if NSX_MANAGER is into the host template if [nil, ''].include?(@one_item['TEMPLATE/NSX_MANAGER']) diff --git a/src/im_mad/remotes/lib/vcenter.rb b/src/im_mad/remotes/lib/vcenter.rb index cf71d9de5f..0ee9adf8a7 100644 --- a/src/im_mad/remotes/lib/vcenter.rb +++ b/src/im_mad/remotes/lib/vcenter.rb @@ -297,8 +297,8 @@ class ClusterMonitor customizations.each do |c| t = 'CUSTOMIZATION = [ ' - t << %() - t << %() + t << %Q + t << %Q text << t end @@ -494,7 +494,7 @@ class ClusterMonitor vm_info << "IMPORT_TEMPLATE=\"#{vm_template64}\"," end - vm_info << "POLL=\"#{self.info.gsub('"', '\\"')}\"]" + vm_info << "POLL=\"#{self.info.gsub('"', "\\\"")}\"]" rescue StandardError => e vm_info = error_monitoring(e, vm_ref, info) end diff --git a/src/im_mad/remotes/vcenter-probes.d/host/beacon/monitord-client-shepherd.sh b/src/im_mad/remotes/vcenter-probes.d/host/beacon/monitord-client-shepherd.sh index 6dae6fdbb5..c7defdc813 100755 --- a/src/im_mad/remotes/vcenter-probes.d/host/beacon/monitord-client-shepherd.sh +++ b/src/im_mad/remotes/vcenter-probes.d/host/beacon/monitord-client-shepherd.sh @@ -16,14 +16,28 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +HID=$2 +HNAME=$3 + +STDIN=`cat -` + +CLIENT_PID_FILE=/tmp/one-monitord-$HID.pid + ( -[ -f /tmp/one-monitord-client.pid ] || exit 0 -running_pid=$(cat /tmp/one-monitord-client.pid) -pids=$(ps axuwww | grep -e "/monitord-client.rb vcenter" | grep -v grep | awk '{ print $2 }' | grep -v "^${running_pid}$") +[ -f $CLIENT_PID_FILE ] || exit 0 + +running_pid=$(cat $CLIENT_PID_FILE) +pids=$(ps axuwww | grep -e "/monitord-client.rb.*${HID} " | grep -v grep | \ + awk '{ print $2 }' | grep -v "^${running_pid}$") if [ -n "$pids" ]; then - kill -6 $pids + kill $pids fi -) > /dev/null +oned=`ps auxwww | grep oned | grep -v grep | wc -l` +if [ ${oned} -eq 0 ]; then + kill ${running_pid} +fi + +) > /dev/null \ No newline at end of file diff --git a/src/im_mad/remotes/vcenter-probes.d/host/system/nsx.rb b/src/im_mad/remotes/vcenter-probes.d/host/system/nsx.rb index 504fb8ab24..691bcf8452 100755 --- a/src/im_mad/remotes/vcenter-probes.d/host/system/nsx.rb +++ b/src/im_mad/remotes/vcenter-probes.d/host/system/nsx.rb @@ -35,7 +35,8 @@ $LOAD_PATH << RUBY_LIB_LOCATION require 'nsx_driver' require_relative '../../../lib/nsx.rb' -host_id = ARGV[1] +host = ARGV[-1] +host_id = ARGV[-2] # Vcenter and NSX connection begin diff --git a/src/im_mad/remotes/vcenter-probes.d/host/system/vcenter.rb b/src/im_mad/remotes/vcenter-probes.d/host/system/vcenter.rb index d4b553228e..dc2bc71aa8 100755 --- a/src/im_mad/remotes/vcenter-probes.d/host/system/vcenter.rb +++ b/src/im_mad/remotes/vcenter-probes.d/host/system/vcenter.rb @@ -18,7 +18,8 @@ require_relative '../../../lib/vcenter.rb' -host_id = ARGV[1] +host = ARGV[-1] +host_id = ARGV[-2] begin # Vcenter connection