-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopensips_
More file actions
executable file
·195 lines (169 loc) · 5.04 KB
/
opensips_
File metadata and controls
executable file
·195 lines (169 loc) · 5.04 KB
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
#!/bin/bash
#
# Munin plugin to monitor OpenSIPS
# Copyright (C) 2011 Henning Holtschneider, LocaNet oHG, <henning@loca.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#%# family=auto
#%# capabilities=autoconf suggest
OPENSIPS_CMD="/usr/sbin/opensipsctl"
OPENSIPS_MODULE=$(basename $0 | sed 's/^opensips_//g')
if [ "$1" = "autoconf" ]; then
if [ -x ${OPENSIPS_CMD} ]; then
echo yes
exit 0
else
echo "no (${OPENSIPS_CMD} not found)"
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
${OPENSIPS_CMD} fifo get_statistics all | sed -e 's/^\([^:]*\):\(.*\) = \(.*\)/\1/g' | uniq | grep -v sl
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_category OpenSIPS"
case ${OPENSIPS_MODULE} in
core)
echo "graph_title OpenSIPS core"
echo "graph_vlabel requests / \${graph_period}"
echo "graph_args --base 1000"
echo "rcv_req.label received requests"
echo "rcv_req.type DERIVE"
echo "rcv_req.min 0"
echo "rcv_repl.label received replies"
echo "rcv_repl.type DERIVE"
echo "rcv_repl.min 0"
echo "fwd_req.label forwarded requests"
echo "fwd_req.type DERIVE"
echo "fwd_req.min 0"
echo "fwd_repl.label forwarded replies"
echo "fwd_repl.type DERIVE"
echo "fwd_repl.min 0"
echo "drop_req.label dropped requests"
echo "drop_req.type DERIVE"
echo "drop_req.min 0"
echo "drop_repl.label dropped replies"
echo "drop_repl.type DERIVE"
echo "drop_repl.min 0"
echo "err_req.label request errors"
echo "err_req.type DERIVE"
echo "err_req.min 0"
echo "err_repl.label reply errors"
echo "err_repl.type DERIVE"
echo "err_repl.min 0"
exit 0;;
shmem)
echo "graph_title OpenSIPS memory pool"
echo "graph_vlabel bytes"
echo "total.label total"
echo "used.label used"
exit 0;;
tm)
echo "graph_title OpenSIPS transactions"
echo "graph_vlabel transactions / \${graph_period}"
echo "graph_args --base 1000"
echo "total.label total"
echo "total.type DERIVE"
echo "total.min 0"
echo "2xx.label 2xx transactions"
echo "2xx.type DERIVE"
echo "2xx.min 0"
echo "3xx.label 3xx transactions"
echo "3xx.type DERIVE"
echo "3xx.min 0"
echo "4xx.label 4xx transactions"
echo "4xx.type DERIVE"
echo "4xx.min 0"
echo "5xx.label 5xx transactions"
echo "5xx.type DERIVE"
echo "5xx.min 0"
echo "6xx.label 6xx transactions"
echo "6xx.type DERIVE"
echo "6xx.min 0"
exit 0;;
usrloc)
echo "graph_title OpenSIPS registered users"
echo "graph_vlabel users"
echo "graph_args --base 1000"
echo "graph_scale no"
echo "total.label total"
echo "location.label locations"
exit 0;;
registrar)
echo "graph_title OpenSIPS registrar"
echo "graph_vlabel registrations / \${graph_period}"
echo "graph_args --base 1000"
echo "accepted.label accepted"
echo "accepted.type DERIVE"
echo "accepted.min 0"
echo "rejected.label rejected"
echo "rejected.type DERIVE"
echo "rejected.min 0"
exit 0;;
dialog)
echo "graph_title OpenSIPS SIP active dialogs"
echo "graph_vlabel active dialogs"
echo "graph_args --base 1000"
echo "active.label active"
echo "active.min 0"
exit 0;;
*)
# unknown
exit 1;;
esac
fi
if [ "0${OPENSIPS_MODULE}" = "0" ]; then
exit 1
fi
$(${OPENSIPS_CMD} fifo get_statistics ${OPENSIPS_MODULE}: | sed -e 's/-/_/g' | sed -e 's/^\([^:]*\):\(.*\) = \(.*\)/let \1_\2=\3/g')
case ${OPENSIPS_MODULE} in
core)
echo "rcv_req.value ${core_rcv_requests}"
echo "rcv_repl.value ${core_rcv_replies}"
echo "fwd_req.value ${core_fwd_requests}"
echo "fwd_repl.value ${core_fwd_replies}"
echo "drop_req.value ${core_drop_requests}"
echo "drop_repl.value ${core_drop_replies}"
echo "err_req.value ${core_err_requests}"
echo "err_repl.value ${core_err_replies}"
exit 0;;
shmem)
echo "total.value ${shmem_total_size}"
echo "used.value ${shmem_used_size}"
exit 0;;
tm)
echo "total.value ${tm_UAS_transactions}"
echo "2xx.value ${tm_2xx_transactions}"
echo "3xx.value ${tm_3xx_transactions}"
echo "4xx.value ${tm_4xx_transactions}"
echo "5xx.value ${tm_5xx_transactions}"
echo "6xx.value ${tm_6xx_transactions}"
exit 0;;
usrloc)
echo "total.value ${usrloc_registered_users}"
echo "location.value ${usrloc_location_contacts}"
exit 0;;
registrar)
echo "accepted.value ${registrar_accepted_regs}"
echo "rejected.value ${registrar_rejected_regs}"
exit 0;;
dialog)
echo "active.value ${dialog_active_dialogs}"
exit 0;;
*)
# unknown
exit 1;;
esac