This shows you the differences between two versions of the page.
— | siremis:install32x:charts [2011/12/14 16:21] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Siremis v3.2.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 -- the installation wizard of Siremis creates a table statistics with some predefined metrics, you can extend it if you need or create another one following the same kind of structure. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | Besides the dynamic charts, the **Charts Pannel** includes views for charts or summaries generated from other Kamailio tables, such as **location** or **acc**. For these ones, there is no need to do anything, just load the appropriate modules in Kamailio and configure them with database storage support. | ||
+ | |||
+ | ==== 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 | ||
+ | |||
+ | |||
+ | An example of SIP Proxy configuration snippets for the statistics printed by default Siremis charts: | ||
+ | |||
+ | * some of the statistics are taken directly from internal Kamailio statistics | ||
+ | * other statistics are built by config operations, using htable to store them in memory | ||
+ | |||
+ | <code c> | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | |||
+ | ... | ||
+ | |||
+ | modparam(" | ||
+ | modparam(" | ||
+ | |||
+ | modparam(" | ||
+ | " | ||
+ | |||
+ | modparam(" | ||
+ | |||
+ | ... | ||
+ | route[STATS] { | ||
+ | |||
+ | # clean very old records | ||
+ | $var(tmc) = $var(tmc) + 1; | ||
+ | $var(x) = $var(tmc) mod 144; | ||
+ | if($var(x) == 0) | ||
+ | sql_query(" | ||
+ | " | ||
+ | " | ||
+ | |||
+ | # insert values for Kamailio internal statistics | ||
+ | sql_query(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | # init the values for first execution, compute the diff for the rest | ||
+ | if($var(tmc)==1) | ||
+ | { | ||
+ | $var(rcv_req_diff) = $stat(rcv_requests); | ||
+ | $var(fwd_req_diff) = $stat(fwd_requests); | ||
+ | $var(2xx_trans_diff) = $stat(2xx_transactions); | ||
+ | } else { | ||
+ | $var(rcv_req_diff) = $stat(rcv_requests) - $sht(a=> | ||
+ | $var(fwd_req_diff) = $stat(fwd_requests) - $sht(a=> | ||
+ | $var(2xx_trans_diff) = $stat(2xx_transactions) | ||
+ | - $sht(a=> | ||
+ | } | ||
+ | # update the values for stats stored in cache (htable) | ||
+ | $sht(a=> | ||
+ | $sht(a=> | ||
+ | $sht(a=> | ||
+ | |||
+ | # insert values for stats computed in config | ||
+ | sql_query(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Database ==== | ||
+ | |||
+ | Kamailio statistics table was created by Siremis Web Installation Wizard by checking “Update SIP Database” option in Step 2. You will see a new table named ' | ||
+ | |||
+ | 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=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <Chart name=" | ||
+ | orderby=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | < | ||
+ | <Item name=" | ||
+ | </ | ||
+ | </ | ||
+ | <Chart name=" | ||
+ | order=" | ||
+ | < | ||
+ | <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 add a new file in directory: | ||
+ | < | ||
+ | siremis/ | ||
+ | </ | ||
+ | |||
+ | Say it is named **ChartsCgnameView.xml**, | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Then, to add it to menu, update the file: | ||
+ | < | ||
+ | siremis/ | ||
+ | </ | ||
+ | |||
+ | Find the XML node: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | and add a new subnode. | ||
+ | |||
+ | The URL for View node has to be // | ||
+ | |||
+ | Then, in Siremis web interface, go to Administration panel and reload module **ser** (under tab **Modules**). | ||
+ | |||
+ | {{tag> |