File: cache_snmp.h

package info (click to toggle)
squid 7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,440 kB
  • sloc: cpp: 184,513; ansic: 12,442; sh: 5,688; makefile: 5,247; perl: 2,560; sql: 326; python: 240; awk: 141; sed: 1
file content (273 lines) | stat: -rw-r--r-- 8,827 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
 *
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.
 */

#ifndef SQUID_INCLUDE_CACHE_SNMP_H
#define SQUID_INCLUDE_CACHE_SNMP_H

#if SQUID_SNMP

typedef int64_t snint;

#ifndef MIN
#define MIN(a,b) (a<b?a:b)
#endif

#include "snmp.h"
#include "snmp_api.h"
#include "snmp_impl.h"

/* MIB definitions
 * SQUID-MIB
 *      .iso.org.dod.internet.private.enterprises.nlanr.squid
 *        1   3   6     1        4         1      3495    1
 *
 * PROXY-MIB
 *      .iso.org.dod.internet.experimental.nsfnet.proxy
 *        1   3   6     1          3         25    17
 */

#define SQUIDMIB 1, 3, 6, 1, 4, 1, 3495, 1
#define LEN_SQUIDMIB 8
#define INSTANCE 0
#define TIME_INDEX 1, 5, 60
#define TIME_INDEX_LEN 3

/* basic groups under .squid */

#define SQ_SYS  SQUIDMIB, 1           /* cacheSystem group { squid 1 } */
#define LEN_SQ_SYS LEN_SQUIDMIB+1
#define SQ_CONF SQUIDMIB, 2           /* cacheConfig group { squid 2 } */
#define LEN_SQ_CONF LEN_SQUIDMIB+1
#define SQ_PRF  SQUIDMIB, 3           /* cachePerformance group { squid 3 } */
#define LEN_SQ_PRF LEN_SQUIDMIB+1
#define SQ_NET  SQUIDMIB, 4           /* cacheNetwork group { squid 4 }   */
#define LEN_SQ_NET LEN_SQUIDMIB+1
#define SQ_MESH  SQUIDMIB, 5          /* cacheMesh group { squid 5 }    */
#define LEN_SQ_MESH LEN_SQUIDMIB+1

/**
 * cacheSystem group { squid 1 }
 */
enum {
    SYS_START  = 0,
    SYSVMSIZ   = 1,  /**< cacheSysVMsize  */
    SYSSTOR    = 2,  /**< cacheSysStorage  */
    SYS_UPTIME = 3,  /**< cacheUptime  */
    SYS_END
};

#define LEN_SYS LEN_SQ_SYS + 1
#define LEN_SYS_INST LEN_SQ_SYS + 2

/**
 * cacheConfig group { squid 2 }
 */
enum {
    CONF_START      = 0,
    CONF_ADMIN      = 1,  /**< cacheAdmin */
    CONF_VERSION    = 2,  /**< cacheSoftware */
    CONF_VERSION_ID = 3,  /**< cacheVersionId */
    CONF_LOG_FAC    = 4,  /**< cacheLoggingFacility */
    CONF_STORAGE    = 5,  /**< cacheStorageConfig group */
    CONF_UNIQNAME   = 6,  /**< cacheUniqName */
    CONF_END
};

#define LEN_CONF LEN_SQ_CONF + 1
#define LEN_CONF_INST LEN_SQ_CONF + 2

/**
 * cacheStorageConfig group { cacheConfig 5 }
 */
enum {
    CONF_ST_START    = 0,
    CONF_ST_MMAXSZ   = 1,  /* cacheMemMaxSize */
    CONF_ST_SWMAXSZ  = 2,  /* cacheSwapMaxSize */
    CONF_ST_SWHIWM   = 3,  /* cacheSwapHighWM */
    CONF_ST_SWLOWM   = 4,  /* cacheSwapLowWM  */
    CONF_ST_END
};

#define LEN_CONF_ST LEN_CONF + 1
#define LEN_CONF_ST_INST LEN_CONF + 2

/*
 * Cache Performance Group  {squid 3}
 */

enum {
    PERF_START  = 0,
    PERF_SYS    = 1,  /* cacheSysPerf */
    PERF_PROTO  = 2,  /* cacheProtoStats */
    PERF_END
};

/* cacheSysPerf */
enum {
    PERF_SYS_START            = 0,
    PERF_SYS_PF               = 1,  /* cacheSysPageFaults */
    PERF_SYS_NUMR             = 2,  /* cacheSysNumReads */
    PERF_SYS_MEMUSAGE         = 3,  /* cacheMemUsage */
    PERF_SYS_CPUTIME          = 4,  /* cacheCpuTime */
    PERF_SYS_CPUUSAGE         = 5,  /* cacheCpuUsage */
    PERF_SYS_MAXRESSZ         = 6,  /* cacheMaxResSize */
    PERF_SYS_NUMOBJCNT        = 7,  /* cacheNumObjCount */
    PERF_SYS_CURLRUEXP        = 8,  /* cacheCurrentLRUExpiration */
    PERF_SYS_CURUNLREQ        = 9,  /* cacheCurrentUnlinkRequests */
    PERF_SYS_CURUNUSED_FD     = 10, /* cacheCurrentUnusedFDescrCnt */
    PERF_SYS_CURRESERVED_FD   = 11, /* cacheCurrentResFileDescrCnt */
    PERF_SYS_CURUSED_FD       = 12, /* cacheCurrentFileDescrCnt */
    PERF_SYS_CURMAX_FD        = 13, /* cacheCurrentFileDescrMax */
    PERF_SYS_END
};

/* cacheProtoStats */
enum {
    PERF_PROTOSTAT_START,
    PERF_PROTOSTAT_AGGR    = 1,  /* cacheProtoAggregateStats */
    PERF_PROTOSTAT_MEDIAN  = 2,  /* cacheMedianSvcTable */
    PERF_PROTOSTAT_END
};

/* cacheProtoAggregateStats */
enum {
    PERF_PROTOSTAT_AGGR_START           = 0,
    PERF_PROTOSTAT_AGGR_HTTP_REQ        = 1,  /* cacheProtoClientHttpRequests */
    PERF_PROTOSTAT_AGGR_HTTP_HITS       = 2,  /* cacheHttpHits */
    PERF_PROTOSTAT_AGGR_HTTP_ERRORS     = 3,  /* cacheHttpErrors */
    PERF_PROTOSTAT_AGGR_HTTP_KBYTES_IN  = 4,  /* cacheHttpInKb */
    PERF_PROTOSTAT_AGGR_HTTP_KBYTES_OUT = 5,  /* cacheHttpOutKb */
    PERF_PROTOSTAT_AGGR_ICP_S           = 6,  /* cacheIcpPktsSent */
    PERF_PROTOSTAT_AGGR_ICP_R           = 7,  /* cacheIcpPktsRecv */
    PERF_PROTOSTAT_AGGR_ICP_SKB         = 8,  /* cacheIcpKbSent */
    PERF_PROTOSTAT_AGGR_ICP_RKB         = 9,  /* cacheIcpKbRecv */
    PERF_PROTOSTAT_AGGR_REQ             = 10, /* cacheServerRequests */
    PERF_PROTOSTAT_AGGR_ERRORS          = 11, /* cacheServerErrors */
    PERF_PROTOSTAT_AGGR_KBYTES_IN       = 12, /* cacheServerInKb */
    PERF_PROTOSTAT_AGGR_KBYTES_OUT      = 13, /* cacheServerOutKb */
    PERF_PROTOSTAT_AGGR_CURSWAP         = 14, /* cacheCurrentSwapSize */
    PERF_PROTOSTAT_AGGR_CLIENTS         = 15, /* cacheClients */
    PERF_PROTOSTAT_AGGR_END
};

/* cacheMedianSvcEntry */
enum {
    PERF_MEDIAN_START     = 0,
    PERF_MEDIAN_TIME      = 1,  /* cacheMedianTime */
    PERF_MEDIAN_HTTP_ALL  = 2,  /* cacheHttpAllSvcTime */
    PERF_MEDIAN_HTTP_MISS = 3,  /* cacheHttpMissSvcTime */
    PERF_MEDIAN_HTTP_NM   = 4,  /* cacheHttpNmSvcTime */
    PERF_MEDIAN_HTTP_HIT  = 5,  /* cacheHttpHitSvcTime */
    PERF_MEDIAN_ICP_QUERY = 6,  /* cacheIcpQuerySvcTime */
    PERF_MEDIAN_ICP_REPLY = 7,  /* cacheIcpReplySvcTime */
    PERF_MEDIAN_DNS       = 8,  /* cacheDnsSvcTime */
    PERF_MEDIAN_RHR       = 9,  /* cacheRequestHitRatio */
    PERF_MEDIAN_BHR       = 10, /* cacheRequestByteRatio */
    PERF_MEDIAN_HTTP_NH   = 11, /* cacheHttpNhSvcTime */
    PERF_MEDIAN_END
};

/*
 * cacheNetwork group  { squid 4 }
 */
enum {
    NET_START       = 0,
    NET_IP_CACHE    = 1, /* cacheIpCache */
    NET_FQDN_CACHE  = 2, /* cacheFqdnCache */
    NET_DNS_CACHE   = 3,  /* cacheDns */
    NET_END
};

/* cacheIpCache */
enum {
    IP_START   = 0,
    IP_ENT     = 1,  /* cacheIpEntrie */
    IP_REQ     = 2,  /* cacheIpRequests */
    IP_HITS    = 3,  /* acheIpHits */
    IP_PENDHIT = 4,  /* cacheIpPendingHits */
    IP_NEGHIT  = 5,  /* cacheIpNegativeHit */
    IP_MISS    = 6,  /* cacheIpMisses */
    IP_GHBN    = 7,  /* cacheBlockingGetHostByName */
    IP_LOC     = 8,  /* cacheAttemptReleaseLckEntries */
    IP_END
};

/* cacheFqdnCache */
enum {
    FQDN_START   = 0,
    FQDN_ENT     = 1,  /* cacheFqdnEntries */
    FQDN_REQ     = 2,  /* cacheFqdnRequests */
    FQDN_HITS    = 3,  /* cacheFqdnHits */
    FQDN_PENDHIT = 4,  /* cacheFqdnPendingHits */
    FQDN_NEGHIT  = 5,  /* cacheFqdnNegativeHits */
    FQDN_MISS    = 6,  /* cacheFqdnMisses */
    FQDN_GHBN    = 7,  /* cacheBlockingGetHostByAddr */
    FQDN_END
};

/* cacheDNS */
enum {
    DNS_START   = 0,
    DNS_REQ     = 1,  /* cacheDnsRequests */
    DNS_REP     = 2,  /* cacheDnsReplies */
    DNS_SERVERS = 3,  /* cacheDnsNumberServers */
    DNS_END
};

/*
 * cacheMesh group { squid 5 }
 */

enum {
    MESH_START = 0,
    MESH_PTBL  = 1,  /* cachePeerTable  */
    MESH_CTBL  = 2,  /* cacheClientTable */
    MESH_END
};

/* CachePeerEntry (version 3) */
enum {
    MESH_PTBL_START     = 0,
    MESH_PTBL_INDEX     = 1,  /* cachePeerIndex  */
    MESH_PTBL_NAME      = 2,  /* cachePeerName  */
    MESH_PTBL_ADDR_TYPE = 3,  /* cachePeerAddressType */
    MESH_PTBL_ADDR      = 4,  /* cachePeerAddress */
    MESH_PTBL_HTTP      = 5,  /* cachePortHttp */
    MESH_PTBL_ICP       = 6,  /* cachePeerPortIcp */
    MESH_PTBL_TYPE      = 7,  /* cachePeerType  */
    MESH_PTBL_STATE     = 8,  /* cachePeerStat */
    MESH_PTBL_SENT      = 9,  /* cachePeerPingsSent */
    MESH_PTBL_PACKED    = 10, /* cachePeerPingsAcked */
    MESH_PTBL_FETCHES   = 11, /* cachePeerFetches */
    MESH_PTBL_RTT       = 12, /* cachePeerRtt */
    MESH_PTBL_IGN       = 13, /* cachePeerIgnored */
    MESH_PTBL_KEEPAL_S  = 14, /* cachePeerKeepAlSent */
    MESH_PTBL_KEEPAL_R  = 15, /* cachePeerKeepAlRecv */
    MESH_PTBL_END
};

/* cacheClientEntry */
enum {
    MESH_CTBL_START       = 0,
    MESH_CTBL_ADDR_TYPE   = 1,  /* cacheClientAddressType */
    MESH_CTBL_ADDR        = 2,  /* cacheClientAddress */
    MESH_CTBL_HTREQ       = 3,  /* cacheClientHttpRequests */
    MESH_CTBL_HTBYTES     = 4,  /* cacheClientHttpKb */
    MESH_CTBL_HTHITS      = 5,  /* cacheClientHttpHits */
    MESH_CTBL_HTHITBYTES  = 6,  /* cacheClientHTTPHitKb */
    MESH_CTBL_ICPREQ      = 7,  /* cacheClientIcpRequests */
    MESH_CTBL_ICPBYTES    = 8,  /* cacheClientIcpKb  */
    MESH_CTBL_ICPHITS     = 9,  /* cacheClientIcpHits */
    MESH_CTBL_ICPHITBYTES = 10, /* cacheClientIcpHitKb */
    MESH_CTBL_END
};

#endif /* SQUID_SNMP */

#endif /* SQUID_INCLUDE_CACHE_SNMP_H */