[SR-Users] Need useful graphics ideas

Joel Serrano joel at gogii.net
Wed Dec 6 18:11:32 CET 2017


I use a mix of the above...

With kamailio I export that stats I want via http:


event_route[xhttp:request] {
    # Verify request come from localhost
    if(src_ip!=127.0.0.1) {
        xhttp_reply("403", "Forbidden", "text/html",
"<html><body>Forbidden</body></html>");
        xlog("L_WARN", "[HTTP] Unauthorized access from: $si\n");
        exit;
    }

    # Metrics endpoint
    if ($hu =~ "^/statistics") {

        ... build a $var(metrics_json) with the metrics you want, must be
JSON format ...

        }
        xhttp_reply("200", "OK", "application/json", "$var(metrics_json)");
    }
    return;
}


Then in telegraf I use the httpjson module to gather the metrics:

...
[[inputs.httpjson]]
  name_override = "kamailio"
  servers = [ "http://127.0.0.1/statistics" ]
  method = "GET"
...



This is an example:

joel at sbc-dev:~$ curl -q http://127.0.0.1/statistics 2> /dev/null | python
-m json.tool
{
    "core-bad_URIs_rcvd": 0,
    "core-bad_msg_hdr": 0,
    "core-drop_replies": 0,
    "core-drop_requests": 188,
    "core-err_replies": 0,
    "core-err_requests": 0,
    "core-fwd_replies": 0,
    "core-fwd_requests": 25635,
    "core-rcv_replies": 436444,
    "core-rcv_replies_18x": 27981,
    "core-rcv_replies_1xx": 73595,
    "core-rcv_replies_2xx": 347704,
    "core-rcv_replies_3xx": 0,
    "core-rcv_replies_401": 0,
    "core-rcv_replies_404": 345,
    "core-rcv_replies_407": 79,
    "core-rcv_replies_480": 1008,
    "core-rcv_replies_486": 1678,
    "core-rcv_replies_4xx": 8791,
    "core-rcv_replies_5xx": 6077,
    "core-rcv_replies_6xx": 277,
    "core-rcv_requests": 268891,
    "core-rcv_requests_ack": 40666,
    "core-rcv_requests_bye": 25600,
    "core-rcv_requests_cancel": 5313,
    "core-rcv_requests_info": 0,
    "core-rcv_requests_invite": 40983,
    "core-rcv_requests_message": 0,
    "core-rcv_requests_notify": 0,
    "core-rcv_requests_options": 98026,
    "core-rcv_requests_prack": 0,
    "core-rcv_requests_publish": 0,
    "core-rcv_requests_refer": 0,
    "core-rcv_requests_register": 28,
    "core-rcv_requests_subscribe": 0,
    "core-rcv_requests_update": 0,
    "core-unsupported_methods": 0,
    "dialog-active_dialogs": 26,
    "dialog-early_dialogs": 2,
    "dialog-expired_dialogs": 1,
    "dialog-failed_dialogs": 15036,
    "dialog-processed_dialogs": 40577,
    "dns-failed_dns_request": 130,
    "httpclient-connections": 0,
    "httpclient-connfail": 43,
    "httpclient-connok": 18466,
    "pike-blocked_ips": 0,
    "shmem-fragments": 52,
    "shmem-free_size": 1070501576,
    "shmem-max_used_size": 3526632,
    "shmem-real_used_size": 3240248,
    "shmem-total_size": 1073741824,
    "shmem-used_size": 2941760,
    "siptrace-traced_replies": 0,
    "siptrace-traced_requests": 0,
    "sl-1xx_replies": 0,
    "sl-200_replies": 155494,
    "sl-202_replies": 0,
    "sl-2xx_replies": 0,
    "sl-300_replies": 0,
    "sl-301_replies": 0,
    "sl-302_replies": 0,
    "sl-3xx_replies": 0,
    "sl-400_replies": 0,
    "sl-401_replies": 0,
    "sl-403_replies": 0,
    "sl-404_replies": 4,
    "sl-407_replies": 0,
    "sl-408_replies": 0,
    "sl-483_replies": 0,
    "sl-4xx_replies": 1,
    "sl-500_replies": 2,
    "sl-5xx_replies": 188,
    "sl-6xx_replies": 0,
    "sl-failures": 0,
    "sl-received_ACKs": 188,
    "sl-sent_err_replies": 0,
    "sl-sent_replies": 155689,
    "sl-xxx_replies": 0,
    "tcp-con_reset": 0,
    "tcp-con_timeout": 0,
    "tcp-connect_failed": 0,
    "tcp-connect_success": 0,
    "tcp-current_opened_connections": 2,
    "tcp-current_write_queue_size": 0,
    "tcp-established": 9,
    "tcp-local_reject": 0,
    "tcp-passive_open": 9,
    "tcp-send_timeout": 0,
    "tcp-sendq_full": 0,
    "tmx-2xx_transactions": 347673,
    "tmx-3xx_transactions": 0,
    "tmx-4xx_transactions": 66902,
    "tmx-5xx_transactions": 6123,
    "tmx-6xx_transactions": 277,
    "tmx-UAC_transactions": 349602,
    "tmx-UAS_transactions": 420877,
    "tmx-active_transactions": 5,
    "tmx-inuse_transactions": 13,
    "tmx-rpl_absorbed": 57086,
    "tmx-rpl_generated": 110231,
    "tmx-rpl_received": 436444,
    "tmx-rpl_relayed": 379358,
    "tmx-rpl_sent": 489589,
    "usrloc-registered_users": 0
}
joel at sbc-dev:~$


We have all those metrics available now in influxdb, then, as others have
stated, Grafana is your best friend to make those metrics look nice.


Hope these little snippets help you and anyone else getting started with
Kamailio metrics.


Cheers,
Joel.

On Wed, Dec 6, 2017 at 1:20 AM, Daniel-Constantin Mierla <miconda at gmail.com>
wrote:

> Hello,
>
> have you seen the article posted at:
>
>   - https://www.kamailio.org/w/2015/03/kamailio-statsd-best-practices/
>
> Eloy had a blog about it linked from above page.
>
> Cheers,
> Daniel
>
> On 06.12.17 08:54, Karsten Horsmann wrote:
>
> Hello List,
>
> I thought about some kind of Kamailio stats source (like registered users,
> calls active and some other things) to collect them into influx dB and draw
> them with grafana.
>
> How do you solved that?
>
> Timer based routes or statsd or whatever?
>
> Kind regards
> Karsten Horsmann
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20171206/94db3a03/attachment.html>


More information about the sr-users mailing list