Table of Contents

Siremis v1.x - Charts Panel

SIREMIS (starting with version 0.9.1) is able to create and display charts using Open Flash Chart library (GPL-licensed) – the library is included in SIREMIS distribution, you do not need to do anything else. Your web browser needs to have a flash player plug-in.

The data to create the charts is taken from tables residing in Kamailio database. There are no such tables by default, you have to create them and populate, see next.

The table has to include a column that stores the time stamp. These values are used for X-axis. The other columns have to store integer values representing time-dependency of a particular attribute.

Kamailio Config

There are two ways to get data from Kamailio and populate tables to be used for charts:

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_siremis")
...
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");
}
second parameter of the 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 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, you can restart it.

Siremis Config

The configuration file for charts panel is located at:

    siremis/metadata/service/siremisCharts.xml

The content of the file looks like:

<?xml version="1.0" standalone="no"?>
<PluginService Name="siremisCharts" Package="asipto" Class="siremisCharts">
  <ChartGroup name="system">
      <Chart name="random" table="statistics" title="Random" bgcolor="#E0FFFF"
            order="reverse" orderby="ORDER BY id DESC" limit="LIMIT 40">
        <XAxis>
            <Item name="time_stamp" data="time_stamp" title="timestamp"
                          type="timestamp"/>
        </XAxis>
        <YAxis>
            <Item name="random" data="random" title="random" type="dataset"/>
        </YAxis>
    </Chart>
  </ChartGroup>
  <ChartGroup name="shm">
      <Chart name="shm" table="statistics" title="Shared Memory"
            order="reverse" orderby="ORDER BY id DESC" limit="LIMIT 40">
        <XAxis>
            <Item name="time_stamp" data="time_stamp" title="timestamp"
                           type="timestamp"/>
        </XAxis>
        <YAxis>
            <Item name="shm_used_size" data="shm_used_size" title="Used Size"
                        type="dataset" color="#DFC329"/>
            <Item name="shm_max_used_size" data="shm_max_used_size"
                        title="Max Used Size" type="dataset" color="#6363AC"/>
            <Item name="shm_real_used_size" data="shm_real_used_size"
                        title="Real Used Size" type="dataset" color="#5E4725"/>
        </YAxis>
    </Chart>
    <Chart name="shmused" table="statistics" title="Used Shared Memory"
                   bgcolor="#B0E0E6" type="area"
                   order="reverse" orderby="ORDER BY id DESC" limit="LIMIT 40">
        <XAxis>
            <Item name="time_stamp" data="time_stamp" title="timestamp"
                        type="timestamp"/>
        </XAxis>
        <YAxis>
            <Item data="shm_used_size" title="Used Size" type="dataset"
                         color="#D02020"/>
        </YAxis>
    </Chart>
  </ChartGroup>
  <ChartGroup name="usrloc">
      <Chart name="usrloc" table="statistics" title="Location" order="reverse"
            orderby="ORDER BY id DESC" limit="LIMIT 50">
        <XAxis>
            <Item name="time_stamp" data="time_stamp" title="timestamp"
                        type="timestamp"/>
        </XAxis>
        <YAxis>
            <Item name="ul_users" data="ul_users" title="users" type="dataset"
                         color="#D02020"/>
            <Item name="ul_contacts" data="ul_contacts" title="contacts"
                         type="dataset" color="#DFC329"/>
        </YAxis>
    </Chart>
  </ChartGroup>
</PluginService>

There are couple of relevant XML nodes in the configuration file

The attributes for each XML node are pretty self-suggestive. The ‘name’ has to be unique and ‘data’ in the ‘Item’ node represents the column name in the table from where to fetch the values.

To add new chart page in SIREMIS you have to change the file:

    siremis/modules/main/menuChartTabs.xml

The URL for View node has to be “charts.php?cg=cgname”, where cgname is the value of name attribute for a ChartGroup.