Révision 72e4561a
Munin Kamailio Plugin
| plugins/kamailio/kamailio_memory | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
# -*- perl -*- |
|
| 3 |
|
|
| 4 |
=head1 NAME |
|
| 5 |
|
|
| 6 |
Munin plugin to monitor the usage of memory on Voxtrot Sip Server (Kamailio + Freeswitch + RTPproxy). |
|
| 7 |
|
|
| 8 |
=head1 CONFIGURATION |
|
| 9 |
|
|
| 10 |
No configuration |
|
| 11 |
|
|
| 12 |
=head1 AUTHOR |
|
| 13 |
|
|
| 14 |
Copyright 2012 - Voxtrot <www.voxtrot.com> |
|
| 15 |
Oussama Hammami <oussamacvoxtrot.com> |
|
| 16 |
|
|
| 17 |
=head1 LICENSE |
|
| 18 |
|
|
| 19 |
GPLv2 |
|
| 20 |
|
|
| 21 |
=head1 VERSION |
|
| 22 |
|
|
| 23 |
$Id: kamailio_memory 2012-04-19 15:09 $ |
|
| 24 |
|
|
| 25 |
=head1 MAGIC MARKERS |
|
| 26 |
|
|
| 27 |
#%# family=manual |
|
| 28 |
#%# capabilities=autoconf |
|
| 29 |
|
|
| 30 |
=cut |
|
| 31 |
|
|
| 32 |
use strict; |
|
| 33 |
|
|
| 34 |
my %WANTED = ( "kamailio" => "ram_total", |
|
| 35 |
"rtpproxy" => "ram_rtpproxy", |
|
| 36 |
"freeswitch" => "ram_freeswitch", |
|
| 37 |
); |
|
| 38 |
|
|
| 39 |
my %VALUE = ( "ram_total" => 0, |
|
| 40 |
"ram_rtpproxy" => 0, |
|
| 41 |
"ram_freeswitch" => 0, |
|
| 42 |
); |
|
| 43 |
|
|
| 44 |
my $arg = shift(); |
|
| 45 |
|
|
| 46 |
if ($arg eq 'config') {
|
|
| 47 |
print_config(); |
|
| 48 |
exit(); |
|
| 49 |
} elsif ($arg eq 'autoconf') {
|
|
| 50 |
unless (test_service() ) {
|
|
| 51 |
print "yes\n"; |
|
| 52 |
} else {
|
|
| 53 |
print "no\n"; |
|
| 54 |
} |
|
| 55 |
exit 0; |
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
for my $key (keys %WANTED) {
|
|
| 59 |
$VALUE{$WANTED{$key}}=get_memory($key);
|
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
$VALUE{"ram_total"}+=$VALUE{"ram_rtpproxy"}+$VALUE{"ram_freeswitch"};
|
|
| 63 |
|
|
| 64 |
for my $key (keys %VALUE) {
|
|
| 65 |
print ("$key.value $VALUE{$key}\n");
|
|
| 66 |
} |
|
| 67 |
|
|
| 68 |
sub print_config {
|
|
| 69 |
print ("graph_title Voxtrot SIP Server Memory\n");
|
|
| 70 |
# Arguments to "rrdtool graph". In this case, tell it that the |
|
| 71 |
# lower limit of the graph is '0', and that 1k=1000 (not 1024). |
|
| 72 |
print("graph_args --base 1024 --lower-limit 0\n");
|
|
| 73 |
print("graph_vlabel MB\n");
|
|
| 74 |
print("graph_scale no\n");
|
|
| 75 |
print("graph_category kamailio\n");
|
|
| 76 |
print("graph_info The graph describes the usage of memory in Voxtrot Sip Server.\n");
|
|
| 77 |
print("ram_total.label total (kam+fs+rtp)\n");
|
|
| 78 |
print("ram_freeswitch.label freeswitch\n");
|
|
| 79 |
print("ram_rtpproxy.label rtpproxy\n");
|
|
| 80 |
print("ram_total.info Average total memory used by kamailio, freeswitch and rtpproxy for the five minutes.\n");
|
|
| 81 |
print("ram_freeswitch.info Average used memory by freeswitch for the five minutes.\n");
|
|
| 82 |
print("ram_rtpproxy.info Average real used memory by rtpproxy for the five minutes.\n");
|
|
| 83 |
print("graph_order ram_total ram_freeswitch ram_rtpproxy\n");
|
|
| 84 |
print("ram_total.type GAUGE\n");
|
|
| 85 |
print("ram_freeswitch.type GAUGE\n");
|
|
| 86 |
print("ram_rtpproxy.type GAUGE\n");
|
|
| 87 |
print("ram_total.draw AREA\n");
|
|
| 88 |
print("ram_freeswitch.draw AREA\n");
|
|
| 89 |
print("ram_rtpproxy.draw LINE1\n");
|
|
| 90 |
print("ram_total.colour 6699FF\n");
|
|
| 91 |
print("ram_freeswitch.colour FF6633\n");
|
|
| 92 |
print("ram_rtpproxy.colour 993399\n");
|
|
| 93 |
# Ensure min values (useful when using 'DERIVE' as 'type'). |
|
| 94 |
print("ram_total.min 0\n");
|
|
| 95 |
print("ram_freeswitch.min 0\n");
|
|
| 96 |
print("ram_rtpproxy.min 0\n");
|
|
| 97 |
# Divide the got value by 1048576 to get MB. |
|
| 98 |
print("ram_total.cdef ram_total,1048576,/\n");
|
|
| 99 |
print("ram_freeswitch.cdef ram_freeswitch,1048576,/\n");
|
|
| 100 |
print("ram_rtpproxy.cdef ram_rtpproxy,1048576,/\n");
|
|
| 101 |
} |
|
| 102 |
|
|
| 103 |
|
|
| 104 |
sub test_service {
|
|
| 105 |
print "yes\n"; |
|
| 106 |
exit 0; |
|
| 107 |
} |
|
| 108 |
|
|
| 109 |
######################### |
|
| 110 |
# function Get Memory |
|
| 111 |
|
|
| 112 |
sub get_memory {
|
|
| 113 |
my $proc=shift; |
|
| 114 |
my $i = 0; |
|
| 115 |
my @cmd = `ps auwx | grep $proc | grep -v grep | grep -v kamailio_memory`; |
|
| 116 |
foreach (@cmd) {
|
|
| 117 |
my @return = split(/ +/, $_); |
|
| 118 |
$i += @return[5]*1024; |
|
| 119 |
} |
|
| 120 |
return $i; |
|
| 121 |
} |
|
| plugins/kamailio/kamailio_mysql_shared_memory | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
# -*- perl -*- |
|
| 3 |
|
|
| 4 |
=head1 NAME |
|
| 5 |
|
|
| 6 |
Munin plugin to monitor the usage of shared memory in Kamailio using 'statistics' table. |
|
| 7 |
|
|
| 8 |
=head1 APPLICABLE SYSTEMS |
|
| 9 |
|
|
| 10 |
It requires MySQL 'statistics' table created in Kamailio database. |
|
| 11 |
http://siremis.asipto.com/install-charts-panel/ |
|
| 12 |
|
|
| 13 |
=head1 CONFIGURATION |
|
| 14 |
|
|
| 15 |
[kamailio*] |
|
| 16 |
user root |
|
| 17 |
group root |
|
| 18 |
env.mysql <optional-override-of-mysqladmin-path> |
|
| 19 |
env.mysqlauth -u<User> -p<Password> |
|
| 20 |
env.kamailiodb <kamailio data base> |
|
| 21 |
|
|
| 22 |
It is most usual that root must run the mysql command. |
|
| 23 |
|
|
| 24 |
=head2 Proxy config |
|
| 25 |
|
|
| 26 |
use rtimer module to run periodically a route. In that route you insert the values in database. |
|
| 27 |
|
|
| 28 |
SIP Proxy configuration file: |
|
| 29 |
|
|
| 30 |
loadmodule "rtimer.so" |
|
| 31 |
loadmodule "sqlops.so" |
|
| 32 |
loadmodule "cfgutils.so" |
|
| 33 |
... |
|
| 34 |
modparam("rtimer", "timer", "name=tst;interval=300;mode=1;")
|
|
| 35 |
modparam("rtimer", "exec", "timer=tst;route=8")
|
|
| 36 |
modparam("sqlops","sqlcon","ca=>mysql://openser:openserrw@localhost/openser")
|
|
| 37 |
... |
|
| 38 |
route[8] {
|
|
| 39 |
sql_query("ca",
|
|
| 40 |
"insert into statistics (time_stamp,random,shm_used_size,shm_real_used_size, |
|
| 41 |
shm_max_used_size,shm_free_used_size,ul_users,ul_contacts) values ($Ts, |
|
| 42 |
$RANDOM,$stat(used_size),$stat(real_used_size),$stat(max_used_size), |
|
| 43 |
$stat(free_size),$stat(location-users),$stat(location-contacts))","ra"); |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
Note: second parameter of sql_query(...) is a single line. Next version, based on SIP-Router.org project will support string parameters broken in multiple lines. |
|
| 47 |
|
|
| 48 |
=head2 Database |
|
| 49 |
|
|
| 50 |
You have to create a new table in Kamailio (OpenSER) database: |
|
| 51 |
|
|
| 52 |
CREATE TABLE `statistics` ( |
|
| 53 |
`id` int(10) unsigned NOT NULL auto_increment, |
|
| 54 |
`time_stamp` int(10) unsigned NOT NULL default '0', |
|
| 55 |
`random` int(10) unsigned NOT NULL default '0', |
|
| 56 |
`shm_used_size` int(10) unsigned NOT NULL default '0', |
|
| 57 |
`shm_real_used_size` int(10) unsigned NOT NULL default '0', |
|
| 58 |
`shm_max_used_size` int(10) unsigned NOT NULL default '0', |
|
| 59 |
`shm_free_used_size` int(10) unsigned NOT NULL default '0', |
|
| 60 |
`ul_users` int(10) unsigned NOT NULL default '0', |
|
| 61 |
`ul_contacts` int(10) unsigned NOT NULL default '0', |
|
| 62 |
PRIMARY KEY (`id`) |
|
| 63 |
) ENGINE=MyISAM; |
|
| 64 |
|
|
| 65 |
Now all is ready for Kamailio (OpenSER), you can restart it. |
|
| 66 |
|
|
| 67 |
=head1 BUGS |
|
| 68 |
|
|
| 69 |
None known |
|
| 70 |
|
|
| 71 |
=head1 AUTHOR |
|
| 72 |
|
|
| 73 |
Copyright 2012 - Voxtrot <www.voxtrot.com> |
|
| 74 |
Oussama Hammami <oussamacvoxtrot.com> |
|
| 75 |
|
|
| 76 |
=head1 LICENSE |
|
| 77 |
|
|
| 78 |
GPLv2 |
|
| 79 |
|
|
| 80 |
=head1 VERSION |
|
| 81 |
|
|
| 82 |
$Id: kamailio_mysql_shared_memory 2012-04-19 11:24 $ |
|
| 83 |
|
|
| 84 |
=head1 MAGIC MARKERS |
|
| 85 |
|
|
| 86 |
#%# family=manual |
|
| 87 |
#%# capabilities=autoconf |
|
| 88 |
|
|
| 89 |
=cut |
|
| 90 |
|
|
| 91 |
use strict; |
|
| 92 |
|
|
| 93 |
my $MYSQLADMIN = $ENV{mysql} || "mysql";
|
|
| 94 |
my $COMMAND = "$MYSQLADMIN $ENV{mysqlauth} $ENV{kamailiodb} -e 'select * from statistics order by id desc limit 1\\G'";
|
|
| 95 |
|
|
| 96 |
my %WANTED = ( "shm_free_used_size" => "shmem_total", |
|
| 97 |
"shm_real_used_size" => "shmem_real_used", |
|
| 98 |
"shm_used_size" => "shmem_used", |
|
| 99 |
); |
|
| 100 |
|
|
| 101 |
my %VALUE = ( "shmem_total" => 0, |
|
| 102 |
"shmem_real_used" => 0, |
|
| 103 |
"shmem_used" => 0, |
|
| 104 |
); |
|
| 105 |
|
|
| 106 |
my $arg = shift(); |
|
| 107 |
|
|
| 108 |
if ($arg eq 'config') {
|
|
| 109 |
print_config(); |
|
| 110 |
exit(); |
|
| 111 |
} elsif ($arg eq 'autoconf') {
|
|
| 112 |
unless (test_service() ) {
|
|
| 113 |
print "yes\n"; |
|
| 114 |
} else {
|
|
| 115 |
print "no\n"; |
|
| 116 |
} |
|
| 117 |
exit 0; |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
open(SERVICE, "$COMMAND |") |
|
| 121 |
or die("Could not execute '$COMMAND': $!");
|
|
| 122 |
|
|
| 123 |
while (<SERVICE>) {
|
|
| 124 |
my ($k, $v) = (m/(\w+).*?(\d+(?:\.\d+)?)/); |
|
| 125 |
next unless ($k); |
|
| 126 |
if (exists $WANTED{$k} ) {
|
|
| 127 |
$VALUE{$WANTED{$k}}=$v;
|
|
| 128 |
} |
|
| 129 |
} |
|
| 130 |
|
|
| 131 |
close(SERVICE); |
|
| 132 |
|
|
| 133 |
$VALUE{"shmem_total"}+=$VALUE{"shmem_real_used"};
|
|
| 134 |
|
|
| 135 |
for my $key (keys %VALUE) {
|
|
| 136 |
print ("$key.value $VALUE{$key}\n");
|
|
| 137 |
} |
|
| 138 |
|
|
| 139 |
sub print_config {
|
|
| 140 |
print ("graph_title Kamailio Shared Memory\n");
|
|
| 141 |
# Arguments to "rrdtool graph". In this case, tell it that the |
|
| 142 |
# lower limit of the graph is '0', and that 1k=1000 (not 1024). |
|
| 143 |
print("graph_args --base 1024 --lower-limit 0\n");
|
|
| 144 |
print("graph_vlabel MB\n");
|
|
| 145 |
print("graph_scale no\n");
|
|
| 146 |
print("graph_category kamailio\n");
|
|
| 147 |
print("graph_info The graph describes the usage of shared memory.\n");
|
|
| 148 |
print("shmem_total.label total\n");
|
|
| 149 |
print("shmem_used.label used\n");
|
|
| 150 |
print("shmem_real_used.label real used\n");
|
|
| 151 |
print("shmem_total.info Average total shared memory used for the five minutes.\n");
|
|
| 152 |
print("shmem_used.info Average used shared memory for the five minutes.\n");
|
|
| 153 |
print("shmem_real_used.info Average real used shared memory for the five minutes.\n");
|
|
| 154 |
print("graph_order shmem_total shmem_used shmem_real_used\n");
|
|
| 155 |
print("shmem_total.type GAUGE\n");
|
|
| 156 |
print("shmem_used.type GAUGE\n");
|
|
| 157 |
print("shmem_real_used.type GAUGE\n");
|
|
| 158 |
print("shmem_total.draw AREA\n");
|
|
| 159 |
print("shmem_used.draw AREA\n");
|
|
| 160 |
print("shmem_real_used.draw LINE1\n");
|
|
| 161 |
print("shmem_total.colour 11DB58\n");
|
|
| 162 |
print("shmem_used.colour F7CB03\n");
|
|
| 163 |
print("shmem_real_used.colour 990000\n");
|
|
| 164 |
# Ensure min values (useful when using 'DERIVE' as 'type'). |
|
| 165 |
print("shmem_total.min 0\n");
|
|
| 166 |
print("shmem_used.min 0\n");
|
|
| 167 |
print("shmem_real_used.min 0\n");
|
|
| 168 |
# Divide the got value by 1048576 to get MB. |
|
| 169 |
print("shmem_total.cdef shmem_total,1048576,/\n");
|
|
| 170 |
print("shmem_used.cdef shmem_used,1048576,/\n");
|
|
| 171 |
print("shmem_real_used.cdef shmem_real_used,1048576,/\n");
|
|
| 172 |
} |
|
| 173 |
|
|
| 174 |
|
|
| 175 |
sub test_service {
|
|
| 176 |
system ("$MYSQLADMIN --version >/dev/null 2>/dev/null");
|
|
| 177 |
if ($? == 0) |
|
| 178 |
{
|
|
| 179 |
system ("$COMMAND >/dev/null 2>/dev/null");
|
|
| 180 |
if ($? == 0) |
|
| 181 |
{
|
|
| 182 |
print "yes\n"; |
|
| 183 |
} |
|
| 184 |
else |
|
| 185 |
{
|
|
| 186 |
print "no (could not connect to mysql)\n"; |
|
| 187 |
} |
|
| 188 |
} |
|
| 189 |
else |
|
| 190 |
{
|
|
| 191 |
print "no (mysqladmin not found)\n"; |
|
| 192 |
} |
|
| 193 |
exit 0; |
|
| 194 |
} |
|
| plugins/kamailio/kamailio_transactions_users | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
# -*- perl -*- |
|
| 3 |
|
|
| 4 |
=head1 NAME |
|
| 5 |
|
|
| 6 |
Munin plugin to monitor the number of users and transactions in Kamailio using 'statistics' table. |
|
| 7 |
|
|
| 8 |
=head1 APPLICABLE SYSTEMS |
|
| 9 |
|
|
| 10 |
It requires MySQL 'statistics' table created in Kamailio database. |
|
| 11 |
http://siremis.asipto.com/install-charts-panel/ |
|
| 12 |
|
|
| 13 |
=head1 CONFIGURATION |
|
| 14 |
|
|
| 15 |
[kamailio*] |
|
| 16 |
user root |
|
| 17 |
group root |
|
| 18 |
env.mysql <optional-override-of-mysqladmin-path> |
|
| 19 |
env.mysqlauth -u<User> -p<Password> |
|
| 20 |
env.kamailiodb <kamailio data base> |
|
| 21 |
|
|
| 22 |
It is most usual that root must run the mysql command. |
|
| 23 |
|
|
| 24 |
=head2 Proxy config |
|
| 25 |
|
|
| 26 |
use rtimer module to run periodically a route. In that route you insert the values in database. |
|
| 27 |
|
|
| 28 |
SIP Proxy configuration file: |
|
| 29 |
|
|
| 30 |
loadmodule "rtimer.so" |
|
| 31 |
loadmodule "sqlops.so" |
|
| 32 |
loadmodule "cfgutils.so" |
|
| 33 |
... |
|
| 34 |
modparam("rtimer", "timer", "name=tst;interval=300;mode=1;")
|
|
| 35 |
modparam("rtimer", "exec", "timer=tst;route=8")
|
|
| 36 |
modparam("sqlops","sqlcon","ca=>mysql://openser:openserrw@localhost/openser")
|
|
| 37 |
... |
|
| 38 |
route[8] {
|
|
| 39 |
sql_query("ca",
|
|
| 40 |
"insert into statistics (time_stamp,random,shm_used_size,shm_real_used_size, |
|
| 41 |
shm_max_used_size,shm_free_used_size,ul_users,ul_contacts) values ($Ts, |
|
| 42 |
$RANDOM,$stat(used_size),$stat(real_used_size),$stat(max_used_size), |
|
| 43 |
$stat(free_size),$stat(location-users),$stat(location-contacts))","ra"); |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
Note: second parameter of sql_query(...) is a single line. Next version, based on SIP-Router.org project will support string parameters broken in multiple lines. |
|
| 47 |
|
|
| 48 |
=head2 Database |
|
| 49 |
|
|
| 50 |
You have to create a new table in Kamailio (OpenSER) database: |
|
| 51 |
|
|
| 52 |
CREATE TABLE `statistics` ( |
|
| 53 |
`id` int(10) unsigned NOT NULL auto_increment, |
|
| 54 |
`time_stamp` int(10) unsigned NOT NULL default '0', |
|
| 55 |
`random` int(10) unsigned NOT NULL default '0', |
|
| 56 |
`shm_used_size` int(10) unsigned NOT NULL default '0', |
|
| 57 |
`shm_real_used_size` int(10) unsigned NOT NULL default '0', |
|
| 58 |
`shm_max_used_size` int(10) unsigned NOT NULL default '0', |
|
| 59 |
`shm_free_used_size` int(10) unsigned NOT NULL default '0', |
|
| 60 |
`ul_users` int(10) unsigned NOT NULL default '0', |
|
| 61 |
`ul_contacts` int(10) unsigned NOT NULL default '0', |
|
| 62 |
PRIMARY KEY (`id`) |
|
| 63 |
) ENGINE=MyISAM; |
|
| 64 |
|
|
| 65 |
Now all is ready for Kamailio (OpenSER), you can restart it. |
|
| 66 |
|
|
| 67 |
=head1 BUGS |
|
| 68 |
|
|
| 69 |
None known |
|
| 70 |
|
|
| 71 |
=head1 AUTHOR |
|
| 72 |
|
|
| 73 |
Copyright 2012 - Voxtrot <www.voxtrot.com> |
|
| 74 |
Oussama Hammami <oussamacvoxtrot.com> |
|
| 75 |
|
|
| 76 |
=head1 LICENSE |
|
| 77 |
|
|
| 78 |
GPLv2 |
|
| 79 |
|
|
| 80 |
=head1 VERSION |
|
| 81 |
|
|
| 82 |
$Id: kamailio_transactions_users 2012-04-19 16:13 $ |
|
| 83 |
|
|
| 84 |
=head1 MAGIC MARKERS |
|
| 85 |
|
|
| 86 |
#%# family=manual |
|
| 87 |
#%# capabilities=autoconf |
|
| 88 |
|
|
| 89 |
=cut |
|
| 90 |
|
|
| 91 |
use strict; |
|
| 92 |
|
|
| 93 |
my $MYSQL = $ENV{mysql} || "mysql";
|
|
| 94 |
my $COMMAND = "$MYSQL $ENV{mysqlauth} $ENV{kamailiodb} -e 'select * from statistics order by id desc limit 1\\G'";
|
|
| 95 |
|
|
| 96 |
my %WANTED = ( "ul_users" => "users", |
|
| 97 |
"ul_contact" => "contacts", |
|
| 98 |
"tm_active" => "transactions", |
|
| 99 |
); |
|
| 100 |
|
|
| 101 |
my %VALUE = ( "users" => 0, |
|
| 102 |
"contacts" => 0, |
|
| 103 |
"transactions" => 0, |
|
| 104 |
); |
|
| 105 |
|
|
| 106 |
my $arg = shift(); |
|
| 107 |
|
|
| 108 |
if ($arg eq 'config') {
|
|
| 109 |
print_config(); |
|
| 110 |
exit(); |
|
| 111 |
} elsif ($arg eq 'autoconf') {
|
|
| 112 |
unless (test_service() ) {
|
|
| 113 |
print "yes\n"; |
|
| 114 |
} else {
|
|
| 115 |
print "no\n"; |
|
| 116 |
} |
|
| 117 |
exit 0; |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
open(SERVICE, "$COMMAND |") |
|
| 121 |
or die("Could not execute '$COMMAND': $!");
|
|
| 122 |
|
|
| 123 |
while (<SERVICE>) {
|
|
| 124 |
my ($k, $v) = (m/(\w+).*?(\d+(?:\.\d+)?)/); |
|
| 125 |
next unless ($k); |
|
| 126 |
if (exists $WANTED{$k} ) {
|
|
| 127 |
$VALUE{$WANTED{$k}}=$v;
|
|
| 128 |
} |
|
| 129 |
} |
|
| 130 |
|
|
| 131 |
close(SERVICE); |
|
| 132 |
|
|
| 133 |
for my $key (keys %VALUE) {
|
|
| 134 |
print ("$key.value $VALUE{$key}\n");
|
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
sub print_config {
|
|
| 138 |
print ("graph_title Kamailio transactions and location\n");
|
|
| 139 |
# Arguments to "rrdtool graph". In this case, tell it that the |
|
| 140 |
# lower limit of the graph is '0', and that 1k=1000 (not 1024). |
|
| 141 |
print("graph_args --base 1000 --lower-limit 0\n");
|
|
| 142 |
print("graph_vlabel user/transaction\n");
|
|
| 143 |
print("graph_scale no\n");
|
|
| 144 |
print("graph_category kamailio\n");
|
|
| 145 |
print("graph_info The graph describes the number of users/transaction on kamailio.\n");
|
|
| 146 |
|
|
| 147 |
print("users.label users\n");
|
|
| 148 |
print("contacts.label contacts\n");
|
|
| 149 |
print("transactions.label transactions\n");
|
|
| 150 |
|
|
| 151 |
print("users.info Average sip users for the five minutes.\n");
|
|
| 152 |
print("contacts.info Average sip contacts for the five minutes.\n");
|
|
| 153 |
print("transactions.info Average sip transactions for the five minutes.\n");
|
|
| 154 |
|
|
| 155 |
print("graph_order transactions users contacts\n");
|
|
| 156 |
|
|
| 157 |
print("users.type GAUGE\n");
|
|
| 158 |
print("contacts.type GAUGE\n");
|
|
| 159 |
print("transactions.type GAUGE\n");
|
|
| 160 |
|
|
| 161 |
print("users.draw LINE1\n");
|
|
| 162 |
print("contacts.draw LINE1\n");
|
|
| 163 |
print("transactions.draw AREA\n");
|
|
| 164 |
|
|
| 165 |
print("users.colour 00CCC9\n");
|
|
| 166 |
print("contacts.colour 8498A0\n");
|
|
| 167 |
print("transactions.colour E6D300\n");
|
|
| 168 |
|
|
| 169 |
# Ensure min values (useful when using 'DERIVE' as 'type'). |
|
| 170 |
print("users.min 0\n");
|
|
| 171 |
print("contacts.min 0\n");
|
|
| 172 |
print("transactions.min 0\n");
|
|
| 173 |
} |
|
| 174 |
|
|
| 175 |
|
|
| 176 |
sub test_service {
|
|
| 177 |
system ("$MYSQL --version >/dev/null 2>/dev/null");
|
|
| 178 |
if ($? == 0) |
|
| 179 |
{
|
|
| 180 |
system ("$COMMAND >/dev/null 2>/dev/null");
|
|
| 181 |
if ($? == 0) |
|
| 182 |
{
|
|
| 183 |
print "yes\n"; |
|
| 184 |
} |
|
| 185 |
else |
|
| 186 |
{
|
|
| 187 |
print "no (could not connect to mysql)\n"; |
|
| 188 |
} |
|
| 189 |
} |
|
| 190 |
else |
|
| 191 |
{
|
|
| 192 |
print "no (mysql not found)\n"; |
|
| 193 |
} |
|
| 194 |
exit 0; |
|
| 195 |
} |
|
Formats disponibles : Unified diff