[OpenAFS] Re: list all AFS clients

Edward Quick edwardquick@hotmail.com
Wed, 9 Aug 2006 10:45:54 +0000


--_763f3d62-86b4-4436-bc73-2b2956fcbb23_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I've written a script which I want to collect version information on all th=
e clients (we have a large network) but unfortunately I don't think the com=
mand:/usr/afs/bin/rxdebug $vldb -allgets them all. From the email yesterday=
, it sounded like I might have to run this against some other boxes? Could =
you clarify that for me please? The script is below for anyone who wants it=
.Cheers,Ed.#!/usr/bin/perluse Socket;# get list of all AFS connected hosts$=
vldb=3D"rsl155";@servers=3D`/usr/afs/bin/rxdebug $vldb -all | grep host`;@s=
ervers=3Dmap (getip($_),@servers);# remove dupes from @servers%temp_hash;un=
def @temp_hash{@servers};@servers =3D keys %temp_hash;# get AFS version for=
 each serverforeach $ip ( @servers ){        $version=3D`/usr/afs/bin/rxdeb=
ug $ip 7001 -version | grep version`;        chomp $version;        $versio=
n=3D~/AFS version:\s*(.*)/;        $version=3D$1;        $host=3Dgethostbya=
ddr( inet_aton($ip), AF_INET );        $hosts{$host}=3D$version;}foreach $h=
ost (sort keys %hosts){        print "\n$host:$hosts{$host}";}print "\n\n";=
sub getip{        my ($line)=3D@_;        $line=3D~/(\d+\.\d+\.\d+\.\d+)/; =
       $ip=3D$1;        return $ip;}> To: openafs-info@openafs.org> From: j=
buehler@spirentcom.com> Subject: [OpenAFS] Re: list all AFS clients> Date: =
Tue, 8 Aug 2006 09:21:05 -0400> > Edward Quick wrote:> > > Is there an AFS =
command I can run to list all the boxes with clients? I> > doubt it, but th=
ought I'd ask just in case!> > Depending on how big a setup you have, you c=
an scan the network for> clients.  Roughly:> > for machine in $all_client_m=
achines; do> 	rxdebug $machine 7001 -version> done> > I have a cron job tha=
t does this periodically and keeps a database with the> info.  This has bee=
n very useful in keeping things up to date.> > It obviously won't catch off=
line machines though.> -- > Joe Buehler> > ________________________________=
_______________> OpenAFS-info mailing list> OpenAFS-info@openafs.org> https=
://lists.openafs.org/mailman/listinfo/openafs-info
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=3D5d21c51a-b161-4314-9b0e-=
4911fb2b2e6d=

--_763f3d62-86b4-4436-bc73-2b2956fcbb23_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>=0A=
<head>=0A=
<style>=0A=
P=0A=
{=0A=
margin:0px;=0A=
padding:0px=0A=
}=0A=
body=0A=
{=0A=
FONT-SIZE: 10pt;=0A=
FONT-FAMILY:Tahoma=0A=
}=0A=
</style>=0A=
</head>=0A=
<body>I've written a script which I want to collect version information on =
all the clients (we have a large network) but unfortunately I don't think t=
he command:<br><br>/usr/afs/bin/rxdebug $vldb -all<br><br>gets them all. Fr=
om the email yesterday, it sounded like I might have to run this against so=
me other boxes? Could you clarify that for me please? The script is below f=
or anyone who wants it.<br><br>Cheers,<br><br>Ed.<br><br>#!/usr/bin/perl<br=
><br>use Socket;<br><br># get list of all AFS connected hosts<br>$vldb=3D"r=
sl155";<br>@servers=3D`/usr/afs/bin/rxdebug $vldb -all | grep host`;<br>@se=
rvers=3Dmap (getip($_),@servers);<br><br># remove dupes from @servers<br>%t=
emp_hash;<br>undef @temp_hash{@servers};<br>@servers =3D keys %temp_hash;<b=
r><br># get AFS version for each server<br>foreach $ip ( @servers ){<br>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $version=3D`/usr/afs/bin/rxdebug $i=
p 7001 -version | grep version`;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; chomp $version;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $version=
=3D~/AFS version:\s*(.*)/;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $v=
ersion=3D$1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $host=3Dgethostb=
yaddr( inet_aton($ip), AF_INET );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; $hosts{$host}=3D$version;<br>}<br><br><br>foreach $host (sort keys %ho=
sts){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "\n$host:$hosts{$=
host}";<br>}<br>print "\n\n";<br><br>sub getip{<br>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp; my ($line)=3D@_;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; $line=3D~/(\d+\.\d+\.\d+\.\d+)/;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; $ip=3D$1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $=
ip;<br>}<br><br><br><br><br><hr id=3D"stopSpelling">&gt; To: openafs-info@o=
penafs.org<br>&gt; From: jbuehler@spirentcom.com<br>&gt; Subject: [OpenAFS]=
 Re: list all AFS clients<br>&gt; Date: Tue, 8 Aug 2006 09:21:05 -0400<br>&=
gt; <br>&gt; Edward&nbsp;Quick&nbsp;wrote:<br>&gt; <br>&gt; &gt;&nbsp;Is&nb=
sp;there&nbsp;an&nbsp;AFS&nbsp;command&nbsp;I&nbsp;can&nbsp;run&nbsp;to&nbs=
p;list&nbsp;all&nbsp;the&nbsp;boxes&nbsp;with&nbsp;clients?&nbsp;I<br>&gt; =
&gt;&nbsp;doubt&nbsp;it,&nbsp;but&nbsp;thought&nbsp;I'd&nbsp;ask&nbsp;just&=
nbsp;in&nbsp;case!<br>&gt; <br>&gt; Depending&nbsp;on&nbsp;how&nbsp;big&nbs=
p;a&nbsp;setup&nbsp;you&nbsp;have,&nbsp;you&nbsp;can&nbsp;scan&nbsp;the&nbs=
p;network&nbsp;for<br>&gt; clients.&nbsp;&nbsp;Roughly:<br>&gt; <br>&gt; fo=
r&nbsp;machine&nbsp;in&nbsp;$all_client_machines;&nbsp;do<br>&gt; 	rxdebug&=
nbsp;$machine&nbsp;7001&nbsp;-version<br>&gt; done<br>&gt; <br>&gt; I&nbsp;=
have&nbsp;a&nbsp;cron&nbsp;job&nbsp;that&nbsp;does&nbsp;this&nbsp;periodica=
lly&nbsp;and&nbsp;keeps&nbsp;a&nbsp;database&nbsp;with&nbsp;the<br>&gt; inf=
o.&nbsp;&nbsp;This&nbsp;has&nbsp;been&nbsp;very&nbsp;useful&nbsp;in&nbsp;ke=
eping&nbsp;things&nbsp;up&nbsp;to&nbsp;date.<br>&gt; <br>&gt; It&nbsp;obvio=
usly&nbsp;won't&nbsp;catch&nbsp;offline&nbsp;machines&nbsp;though.<br>&gt; =
--&nbsp;<br>&gt; Joe&nbsp;Buehler<br>&gt; <br>&gt; ________________________=
_______________________<br>&gt; OpenAFS-info&nbsp;mailing&nbsp;list<br>&gt;=
 OpenAFS-info@openafs.org<br>&gt; https://lists.openafs.org/mailman/listinf=
o/openafs-info<br><br /><hr />Be one of the first to try  <a href=3D'http:/=
/ideas.live.com/programpage.aspx?versionId=3D5d21c51a-b161-4314-9b0e-4911fb=
2b2e6d' target=3D'_new'>Windows Live Mail.</a></body>=0A=
</html>=

--_763f3d62-86b4-4436-bc73-2b2956fcbb23_--