Sidebar


siremis:install20:charts

Siremis v2.0 - 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:

  • use a cron job to fetch statistics (or other data) from Kamailio 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=STATS")
modparam("sqlops","sqlcon",
         "ca=>mysql://openser:openserrw@localhost/openser")
...
route[STATS] {
   sql_query("ca",
       "insert into statistics (time_stamp,shm_used_size,shm_real_used_size,"
         "shm_max_used_size,shm_free_used_size,ul_users,ul_contacts) values ($Ts,"
         "$stat(used_size),$stat(real_used_size),$stat(max_used_size),"
         "$stat(free_size),$stat(location-users),$stat(location-contacts))",
       "ra");
}

Database

Kamailio database structure and stored procedure were created by Siremis Web Installation Wizard by checking “Update SIP Database” option in Step 2. You will see a new table named 'statistics'.

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

Siremis Config

The configuration file for charts panel is located at:

    siremis/modules/ser/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 add a new file in directory:

siremis/modules/ser/view/

Say it is named ChartsCgnameView.xml, its content has to be:

<?xml version="1.0" standalone="no"?>
<EasyView Name="ChartsCgnameView" Description="Charts" class="EasyView" Tab="" TemplateEngine="Smarty" TemplateFile="view.tpl">
    <FormReferences>
        <Reference Name="ser.cms.form.ChartsForm"/>
    </FormReferences>
</EasyView>

Then, to add it to menu, update the file:

    siremis/modules/ser/mod.xml

Find the XML node:

<MenuItem Name="System.Ser.Charts" Title="Chart Services" Parent="System.Ser" ...>

and add a new subnode.

The URL for View node has to be “/siremis/ser/charts_cgname/cg=cgname”, where cgname is the value of name attribute for a ChartGroup.

Then, in Siremis web interface, go to Administration panel and reload module ser (under tab Modules).



Copyright 2010-2017 Asipto.com