--- projects/cms/source/host/ihost-perl/ihost.pl 2001/02/01 09:24:54 1.12 +++ projects/cms/source/host/ihost-perl/ihost.pl 2001/02/13 12:28:50 1.16 @@ -9,8 +9,8 @@ # methods as you see fit. # - pjm2@ukc.ac.uk # -# $Author: pjm2 $ -# $Id: ihost.pl,v 1.12 2001/02/01 09:24:54 pjm2 Exp $ +# $Author: tdb $ +# $Id: ihost.pl,v 1.16 2001/02/13 12:28:50 tdb Exp $ #------------------------------------------------------------ $| = 1; @@ -180,7 +180,7 @@ sub send_udp_packet() { my(@statgrab) = `./statgrab.pl`; my(%packet); - for (my($i) = 0; $i < $#statgrab; $i++) { + for (my($i) = 0; $i <= $#statgrab; $i++) { $statgrab[$i] =~ /^([^\s]*) (.*)$/; $packet{$1} = $2; } @@ -190,22 +190,36 @@ sub send_udp_packet() { my($disk_info) = ""; my($i) = 0; while (defined $packet{"packet.disk.p$i.attributes.mount"}) { - $disk_info .= ""; - $disk_info .= qq/$packet{"packet.disk.p$i.attributes.name"}<\/name>/; - $disk_info .= qq/$packet{"packet.disk.p$i.attributes.kbytes"}<\/kbytes>/; - $disk_info .= qq/$packet{"packet.disk.p$i.attributes.used"}<\/used>/; - $disk_info .= qq/$packet{"packet.disk.p$i.attributes.avail"}<\/avail>/; - $disk_info .= qq/$packet{"packet.disk.p$i.attributes.mount"}<\/mount>/; - $disk_info .= ""; + $disk_info .= " in resolv.conf + $domainname = $1; + $machine_name = "$hostname.$domainname"; + } + elsif($resolv =~ /search\s+([^\s]+)/) { + # some machines have search in resolv.conf + $domainname = $1; + $machine_name = "$hostname.$domainname"; + } + else { + # we can't find out the domain + $machine_name = $hostname; + } my($ip) = inet_ntoa(scalar(gethostbyname($hostname)) || 'localhost'); # Build the XML packet this way, as we can clearly @@ -247,12 +261,12 @@ sub send_udp_packet() { $packet{"packet.cpu.swap"} - $packet{"packet.memory.real"} + $packet{"packet.memory.total"} $packet{"packet.memory.free"} - $packet{"packet.memory.swap_total"} - $packet{"packet.memory.swap_free"} + $packet{"packet.swap.total"} + $packet{"packet.swap.free"} $disk_info