See the attached email on an example how to get stats on AFS operations per
IP.

Also there was a patch (don't know if it is integrated upstream or not,
probably yes) to add SysV message queue to AFS auditlogs - so then you can
write a simple program and extract data which would allow you to get
accesses by IP.
See https://lists.openafs.org/pipermail/openafs-devel/2009-April/016599.html


Then it depends what do you mean by "user" - if IP address and all you want
to know which IP addresses are using your AFS cell then wireshark might be
enough.


-- 
Robert Milkowski
http://milek.blogspot.com


> -----Original Message-----
> From: [email protected] [mailto:openafs-info-
> [email protected]] On Behalf Of Devine, Steve
> Sent: 16 March 2015 18:13
> To: Jeffrey Altman
> Cc: [email protected]
> Subject: RE: [OpenAFS] Metrics on the cell
> 
> Sadly, they are collecting stats in preparation of closing our AFS cell
> down. They are trying to determine the impact that shutting down our
> cell will have on the community.
> How many users use our Cell? They are not really concerned about the
> amount of disc space that is in use. Thing is this cell has been in
> place for so long it's hard to determine how deeply this will affect
> us.
> 
> /sd
> 
> 
> Steve Devine
> IT Services - Content and Collaboration
> 
> 
> 
> ________________________________________
> From: Jeffrey Altman [[email protected]]
> Sent: Monday, March 16, 2015 1:48 PM
> To: Devine, Steve
> Cc: [email protected]
> Subject: Re: [OpenAFS] Metrics on the cell
> 
> Steve,
> 
> Could you clarify which statistics you are looking to collect?
> 
> Is the question "how many users are accessing the cell from OSX,
> Windows, Linux, iOS, etc via native clients?"
> 
> Or is the question, "how many files or how much data is accessed from
> these same client platforms?"
> 
> To core problem you will face trying to collect numbers such as these
> is that the type of client is agnostic to the servers.  One site that I
> am aware of explicitly assigned alternate port numbers to different OS
> versions so they could be counted by rx debug queries to the file and
> vl servers.  This approach failed when the clients were accessing the
> servers behind NATs.
> 
>  A related question is often "how can I find all of the clients running
> a version of OpenAFS older than x.y.z?"  This data is not available but
> is easier to obtain by modifying the servers to probe the client
> version on each new connection.
> 
> There are some differences in the access patterns between the client
> platforms that can be used if you are collecting the audit log data
> from the file and vl servers.
> 
> Only windows clients use rxkad authenticated connections for accessing
> the VL servers.
> 
> Only windows clients issue get volume info queries to the file servers
> to obtain free space and quota details on a regular basis.
> 
> Windows clients include the directory FID as the first entry in every
> bulk status query to the file servers.
> 
> OS X clients never issue bulk status queries.
> 
> Hope this helpful.
> 
> Jeffrey Altman
> Your File System Inc
> 
> > On Mar 16, 2015, at 5:11 AM, Devine, Steve <[email protected]> wrote:
> >
> > I have been asked by senior leadership to gather data on the usage of
> our cell. I can of course tell them how much disc space is in use and
> parse logs from our filedrawers and FTP service, what I am struggling
> with is determining access via native OpenAFS Windows, Mac and Linux
> clients. I've been experimenting with Scout and Afsmonitor but haven't
> been able to find a definitive solution. It seems like years ago I
> investigated logging at the fileserver level and discovered that
> logging for usage wasn't possible.
> >
> > Has anyone found a way to gather these kind of stats? Thanks for your
> help.
> >
> > /sd
> >
> > Steve Devine
> > Michigan State University
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > OpenAFS-info mailing list
> > [email protected]
> > https://lists.openafs.org/mailman/listinfo/openafs-info
> _______________________________________________
> OpenAFS-info mailing list
> [email protected]
> https://lists.openafs.org/mailman/listinfo/openafs-info
--- Begin Message ---
Hi,


This is the other scripts, which prints different AFS operations being
requested by each client.
Similarily to the previous one - it is a very quickly written script, only
tested on our 1.4.11 based tree (with lots of patches, specifically DAFS),
but there is a good chance it will just work on 1.4.11+ and maybe even on
1.6 (I haven't tried it though). It makes some very specific assumptions
about how a given release of OpenAFS works, and it might not work correctly
or at all for you - although it should be trivial to fix it then.

Also notice, that either script is not necessarily the best way (or even
correct way) to get the stats, but they worked for me.

Please use it at your own risk.

The script requires two arguments - pid of fileserver, and how often it
should print its output (for example 5s).
It then clears terminal at a specified interval and prints the statistics.

Example output:
 
# ./rx_clients.d `pgrep fileserver` 5s

CLIENT IP         CONN CONN/s MKFILE RMFILE  MKDIR  RMDIR RENAME LOOKUP  
LINK SYMLNK SSTORE DSTORE 
=============== ====== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ======
172.24.40.236     6009    133    234    702    234    234      0      0   
234    235    235      0
172.24.3.188       178      3      0      1      0      0      0      0     
0      0      3      0
172.24.41.86         2      0      0      0      0      0      0      0     
0      0      0      0
10.172.170.236       2      0      0      0      0      0      0      0     
0      0      0      0
                ====== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ======
                  6191    137    234    703    234    234      0      0   
234    235    238      0
 

   started: 2010 Nov  8 13:13:16
   current: 2010 Nov  8 13:14:01
 

        SSTORE = Store Status
        DSTORE = Store Data


# cat rx_clients.d
#!/usr/sbin/dtrace -qCs

typedef int afs_int32;

struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

BEGIN
{
  start_timestamp = timestamp;
  start_walltimestamp = walltimestamp;

  @rx_storedata_total = sum(0);
  @rx_fetchdata_total = sum(0);
  @rx_createfile_total = sum(0);
  @rx_removefile_total = sum(0);
  @rx_makedir_total = sum(0);
  @rx_removedir_total = sum(0);
  @rx_rename_total = sum(0);
  @rx_lookup_total = sum(0);
  @rx_link_total = sum(0);
  @rx_symlink_total = sum(0);
  @rx_storestatus_total = sum(0);
}

pid$1:a.out:rxi_ReadPacket:entry
{
  self->in = 1;

  self->inrxient_host = arg2;
  self->inrxient_port = arg3;
}

pid$1:a.out:rxi_ReadPacket:return
/ self->in /
{
  this->srcp = *(uintptr_t *)copyin(self->inrxient_host, sizeof(int));
  this->port = htons(*(uintptr_t *)copyin(self->inrxient_port,
sizeof(ushort)));

  this->srca = (this->srcp & 0xff000000) >> 24;
  this->srcb = (this->srcp & 0x00ff0000) >> 16;
  this->srcc = (this->srcp & 0x0000ff00) >> 8;
  this->srcd = (this->srcp & 0x000000ff);

  /* stringify addresses */
  self->src = strjoin(lltostr(this->srcd), ".");
  self->src = strjoin(self->src, strjoin(lltostr(this->srcc), "."));
  self->src = strjoin(self->src, strjoin(lltostr(this->srcb), "."));
  self->src = strjoin(self->src, lltostr(this->srca + 0));

  @rxi_RP_conn[self->src] = count();
  @rxi_RP_conn_ps[self->src] = count();
  rxi_RP_conn_total++;

  self->inrxient_host = 0;
  self->inrxient_port = 0;
  self->in = 0;

  self->inrx = 1;
}



/* RX CALLS */

pid$1:a.out:SRXAFS_CreateFile:entry
/ self->inrx /
{
  @rx_createfile[self->src] = count();
  @rx_createfile_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_RemoveFile:entry
/ self->inrx /
{
  @rx_removefile[self->src] = count();
  @rx_removefile_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_MakeDir:entry
/ self->inrx /
{
  @rx_makedir[self->src] = count();
  @rx_makedir_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_RemoveDir:entry
/ self->inrx /
{
  @rx_removedir[self->src] = count();
  @rx_removedir_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Rename:entry
/ self->inrx /
{
  @rx_rename[self->src] = count();
  @rx_rename_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Lookup:entry
/ self->inrx /
{
  @rx_lookup[self->src] = count();
  @rx_lookup_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Link:entry
/ self->inrx /
{
  @rx_link[self->src] = count();
  @rx_link_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Symlink:entry
/ self->inrx /
{
  @rx_symlink[self->src] = count();
  @rx_symlink_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_StoreStatus:entry
/ self->inrx /
{
  @rx_storestatus[self->src] = count();
  @rx_storestatus_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:StoreData_RXStyle:entry
/ self->inrx /
{
  self->storedata = 1;

  self->inrx = 0;
}

pid$1:a.out:StoreData_RXStyle:return
/ self->storedata /
{
  self->storedata = 0;
  self->src = 0;
}

syscall::writev:return
/ self->storedata /
{
  @rx_storedata[self->src] = sum(arg0);
  @rx_storedata_total = sum(arg0);
}


pid$1:a.out:FetchData_RXStyle:entry
/ self->inrx /
{
  self->fetchdata = 1;

  self->inrx = 0;
}

pid$1:a.out:FetchData_RXStyle:return
/ self->fetchdata /
{
  self->fetchdata = 0;
  self->src = 0;

}

syscall::readv:return
/ self->fetchdata /
{
  @rx_fetchdata[self->src] = sum(arg0);
  @rx_fetchdata_total = sum(arg0);
}


pid$1:a.out:RXAFSCB_ProbeUuid:entry
/ self->inrx /
{
  printf("%Y %s from %s\n", walltimestamp, probefunc, self->src);;
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:RXAFSCB_ProbeUuid:return
/ self->inrx /
{
  printf("%Y %s from %s\n", walltimestamp, probefunc, self->src);;
  self->inrx = 0;
  self->src = 0;
}


tick-$2
{
  this->seconds = (timestamp - start_timestamp) / 1000000000;
  normalize(@rxi_RP_conn_ps, this->seconds);
  normalize(@rx_fetchdata, 1024*1024);
  normalize(@rx_storedata, 1024*1024);
  normalize(@rx_fetchdata_total, 1024*1024);
  normalize(@rx_storedata_total, 1024*1024);
  setopt("aggsortrev", "true");
  printf("\033[H\033[J");
  printf("CLIENT IP         CONN CONN/s MKFILE RMFILE  MKDIR  RMDIR RENAME
LOOKUP   LINK SYMLNK SSTORE DFETCH DSTORE\n");
  printf("=============== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ====== ====== ======\n");
  printa("%-15s %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d
%@6d\n", @rxi_RP_conn, @rxi_RP_conn_ps, \
         @rx_createfile, @rx_removefile, @rx_makedir, @rx_removedir,
@rx_rename, @rx_lookup, @rx_link, @rx_symlink, \
         @rx_storestatus, @rx_fetchdata, @rx_storedata);
  printf("                ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ====== ====== ======\n");
  printf("%-15s %6d %6d ", "", rxi_RP_conn_total,
rxi_RP_conn_total/this->seconds);
  printa("%@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d ",
@rx_createfile_total, @rx_removefile_total, @rx_makedir_total, \
         @rx_removedir_total, @rx_rename_total, @rx_lookup_total,
@rx_link_total, @rx_symlink_total, @rx_storestatus_total);
  printa("%@6d %@6d\n", @rx_fetchdata_total, @rx_storedata_total);

  printf("\n\n");
  printf("   started: %Y\n", start_walltimestamp);
  printf("   current: %Y\n", walltimestamp);

  printf("\n\n");
  printf("      SSTORE = Store Status\n");
  printf("      DSTORE = Stored Data in MB\n");
  printf("      DFETCH = Fetched Data in MB\n");
}


--
Robert Milkowski
Morgan Stanley | Enterprise Infrastructure
25 Cabot Square | Canary Wharf | Floor 02 London, E14 4QA
Phone: +44 20 7425-7065
[email protected]
<mailto:[email protected]> 


----------------------------------------------------------------------------
----

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions
or views contained herein are not intended to be, and do not constitute,
advice within the meaning of Section 975 of the Dodd-Frank Wall Street
Reform and Consumer Protection Act. If you have received this communication
in error, please destroy all electronic and paper copies and notify the
sender immediately. Mistransmission is not intended to waive confidentiality
or privilege. Morgan Stanley reserves the right, to the extent permitted
under applicable law, to monitor electronic communications. This message is
subject to terms available at the following link:
http://www.morganstanley.com/disclaimers. If you cannot access these links,
please notify us by reply message and we will send the contents to you. By
messaging with Morgan Stanley you consent to the foregoing.

_______________________________________________
OpenAFS-info mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-info

--- End Message ---

Reply via email to