mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B #5250: Add time stamp to monitor clients
(cherry picked from commit 7d6e019e6dda2e575bcc953b13e6a55c7e882515)
This commit is contained in:
parent
af55e166f6
commit
4933e19b1d
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user