1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Pass run_probes arguments to the probes. IM ssh and sh now also sends the host to be monitored

This commit is contained in:
Ruben S. Montero 2010-10-07 18:08:59 +02:00
parent 31d2d72caa
commit 3fc1f03239
3 changed files with 18 additions and 21 deletions

View File

@ -45,12 +45,12 @@ class InformationManager < OpenNebulaDriver
#---------------------------------------------------------------------------
def initialize(hypervisor, num)
super(num, true)
@config = read_configuration
@hypervisor = hypervisor
@cmd_path = "#{ENV['ONE_LOCATION']}/lib/remotes/im/#{hypervisor}.d"
@config = read_configuration
@hypervisor = hypervisor
@cmd_path = "#{ENV['ONE_LOCATION']}/lib/remotes/im/#{hypervisor}.d"
# register actions
register_action(:MONITOR, method("action_monitor"))
end
@ -62,11 +62,10 @@ class InformationManager < OpenNebulaDriver
log_lambda=lambda do |message|
log(number, message)
end
cmd = "#{@cmd_path}/#{@hypervisor}.rb #{host}"
monitor_exe = LocalCommand.run(cmd, host, log_method(id))
cmd_string = "#{@remote_dir}/im/run_probes #{@hypervisor} #{host}"
monitor_exe = LocalCommand.run(cmd_string, host, log_method(id))
if monitor_exe.code == 0
send_message("MONITOR", RESULT[:success], number, monitor_exe.stdout)
else

View File

@ -45,12 +45,12 @@ class InformationManager < OpenNebulaDriver
#---------------------------------------------------------------------------
def initialize(hypervisor, num)
super(num, true)
@config = read_configuration
@hypervisor = hypervisor
@remote_dir = @config['SCRIPTS_REMOTE_DIR'] || '/tmp/one'
# register actions
register_action(:MONITOR, method("action_monitor"))
end
@ -62,18 +62,18 @@ class InformationManager < OpenNebulaDriver
log_lambda=lambda do |message|
log(number, message)
end
if do_update == "1"
# Use SCP to sync:
sync_cmd = "scp -r #{REMOTES_LOCATION}/. #{host}:#{@remote_dir}"
# Use rsync to sync:
# sync_cmd = "rsync -Laz #{REMOTES_LOCATION} #{host}:#{@remote_dir}"
LocalCommand.run(sync_cmd, log_lambda)
end
cmd = SSHCommand.run("#{@remote_dir}/im/run_probes #{@hypervisor}",
host, log_lambda)
cmd_string = "#{@remote_dir}/im/run_probes #{@hypervisor} #{host}"
cmd = SSHCommand.run(cmd_string, host, log_lambda)
if cmd.code == 0
send_message("MONITOR", RESULT[:success], number, cmd.stdout)

View File

@ -16,19 +16,17 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
HYPERVISOR_DIR=$1.d
SCRIPTS_DIR=`dirname $0`
cd $SCRIPTS_DIR
function run_dir {
(
DIR=$1
DIR=$1.d
cd $DIR
for i in `ls *`;do
if [ -x "$i" ]; then
./$i
./$i $*
EXIT_CODE=$?
if [ "x$EXIT_CODE" != "x0" ]; then
echo "Error executing $i" 1>&2
@ -41,7 +39,7 @@ function run_dir {
data=$(
if [ -d "$HYPERVISOR_DIR" ]; then
run_dir $HYPERVISOR_DIR
run_dir $*
fi
)