NAME

Munin plugin to monitor the number of users and transactions in Kamailio using 'statistics' table.

APPLICABLE SYSTEMS

It requires MySQL 'statistics' table created in Kamailio database. http://siremis.asipto.com/install-charts-panel/

CONFIGURATION

[kamailio*] user root group root env.mysql <optional-override-of-mysqladmin-path> env.mysqlauth -u<User> -p<Password> env.kamailiodb <kamailio data base>

It is most usual that root must run the mysql command.

Proxy config

use rtimer module to run periodically a route. In that route you insert the values in database.

SIP Proxy configuration file:

 loadmodule "rtimer.so"
 loadmodule "sqlops.so"
 loadmodule "cfgutils.so"
 ...
 modparam("rtimer", "timer", "name=tst;interval=300;mode=1;")
 modparam("rtimer", "exec", "timer=tst;route=8")
 modparam("sqlops","sqlcon","ca=>mysql://openser:openserrw@localhost/openser")
 ...
 route[8] {
  sql_query("ca",
  "insert into statistics (time_stamp,random,shm_used_size,shm_real_used_size,
  shm_max_used_size,shm_free_used_size,ul_users,ul_contacts) values ($Ts,
  $RANDOM,$stat(used_size),$stat(real_used_size),$stat(max_used_size),
  $stat(free_size),$stat(location-users),$stat(location-contacts))","ra");
 }

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.

Database

You have to create a new table in Kamailio (OpenSER) database:

CREATE TABLE `statistics` ( `id` int(10) unsigned NOT NULL auto_increment, `time_stamp` int(10) unsigned NOT NULL default '0', `random` int(10) unsigned NOT NULL default '0', `shm_used_size` int(10) unsigned NOT NULL default '0', `shm_real_used_size` int(10) unsigned NOT NULL default '0', `shm_max_used_size` int(10) unsigned NOT NULL default '0', `shm_free_used_size` int(10) unsigned NOT NULL default '0', `ul_users` int(10) unsigned NOT NULL default '0', `ul_contacts` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM;

Now all is ready for Kamailio (OpenSER), you can restart it.

BUGS

None known

AUTHOR

 Copyright 2012 - Voxtrot <www.voxtrot.com>
 Oussama Hammami <oussamacvoxtrot.com>

LICENSE

GPLv2

VERSION

  $Id: kamailio_transactions_users 2012-04-19 16:13 $

MAGIC MARKERS

  #%# family=manual
  #%# capabilities=autoconf