1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Changed the monitoring command for IP addresses

arpwatch.dat is not the correct place, it should be via syslog, or seperate file
This commit is contained in:
Patrick Debois 2011-08-05 17:36:31 +02:00
parent dbfb17373f
commit 02f5da397c
3 changed files with 28 additions and 5 deletions

View file

@ -0,0 +1,12 @@
uses netcat - requirement of libvirt over ssh
requires arpwatch to be installed
watch log files
vi /etc/rsyslog.d/30-arpwatch.conf
#:msg, contains, "arpwatch:" -/var/log/arpwatch.log
#& ~
if $programname =='arpwatch' then /var/log/arpwatch.log
& ~

View file

@ -98,7 +98,7 @@ module Fog
if !template_options[:disk_template_name].nil?
# Clone the volume
volume=connection.volumes.allocate(:name => template_options[:disk_template_name]).clone("#{template_options[:disk_name]}")
volume=connection.volumes.all(:name => template_options[:disk_template_name]).first.clone("#{template_options[:disk_name]}")
# This gets passed to the domain to know the path of the disk
template_options[:disk_path]=volume.path
@ -111,7 +111,7 @@ module Fog
:size => "#{template_options[:disk_size]}",
:size_unit => "#{template_options[:disk_size_unit]}",
:allocate => "#{template_options[:disk_allocate]}",
:size_unit => "#{template_options[:disk_size_unit]}" })
:allocate_unit => "#{template_options[:disk_allocate_unit]}" })
# This gets passed to the domain to know the path of the disk
template_options[:disk_path]=volume.path
@ -190,10 +190,20 @@ module Fog
@raw.reboot
end
def halt
requires :raw
@raw.halt
end
def poweroff
requires :raw
@raw.destroy
end
def shutdown
requires :raw
@raw.shutdown
end
@ -248,7 +258,8 @@ module Fog
#command="grep #{mac} /var/log/daemon.log |sed -e 's/^.*address //'|cut -d ' ' -f 1"
# TODO: check if this files exists
# Check if it is readable
command="grep #{mac} /var/lib/arpwatch/arp.dat|cut -f 2|tail -1"
command="grep #{mac} /var/log/arpwatch.log |cut -d ':' -f 4-| cut -d ' ' -f 4"
# command="grep #{mac} /var/lib/arpwatch/arp.dat|cut -f 2|tail -1"
# TODO: we need to take the time into account, when IP's are re-allocated, we might be executing
# On the wrong host

View file

@ -143,7 +143,7 @@ module Fog
xml.root.elements['/volume/key'].text=name
xml.delete_element('/volume/target/path')
pool.create_volume_xml_from(xml.to_s,@raw)
return connection.volumes.all(:name => name)
return connection.volumes.all(:name => name).first
end
def xml_desc