diff --git a/src/mad/ruby/scripts_common.rb b/src/mad/ruby/scripts_common.rb index 8cd3b6945a..0608923ee1 100644 --- a/src/mad/ruby/scripts_common.rb +++ b/src/mad/ruby/scripts_common.rb @@ -163,7 +163,13 @@ module OpenNebula result = "FAILURE" end - msg = "#{msg_type} #{result} #{oid} #{data64}" + if Integer(oid) == -1 + ts = 0 + else + ts = Time.now.to_i + end + + msg = "#{msg_type} #{result} #{oid} #{ts} #{data64}" socket_udp = UDPSocket.new() socket_udp.send(msg, 0, mon_address, mon_port) diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index 787c7de868..6e8ce39500 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -1062,6 +1062,12 @@ function send_to_monitor { msg_result="FAILURE" fi + if [ $msg_oid = "-1" ]; then + msg_ts=0 + else + msg_ts=$(date +%s) + fi + # Read monitord config if [ -z "${ONE_LOCATION}" ]; then mon_conf=/etc/one/monitord.conf @@ -1111,6 +1117,6 @@ function send_to_monitor { fi # Send message - echo "$msg_type $msg_result $msg_oid $payload_b64" | + echo "$msg_type $msg_result $msg_oid $msg_ts $payload_b64" | nc -u -w1 $mon_address $mon_port }