This shows you the differences between two versions of the page.
— | siremis:install:charts [2010/10/31 13:59] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Siremis v1.x - Charts Panel ====== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | 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 " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | ... | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | " | ||
+ | ... | ||
+ | route[8] { | ||
+ | | ||
+ | " | ||
+ | | ||
+ | | ||
+ | | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | <note important> | ||
+ | |||
+ | ==== Database ==== | ||
+ | |||
+ | You have to create a new table in Kamailio database: | ||
+ | |||
+ | <code sql> | ||
+ | CREATE TABLE `statistics` ( | ||
+ | `id` int(10) unsigned NOT NULL auto_increment, | ||
+ | `time_stamp` int(10) unsigned NOT NULL default ' | ||
+ | `random` int(10) unsigned NOT NULL default ' | ||
+ | `shm_used_size` int(10) unsigned NOT NULL default ' | ||
+ | `shm_real_used_size` int(10) unsigned NOT NULL default ' | ||
+ | `shm_max_used_size` int(10) unsigned NOT NULL default ' | ||
+ | `shm_free_used_size` int(10) unsigned NOT NULL default ' | ||
+ | `ul_users` int(10) unsigned NOT NULL default ' | ||
+ | `ul_contacts` int(10) unsigned NOT NULL default ' | ||
+ | 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/ | ||
+ | </ | ||
+ | |||
+ | The content of the file looks like: | ||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | < | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | type=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | type=" | ||
+ | <Item name=" | ||
+ | title=" | ||
+ | <Item name=" | ||
+ | title=" | ||
+ | </ | ||
+ | </ | ||
+ | <Chart name=" | ||
+ | | ||
+ | | ||
+ | < | ||
+ | <Item name=" | ||
+ | type=" | ||
+ | </ | ||
+ | < | ||
+ | <Item data=" | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <Chart name=" | ||
+ | orderby=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | type=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | | ||
+ | <Item name=" | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 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/ | ||
+ | </ | ||
+ | |||
+ | The URL for View node has to be // | ||
+ | |||
+ | {{tag> |