Monitoring mod_odbc_cdr
Hello all! I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!! I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks. How to monitor mod_odbc_cdr and prevent risks with its?
it sounds more a lost connection. did you check the FS logs? On 11/16/2018 2:47 AM, morfair@gmail.com wrote:
Hello all!
I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!!
I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks.
How to monitor mod_odbc_cdr and prevent risks with its?
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
These are my notes on how I got it working.. Hope they help! NOTE: I just set it up, but don’t really use. It works, but NOWHERE is a timestamp/date time field!!! I think you just have to play with config and db tables to setup F https://freeswitch.org/confluence/display/FREESWITCH/Using+ODBC+in+the+core // mod-odbc-cdr apt-get install libmyodbc apt-get install freeswitch-mod-odbc-cdr // SETUP odbc.. /etc/odbc.ini for MySQL [cdr] Description=description of your DSN Driver=myodbc_mysql Server=localhost Port=3306 Socket=/var/run/mysqld/mysqld.sock Database=cdr Username=******* Password=******** Option=3 ReadOnly=No Test with isql -v cdr SQL> show tables; +-----------------------------------------------------------------+ | Tables_in_cdr | +-----------------------------------------------------------------+ | cdr_table_a_leg | | cdr_table_b_leg | | cdr_table_both | +-----------------------------------------------------------------+ SQLRowCount returns 3 3 rows fetched SQL> https://asterisk-pbx.ru/wiki/freeswitch/freeswitch-cdr-viewer to get it to connect with the right use, use ... <param name="odbc-dsn" value="cdr:root:passw0rd"/> <configuration name="odbc_cdr.conf" description="ODBC CDR Configuration"> <settings> <param name="odbc-dsn" value="cdr:root:passw0rd"/> <!-- param name="odbc-dsn" value="odbc://cdr"/ --> <!-- global value can be "a-leg", "b-leg", "both" (default is "both") --> <param name="log-leg" value="both"/> <!-- value can be "always", "never", "on-db-fail" --> <param name="write-csv" value="on-db-fail"/> <!-- location to store csv copy of CDR --> <param name="csv-path" value="/var/log/freeswitch/odbc_cdr"/> <!-- if "csv-path-on-fail" is set, failed INSERTs will be placed here as CSV files otherwise they will be placed in "csv-path" --> <param name="csv-path-on-fail" value="/var/log/freeswitch/odbc_cdr/failed"/> <!-- dump SQL statement after leg ends --> <param name="debug-sql" value="true"/> </settings> <tables> <!-- only a-legs will be inserted into this table --> <table name="cdr_table_a_leg" log-leg="a-leg"> <field name="CallId" chan-var-name="call_uuid"/> <field name="orig_id" chan-var-name="uuid"/> <field name="term_id" chan-var-name="sip_call_id"/> <field name="ClientId" chan-var-name="uuid"/> <field name="IP" chan-var-name="sip_network_ip"/> <field name="IPInternal" chan-var-name="sip_via_host"/> <field name="CODEC" chan-var-name="read_codec"/> <field name="directGateway" chan-var-name="sip_req_host"/> <field name="redirectGateway" chan-var-name="sip_redirect_contact_host_0"/> <field name="CallerID" chan-var-name="sip_from_user"/> <field name="TelNumber" chan-var-name="sip_req_user"/> <field name="TelNumberFull" chan-var-name="sip_to_user"/> <field name="sip_endpoint_disposition" chan-var-name="endpoint_disposition"/> <field name="sip_current_application" chan-var-name="current_application"/> </table> <!-- only b-legs will be inserted into this table --> <table name="cdr_table_b_leg" log-leg="b-leg"> <field name="CallId" chan-var-name="call_uuid"/> <field name="orig_id" chan-var-name="uuid"/> <field name="term_id" chan-var-name="sip_call_id"/> <field name="ClientId" chan-var-name="uuid"/> <field name="IP" chan-var-name="sip_network_ip"/> <field name="IPInternal" chan-var-name="sip_via_host"/> <field name="CODEC" chan-var-name="read_codec"/> <field name="directGateway" chan-var-name="sip_req_host"/> <field name="redirectGateway" chan-var-name="sip_redirect_contact_host_0"/> <field name="CallerID" chan-var-name="sip_from_user"/> <field name="TelNumber" chan-var-name="sip_req_user"/> <field name="TelNumberFull" chan-var-name="sip_to_user"/> <field name="sip_endpoint_disposition" chan-var-name="endpoint_disposition"/> <field name="sip_current_application" chan-var-name="current_application"/> </table> <!-- both legs will be inserted into this table --> <table name="cdr_table_both"> <field name="CallId" chan-var-name="uuid"/> <field name="orig_id" chan-var-name="Caller-Unique-ID"/> <field name="TEST_id" chan-var-name="sip_from_uri"/> </table> </tables> </configuration> -----Original Message----- From: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> On Behalf Of morfair@gmail.com Sent: venerdì 16 novembre 2018 11:47 To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Subject: [Freeswitch-users] Monitoring mod_odbc_cdr Hello all! I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!! I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks. How to monitor mod_odbc_cdr and prevent risks with its? _________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
you can 1) count call in database for last 12 hours using monitoring tools like zabbix. If no calls then rise alarm; 2) configure saving CDR in XML or JSON format on disk. if call is lost in CSL database, then you cann load from CDR files. CDR files older then 2 days may be deleted. пт, 16 нояб. 2018 г. в 16:18, morfair@gmail.com <morfair@gmail.com>:
Hello all!
I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!!
I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks.
How to monitor mod_odbc_cdr and prevent risks with its?
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
Hello, on the odbc_cdr.conf.xml, maybe you can configure: <param name="write-csv" value="on-db-fail"/> <param name="csv-path" value="/var/log/freeswitch/cdr-csv"/> <!--<param name="csv-path-on-fail" value="/usr/local/freeswitch/log/odbc_cdr/failed"/>--> so if database fail you ha ve a file for each call you can process to add to your tables. Regards --- I'm SoCIaL, MayBe El 16/11/2018 a las 08:24, Sergey Safarov escribió:
you can 1) count call in database for last 12 hours using monitoring tools like zabbix. If no calls then rise alarm; 2) configure saving CDR in XML or JSON format on disk. if call is lost in CSL database, then you cann load from CDR files. CDR files older then 2 days may be deleted.
пт, 16 нояб. 2018 г. в 16:18, morfair@gmail.com <mailto:morfair@gmail.com> <morfair@gmail.com <mailto:morfair@gmail.com>>:
Hello all!
I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!!
I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks.
How to monitor mod_odbc_cdr and prevent risks with its?
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com <mailto:sales@freeswitch.com> https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
You NEVER EVER rely on server (freeswitch|asterisk|sipproxy|etc) database connection for accounting and billing. You want to write CDRs on a reliable support, then (maybe even in semirealtime) you use CDRs as input for accounting/billing. If you have advanced needs you can use advanced (and reliable) systems like http://www.cgrates.org/ -giovanni On Fri, Nov 16, 2018 at 8:35 PM Social Boh <social@bohboh.info> wrote:
Hello,
on the odbc_cdr.conf.xml, maybe you can configure:
<param name="write-csv" value="on-db-fail"/> <param name="csv-path" value="/var/log/freeswitch/cdr-csv"/> <!--<param name="csv-path-on-fail" value="/usr/local/freeswitch/log/odbc_cdr/failed"/>-->
so if database fail you ha ve a file for each call you can process to add to your tables.
Regards
--- I'm SoCIaL, MayBe
El 16/11/2018 a las 08:24, Sergey Safarov escribió:
you can 1) count call in database for last 12 hours using monitoring tools like zabbix. If no calls then rise alarm; 2) configure saving CDR in XML or JSON format on disk. if call is lost in CSL database, then you cann load from CDR files. CDR files older then 2 days may be deleted.
пт, 16 нояб. 2018 г. в 16:18, morfair@gmail.com <morfair@gmail.com>:
Hello all!
I use mod_odbc_cdr for store CDR in MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!!
I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks.
How to monitor mod_odbc_cdr and prevent risks with its?
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Servicessales@freeswitch.comhttps://freeswitch.com
Official FreeSWITCH Siteshttps://freeswitch.com/osshttps://freeswitch.org/confluencehttps://cluecon.c...
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttps://freeswit...
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- Sincerely,
Giovanni Maruzzelli OpenTelecom.IT cell: +39 347 266 56 18
participants (6)
-
Francesco Facco de Lagarda
-
Giovanni Maruzzelli
-
Madovsky
-
morfair@gmail.com
-
Sergey Safarov
-
Social Boh