Opensips 3.2 have beautiful statistics module. For example you may get Data about average count of incoming sip messages directly from MI interface. Also you can output it on Zabbix graph.
so, now you be able to ask system for stats though MI interface, for example:
opensips-cli -x mi get_statistics all
internally opensips-cli will ask opensips through http://127.0.0.1:8888/mi with POST request with json body:
#example 1 for statistics... { "jsonrpc":"2.0", "id":1, "method":"get_statistics", "params":[ ["avg_1m:", "shmem:", metri "usrloc:"] ] }
#example 2 for ratelimit data... { "jsonrpc":"2.0", "id":1, "method":"rl_list", "params": [] }
You will get result in Json format too.
In our case i just counting how many INVITE,REGISTER and CANCELS initial requests caming to my opensips per 1 minute.
#in opensips.conf: .... modparam("statistics", "stat_series_profile", "avg_1m: algorithm=accumulate") .... route { route(custom_stat); .... } route[custom_stat] { # Ignore indialog requests if (has_totag()) return ; update_stat_series("avg_1m", "$si", 1); update_stat_series("avg_1m", "$rm", 1); update_stat_series("avg_1m", "$socket_in(proto)|$rm|$si", 1); }
ZABBIX
{ "Pipes": [ { "id": "xxx.xxx.xxx.xxx", "algorithm": "TAILDROP", "limit": 30, "counter": 0 }, { "id": "total_INVITE", "algorithm": "TAILDROP", "limit": 150, "counter": 0 } ], "drop_rate": 1150 }
Leave a Reply