-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstats.go
479 lines (473 loc) · 12.2 KB
/
stats.go
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
package main
import (
"regexp"
"github.com/prometheus/client_golang/prometheus"
)
type stat struct {
name string
stat string
regexp *regexp.Regexp
value prometheus.ValueType
help string
desc *prometheus.Desc
}
var opensipsStats = map[string][]stat{
"core": {
{
name: "received_requests_total",
stat: "rcv_requests",
value: prometheus.CounterValue,
help: "The total number of received requests by OpenSIPS",
},
{
name: "received_replies_total",
stat: "rcv_replies",
value: prometheus.CounterValue,
help: "The total number of received replies by OpenSIPS",
},
{
name: "forwarded_requests_total",
stat: "fwd_requests",
value: prometheus.CounterValue,
help: "Total number of stateless forwarded requests by OpenSIPS",
},
{
name: "forwarded_replies_total",
stat: "fwd_replies",
value: prometheus.CounterValue,
help: "Total number of stateless forwarded replies by OpenSIPS",
},
{
name: "dropped_requests_total",
stat: "drop_requests",
value: prometheus.CounterValue,
help: "Total number of requests dropped even before entering the script routing logic",
},
{
name: "dropped_replies_total",
stat: "drop_replies",
value: prometheus.CounterValue,
help: "Total number of replies dropped even before entering the script routing logic",
},
{
name: "error_requests_total",
stat: "err_requests",
value: prometheus.CounterValue,
help: "Total number of bogus or invalid requests",
},
{
name: "error_replies_total",
stat: "err_replies",
value: prometheus.CounterValue,
help: "Total number of bogus or invalid replies",
},
{
name: "bad_uris_received_total",
stat: "bad_URIs_rcvd",
value: prometheus.CounterValue,
help: "Total number of URIs that OpenSIPS failed to parse",
},
{
name: "unsupported_methods_total",
stat: "unsupported_methods",
value: prometheus.CounterValue,
help: "Total number of non-standard methods encountered by OpenSIPS while parsing SIP methods",
},
{
name: "bad_message_headers_total",
stat: "bad_msg_hdr",
value: prometheus.CounterValue,
help: "Total number of SIP headers that OpenSIPS failed to parse",
},
{
name: "uptime_seconds_total",
stat: "timestamp",
value: prometheus.CounterValue,
help: "The number of seconds elapsed from OpenSIPS starting",
},
},
"dialog": {
{
name: "active_dialogs",
stat: "active_dialogs",
value: prometheus.GaugeValue,
help: "Number of active dialogs",
},
{
name: "early_dialogs",
stat: "early_dialogs",
value: prometheus.GaugeValue,
help: "Number of early dialogs",
},
{
name: "processed_dialogs_total",
stat: "processed_dialogs",
value: prometheus.CounterValue,
help: "Total number of processed dialogs",
},
{
name: "expired_dialogs_total",
stat: "expired_dialogs",
value: prometheus.CounterValue,
help: "Total number of expired dialogs",
},
{
name: "failed_dialogs_total",
stat: "failed_dialogs",
value: prometheus.CounterValue,
help: "Total number of failed dialogs",
},
{
name: "replication_messages_sent_total",
regexp: regexp.MustCompile(`^(?P<operation>.+)_sent$`),
value: prometheus.CounterValue,
help: "Total number of replication messages sent",
},
{
name: "replication_messages_received_total",
regexp: regexp.MustCompile(`^(?P<operation>.+)_recv$`),
value: prometheus.CounterValue,
help: "Total number of replication messages received",
},
},
"load": {
{
name: "load",
stat: "load",
value: prometheus.GaugeValue,
help: "The real time load of core OpenSIPS processes",
},
{
name: "load_all",
stat: "load-all",
value: prometheus.GaugeValue,
help: "The real time load of all OpenSIPS processes",
},
{
name: "process_load",
regexp: regexp.MustCompile(`^load-proc-(?P<id>\d+)$`),
value: prometheus.GaugeValue,
help: "he real time load of the OpenSIPS process #id",
},
},
"msilo": {
{
name: "stored_messages_total",
stat: "stored_messages",
value: prometheus.CounterValue,
help: "Total number of stored messages",
},
{
name: "dumped_messages_total",
stat: "dumped_messages",
value: prometheus.CounterValue,
help: "Total number of dumped messages",
},
{
name: "failed_messages_total",
stat: "failed_messages",
value: prometheus.CounterValue,
help: "Total number of failed messages",
},
{
name: "dumped_reminders_total",
stat: "dumped_reminders",
value: prometheus.CounterValue,
help: "Total number of dumped reminders",
},
{
name: "failed_reminders_total",
stat: "failed_reminders",
value: prometheus.CounterValue,
help: "Total number of failed reminders",
},
},
"nat_traversal": {
{
name: "keepalive_endpoints",
stat: "keepalive_endpoints",
value: prometheus.GaugeValue,
help: "Current number of keepalive endpoints",
},
{
name: "registered_endpoints",
stat: "registered_endpoints",
value: prometheus.GaugeValue,
help: "Current number of registered endpoints",
},
{
name: "subscribed_endpoints",
stat: "subscribed_endpoints",
value: prometheus.GaugeValue,
help: "Current number of subscribed endpoints",
},
{
name: "dialog_endpoints",
stat: "dialog_endpoints",
value: prometheus.GaugeValue,
help: "Current number of dialog endpoints",
},
},
"net": {
{
name: "waiting_bytes",
regexp: regexp.MustCompile(`^waiting_(?P<transport>.+)$`),
value: prometheus.GaugeValue,
help: "The number of bytes waiting to be consumed on interfaces that OpenSIPS is listening on",
},
},
"pkmem": {
{
name: "total_size_bytes",
regexp: regexp.MustCompile(`^(?P<id>\d+)-total_size$`),
value: prometheus.GaugeValue,
help: "The total size of private memory available to OpenSIPS process #id",
},
{
name: "used_size_bytes",
regexp: regexp.MustCompile(`^(?P<id>\d+)-used_size$`),
value: prometheus.GaugeValue,
help: "The total size of private memory used by OpenSIPS process #id",
},
{
name: "real_used_size_bytes",
regexp: regexp.MustCompile(`^(?P<id>\d+)-real_used_size$`),
value: prometheus.GaugeValue,
help: "The total size of private memory (including overhead) used by OpenSIPS process #id",
},
{
name: "max_used_size_bytes",
regexp: regexp.MustCompile(`^(?P<id>\d+)-max_used_size$`),
value: prometheus.GaugeValue,
help: "The maximum amount of private memory ever used by OpenSIPS process #id",
},
{
name: "free_size_bytes",
regexp: regexp.MustCompile(`^(?P<id>\d+)-free_size$`),
value: prometheus.GaugeValue,
help: "The free private memory available for OpenSIPS process #id",
},
{
name: "fragments",
regexp: regexp.MustCompile(`^(?P<id>\d+)-fragments$`),
value: prometheus.GaugeValue,
help: "The number of fragments in the private memory for OpenSIPS process #",
},
},
"registrar": {
{
name: "max_expires",
stat: "max_expires",
value: prometheus.GaugeValue,
help: "The value of the max_expires module parameter",
},
{
name: "max_contacts",
stat: "max_contacts",
value: prometheus.GaugeValue,
help: "The value of the max_contacts module parameter",
},
{
name: "default_expires",
stat: "default_expire",
value: prometheus.GaugeValue,
help: "The value of the default_expires module parameter",
},
{
name: "accepted_registrations_total",
stat: "accepted_registrations",
value: prometheus.CounterValue,
help: "Total number of accepted registrations",
},
{
name: "rejected_registrations_total",
stat: "rejected_registrations",
value: prometheus.CounterValue,
help: "Total number of rejected registrations",
},
},
"shmem": {
{
name: "total_size_bytes",
stat: "total_size",
value: prometheus.GaugeValue,
help: "The total size of shared memory available to OpenSIPS processes",
},
{
name: "used_size_bytes",
stat: "used_size",
value: prometheus.GaugeValue,
help: "The total size of shared memory used by OpenSIPS processes",
},
{
name: "real_used_size_bytes",
stat: "real_used_size",
value: prometheus.GaugeValue,
help: "The total size of shared memory used (including overhead) by OpenSIPS processes",
},
{
name: "max_used_size_bytes",
stat: "max_used_size",
value: prometheus.GaugeValue,
help: "The maximum amount of shared memory used by OpenSIPS processes",
},
{
name: "free_size_bytes",
stat: "free_size",
value: prometheus.GaugeValue,
help: "The amount of free shared memory available to OpenSIPS processes",
},
{
name: "fragments",
stat: "fragments",
value: prometheus.GaugeValue,
help: "The number of fragments in the shared memory used by OpenSIPS processes",
},
},
"sipcapture": {
{
name: "captured_requests_total",
stat: "captured_requests",
value: prometheus.CounterValue,
help: "Total number of SIP requests captured",
},
{
name: "captured_replies_total",
stat: "captured_replies",
value: prometheus.CounterValue,
help: "Total number of SIP replies captured",
},
},
"siptrace": {
{
name: "traced_requests_total",
stat: "traced_requests",
value: prometheus.CounterValue,
help: "Total number of traced requests",
},
{
name: "traced_replies_total",
stat: "traced_replies",
value: prometheus.CounterValue,
help: "Total number of traced replies",
},
},
"sl": {
{
name: "sent_replies",
regexp: regexp.MustCompile(`^(?P<code>[2-6]xx)_replies$`),
value: prometheus.CounterValue,
help: "Total number of sent replies by status code",
},
{
name: "sent_replies_total",
stat: "sent_replies",
value: prometheus.CounterValue,
help: "Total number of sent replies",
},
{
name: "sent_error_replies_total",
stat: "sent_err_replies",
value: prometheus.CounterValue,
help: "Total number of sent error replies",
},
{
name: "received_acks_total",
stat: "received_ACKs",
value: prometheus.CounterValue,
help: "Total number of ACK replies received",
},
},
"sst": {
{
name: "expired_sst_total",
stat: "expired_sst",
value: prometheus.CounterValue,
help: "Total number of expired SST sessions",
},
},
"tm": {
{
name: "received_replies_total",
stat: "received_replies",
value: prometheus.CounterValue,
help: "Total number of replies received",
},
{
name: "relayed_replies_total",
stat: "relayed_replies",
value: prometheus.CounterValue,
help: "Total number of replies relayed",
},
{
name: "local_replies_total",
stat: "local_replies",
value: prometheus.CounterValue,
help: "Total number of local replies sent",
},
{
name: "uas_transactions_total",
stat: "UAS_transactions",
value: prometheus.CounterValue,
help: "Total number of UAS transactions",
},
{
name: "uac_transactions_total",
stat: "UAC_transactions",
value: prometheus.CounterValue,
help: "Total number of UAC transactions",
},
{
name: "transactions_total",
regexp: regexp.MustCompile(`^(?P<code>[2-6]xx)_transactions$`),
value: prometheus.CounterValue,
help: "Total number of transactions by status code",
},
{
name: "inuse_transactions",
stat: "inuse_transactions",
value: prometheus.GaugeValue,
help: "Number of transactions currently in-use",
},
},
"uri": {
{
name: "positive_checks_total",
stat: "positive_checks",
value: prometheus.CounterValue,
help: "Total number of positive URI checks",
},
{
name: "negative_checks_total",
stat: "negative_checks",
value: prometheus.CounterValue,
help: "Total number of negative URI checks",
},
},
"usrloc": {
{
name: "registered_users",
stat: "registered_users",
value: prometheus.GaugeValue,
help: "Current number of registered users",
},
},
}
func init() {
for subsys, stats := range opensipsStats {
for i, stat := range stats {
if stat.desc == nil {
labels := []string{}
if stat.regexp != nil {
labels = stat.regexp.SubexpNames()[1:]
}
stats[i].desc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsys, stat.name),
stat.help,
labels,
nil,
)
}
}
}
}