Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / fsprobe / fsprobe.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
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
8 */
9
10 #ifndef __fsprobe_h
11 #define __fsprobe_h 1
12
13 /*------------------------------------------------------------------------
14 * fsprobe.h
15 *
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.
19 *
20 *------------------------------------------------------------------------*/
21
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>
30
31 struct ProbeViceStatistics {
32 afs_uint32 CurrentMsgNumber;
33 afs_uint32 OldestMsgNumber;
34 afs_uint32 CurrentTime;
35 afs_uint32 BootTime;
36 afs_uint32 StartTime;
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;
53 afs_int32 SystemCPU;
54 afs_int32 UserCPU;
55 afs_int32 NiceCPU;
56 afs_int32 IdleCPU;
57 afs_int32 TotalIO;
58 afs_int32 ActiveVM;
59 afs_int32 TotalVM;
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;
69 afs_int32 Spare1;
70 afs_int32 Spare2;
71 afs_int32 Spare3;
72 afs_int32 Spare4;
73 afs_int32 Spare5;
74 afs_int32 Spare6;
75 afs_int32 Spare7;
76 afs_int32 Spare8;
77 ViceDisk Disk[VOLMAXPARTS];
78 };
79
80
81 /*
82 * Connection information per FileServer host being probed.
83 */
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 */
91 };
92
93 /*
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.
96 */
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? */
102 };
103
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 */
108
109 extern int fsprobe_Init(int, struct sockaddr_in *, int, int (*)(void), int );
110 /*
111 * Summary:
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.
115 *
116 * Args:
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?
122 *
123 * Returns:
124 * 0 on success,
125 * Error value otherwise.
126 */
127
128 extern int fsprobe_ForceProbeNow(void);
129 /*
130 * Summary:
131 * Force an immediate probe to the connected FileServers.
132 *
133 * Args:
134 * None.
135 *
136 * Returns:
137 * 0 on success,
138 * Error value otherwise.
139 */
140
141 extern int fsprobe_Cleanup(int);
142 /*
143 * Summary:
144 * Clean up our memory and connection state.
145 *
146 * Args:
147 * int a_releaseMem : Should we free up malloc'ed areas?
148 *
149 * Returns:
150 * 0 on total success,
151 * -1 if the module was never initialized, or there was a problem
152 * with the fsprobe connection array.
153 */
154
155 #endif /* __fsprobe_h */