The installation guides for Siremis v1.x and 2.0 have been relocated to our wiki system, click on next link to access it:

The content that follows in this page is obsoleted and will be removed soon.

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 (OpenSER) 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.

Proxy config

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

  • use a cron job to fetch statistics (or other data) from Kamailio (OpenSER) and write in the table. This document does not present how to do it, it is expected you know how to deal with cron job and shell tools to parse the output of MI commands. If not, use the next method.
  • use rtimer module to run periodically a route. In that route you insert the values in database. Next are presented the steps to get working the three charts shipped by default with SIREMIS

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");
}

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.

Siremis config

The configuration file for charts pannel 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

  • ChartGroup – defines the charts to be displayed in one SIREMIS page
  • Chart – defines a chart – there can be many per ChartGroup
  • XAxis – column and data type for X-axis of the chart
  • YAxis – column and data type for Y-axis of the chart – there can be many per chart

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.