2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
13 /*------------------------------------------------------------------------
16 * Interface to the AFS FileServer probe facility. With the routines
17 * defined here, the importer can gather statistics from the given set
18 * of FileServers at regular intervals, or force immediate collection.
20 *------------------------------------------------------------------------*/
22 #include <sys/types.h> /*Basic system types */
23 #include <netinet/in.h> /*Internet definitions */
24 #include <netdb.h> /*Network database library */
25 #include <sys/socket.h> /*Socket definitions */
26 #include <rx/rx.h> /*Rx definitions */
27 #include <afs/afsint.h> /*AFS FileServer interface */
28 #include <afs/volser.h>
29 #include <afs/volint.h>
31 struct ProbeViceStatistics {
32 afs_uint32 CurrentMsgNumber;
33 afs_uint32 OldestMsgNumber;
34 afs_uint32 CurrentTime;
37 afs_int32 CurrentConnections;
38 afs_uint32 TotalViceCalls;
39 afs_uint32 TotalFetchs;
40 afs_uint32 FetchDatas;
41 afs_uint32 FetchedBytes;
42 afs_int32 FetchDataRate;
43 afs_uint32 TotalStores;
44 afs_uint32 StoreDatas;
45 afs_uint32 StoredBytes;
46 afs_int32 StoreDataRate;
47 afs_uint32 TotalRPCBytesSent;
48 afs_uint32 TotalRPCBytesReceived;
49 afs_uint32 TotalRPCPacketsSent;
50 afs_uint32 TotalRPCPacketsReceived;
51 afs_uint32 TotalRPCPacketsLost;
52 afs_uint32 TotalRPCBogusPackets;
60 afs_int32 EtherNetTotalErrors;
61 afs_int32 EtherNetTotalWrites;
62 afs_int32 EtherNetTotalInterupts;
63 afs_int32 EtherNetGoodReads;
64 afs_int32 EtherNetTotalBytesWritten;
65 afs_int32 EtherNetTotalBytesRead;
66 afs_int32 ProcessSize;
67 afs_int32 WorkStations;
68 afs_int32 ActiveWorkStations;
77 ViceDisk Disk[VOLMAXPARTS];
82 * Connection information per FileServer host being probed.
84 struct fsprobe_ConnectionInfo {
85 struct sockaddr_in skt; /*Socket info */
86 struct rx_connection *rxconn; /*Rx connection */
87 struct rx_connection *rxVolconn; /*Rx connection to Vol server */
88 struct partList partList; /*Server part list */
89 afs_int32 partCnt; /*# of parts */
90 char hostName[256]; /*Computed hostname */
94 * The results of a probe of the given set of FileServers. The ith
95 * entry in the stats array corresponds to the ith connected server.
97 struct fsprobe_ProbeResults {
98 int probeNum; /*Probe number */
99 afs_int32 probeTime; /*Time probe initiated */
100 struct ProbeViceStatistics *stats; /*Ptr to stats array for servers */
101 int *probeOK; /*Array: was latest probe successful? */
104 extern int fsprobe_numServers; /*# servers connected */
105 extern struct fsprobe_ConnectionInfo *fsprobe_ConnInfo; /*Ptr to connections */
106 extern int numCollections; /*Num data collections */
107 extern struct fsprobe_ProbeResults fsprobe_Results; /*Latest probe results */
109 extern int fsprobe_Init(int, struct sockaddr_in *, int, int (*)(void), int );
112 * Initialize the fsprobe module: set up Rx connections to the
113 * given set of servers, start up the probe and callback LWPs,
114 * and associate the routine to be called when a probe completes.
117 * int a_numServers : Num. servers to connect to.
118 * struct sockaddr_in *a_socketArray : Array of server sockets.
119 * int a_ProbeFreqInSecs : Probe frequency in seconds.
120 * int (*a_ProbeHandler)() : Ptr to probe handler fcn.
121 * int a_debug : Turn debugging output on?
125 * Error value otherwise.
128 extern int fsprobe_ForceProbeNow(void);
131 * Force an immediate probe to the connected FileServers.
138 * Error value otherwise.
141 extern int fsprobe_Cleanup(int);
144 * Clean up our memory and connection state.
147 * int a_releaseMem : Should we free up malloc'ed areas?
150 * 0 on total success,
151 * -1 if the module was never initialized, or there was a problem
152 * with the fsprobe connection array.
155 extern int fsprobe_Wait(int);
157 #endif /* __fsprobe_h */