Re: DLR counters on the status page
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Alex,
I changed your patch a bit. I hope that it would me more clear for users what the all counters means.
New patch attached...
Please let me know what you think?
Here examples:
TXT:
Status: running, uptime 0d 0h 0m 9s
WDP: received 0 (0 queued), sent 0 (0 queued)
SMS: received 0 (0 queued), sent 0 (0 queued), store size -1
SMS: inbound (0.00,0.00,0.00) msg/sec, outbound (0.00,0.00,0.00) msg/sec
DLR: received 0, sent 0
DLR: inbound (0.00,0.00,0.00) msg/sec, outbound (0.00,0.00,0.00) msg/sec
DLR: 0 queued, using internal storage
No boxes connected
SMSC connections:
FAKE[FAKE] FAKE:20000 (connecting, rcvd: sms 0 / dlr 0, sent: sms 0 / dlr 0, failed 0, queued 0 msgs)
XML:
<?xml version="1.0"?>
<gateway>
<status>running, uptime 0d 0h 0m 35s</status>
<wdp>
<received><total>0</total><queued>0</queued></received>
<sent><total>0</total><queued>0</queued></sent>
</wdp>
<sms>
<received><total>0</total><queued>0</queued></received>
<sent><total>0</total><queued>0</queued></sent>
<storesize>-1</storesize>
<inbound>0.00,0.00,0.00</inbound>
<outbound>0.00,0.00,0.00</outbound>
</sms>
<dlr>
<received><total>0</total></received>
<sent><total>0</total></sent>
<inbound>0.00,0.00,0.00</inbound>
<outbound>0.00,0.00,0.00</outbound>
<queued>0</queued>
<storage>internal</storage>
</dlr>
<boxes>
</boxes>
<smscs><count>1</count>
<smsc>
<name>FAKE:20000</name>
<admin-id>FAKE</admin-id>
<id>FAKE</id>
<status>connecting</status>
<received><sms>0</sms><dlr>0</dlr></received>
<sent><sms>0</sms><dlr>0</dlr></sent>
<failed>0</failed>
<queued>0</queued>
</smsc>
</smscs>
</gateway>
Am 11.11.2009 um 14:27 schrieb Alejandro Guerrieri:
> Please see attached. I'm adding the patch for the kannel-monitor later.
>
> Regards,
> --
> Alejandro Guerrieri
> [email protected]
>
>
> <kannel-dlr-status-v2.diff.zip>
>
> On 11/11/2009, at 12:33, Alexander Malysh wrote:
>
>>
>> Am 11.11.2009 um 12:09 schrieb Alejandro Guerrieri:
>>
>>> Ok, so you'd like the patch to transparently handle the concept of "outgoing" dlrs?
>>
>> yes that would be great... This is 5 minutes patch :)
>>
>>>
>>> It would be useless on many drivers where Kannel's acting as a "client" only (SMPP for instance) but yes, on HTTP and derivatives would make sense.
>>>
>>> Regards,
>>> --
>>> Alejandro Guerrieri
>>> [email protected]
>>>
>>>
>>>
>>> On 11/11/2009, at 11:42, Alexander Malysh wrote:
>>>
>>>>
>>>> Am 11.11.2009 um 11:38 schrieb Alejandro Guerrieri:
>>>>
>>>>> Alex,
>>>>>
>>>>> Outgoing DLR's? At least on SMPP, there's not such a thing: when you submit an MT with dlr-mask/dlr-url set, the submit_sm PDU has the delivery receipt flag set. When the message is accepted (the SMSC sends a submit_sm_resp), kannel creates a first incoming DLR and later on the SMSC sends one incoming (deliver_sm) DLR (or more, if intermediate DLR's are enabled) with the message status(es).
>>>>>
>>>>> What do you mean with "outgoing DLR's" ?
>>>>
>>>> at least for HTTP smsc we can implement DLR forwarding...
>>>>
>>>>>
>>>>> Regards,
>>>>> --
>>>>> Alejandro Guerrieri
>>>>> [email protected]
>>>>>
>>>>>
>>>>>
>>>>> On 11/11/2009, at 9:36, Alexander Malysh wrote:
>>>>>
>>>>>> Hi Alex,
>>>>>>
>>>>>> I think we have to expand this patch to handle incoming and outgoing DLRs.
>>>>>> Now we don't differentiate DLRs from SMS traffic and therefore this is not a issue.
>>>>>> But if we start to differentiate DLRs from SMS we need to split it to incoming/outgoing
>>>>>> the same as for SMS traffic.
>>>>>>
>>>>>> Thanks,
>>>>>> Alexander Malysh
>>>>>>
>>>>>> Am 11.11.2009 um 08:13 schrieb Alejandro Guerrieri:
>>>>>>
>>>>>>> Any objections? Can I commit?
>>>>>>>
>>>>>>> Regards,
>>>>>>> --
>>>>>>> Alejandro Guerrieri
>>>>>>> [email protected]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 10/11/2009, at 15:46, Stipe Tolj wrote:
>>>>>>>
>>>>>>>> Alejandro Guerrieri schrieb:
>>>>>>>>> This patch adds separate dlr counters on the status page. This is much
>>>>>>>>> clearer than now imho, where we have dlr's and mo's mixed on the same
>>>>>>>>> counter.
>>>>>>>>>
>>>>>>>>> For example:
>>>>>>>>>
>>>>>>>>> ...
>>>>>>>>>
>>>>>>>>> SMS: inbound (0.00,0.00,0.00) msg/sec, *dlr (0.23,0.12,0.12) msg/sec*,
>>>>>>>>> outbound (0.12,0.06,0.06) msg/sec
>>>>>>>>>
>>>>>>>>> ...
>>>>>>>>>
>>>>>>>>> SMSC connections:
>>>>>>>>>
>>>>>>>>> *fake*[fake] FAKE:10000 (online 109s, rcvd 0, *dlr 14*, sent 7,
>>>>>>>>> failed 0, queued 0 msgs)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> http://www.blogalex.com/archives/222
>>>>>>>>
>>>>>>>> yep, I'm in... +0 from my side.
>>>>>>>>
>>>>>>>> Stipe
>>>>>>>>
>>>>>>>> --
>>>>>>>> -------------------------------------------------------------------
>>>>>>>> Kölner Landstrasse 419
>>>>>>>> 40589 Düsseldorf, NRW, Germany
>>>>>>>>
>>>>>>>> tolj.org system architecture Kannel Software Foundation (KSF)
>>>>>>>> http://www.tolj.org/ http://www.kannel.org/
>>>>>>>>
>>>>>>>> mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org
>>>>>>>> -------------------------------------------------------------------
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
dlr_status.diff
(application/octet-stream, 12.3 KB)
diff --git a/gw/bb_smscconn.c b/gw/bb_smscconn.c
index 559222d..d7ce0c7 100644
--- a/gw/bb_smscconn.c
+++ b/gw/bb_smscconn.c
@@ -102,9 +102,13 @@ extern List *outgoing_sms;
extern Counter *incoming_sms_counter;
extern Counter *outgoing_sms_counter;
+extern Counter *incoming_dlr_counter;
+extern Counter *outgoing_dlr_counter;
extern Load *outgoing_sms_load;
extern Load *incoming_sms_load;
+extern Load *incoming_dlr_load;
+extern Load *outgoing_dlr_load;
extern List *flow_threads;
extern List *suspended;
@@ -261,15 +265,21 @@ void bb_smscconn_sent(SMSCConn *conn, Msg *sms, Octstr *reply)
octstr_destroy(reply);
return;
}
-
- counter_increase(outgoing_sms_counter);
- load_increase(outgoing_sms_load);
- if (conn) counter_increase(conn->sent);
/* write ACK to store file */
store_save_ack(sms, ack_success);
- bb_alog_sms(conn, sms, "Sent SMS");
+ if (sms->sms.sms_type != report_mt) {
+ bb_alog_sms(conn, sms, "Sent SMS");
+ counter_increase(outgoing_sms_counter);
+ load_increase(outgoing_sms_load);
+ if (conn) counter_increase(conn->sent);
+ } else {
+ bb_alog_sms(conn, sms, "Sent DLR");
+ counter_increase(outgoing_dlr_counter);
+ load_increase(outgoing_dlr_load);
+ if (conn) counter_increase(conn->sent_dlr);
+ }
/* generate relay confirmancy message */
if (DLR_IS_SMSC_SUCCESS(sms->sms.dlr_mask)) {
@@ -495,14 +505,17 @@ long bb_smscconn_receive(SMSCConn *conn, Msg *sms)
return (rc == -1 ? SMSCCONN_FAILED_QFULL : rc);
}
- if (sms->sms.sms_type != report_mo)
- bb_alog_sms(conn, sms, "Receive SMS");
- else
- bb_alog_sms(conn, sms, "Receive DLR");
-
- counter_increase(incoming_sms_counter);
- load_increase(incoming_sms_load);
- if (conn != NULL) counter_increase(conn->received);
+ if (sms->sms.sms_type != report_mo) {
+ bb_alog_sms(conn, sms, "Receive SMS");
+ counter_increase(incoming_sms_counter);
+ load_increase(incoming_sms_load);
+ if (conn != NULL) counter_increase(conn->received);
+ } else {
+ bb_alog_sms(conn, sms, "Receive DLR");
+ counter_increase(incoming_dlr_counter);
+ load_increase(incoming_dlr_load);
+ if (conn != NULL) counter_increase(conn->received_dlr);
+ }
msg_destroy(sms);
@@ -1132,15 +1145,17 @@ Octstr *smsc2_status(int status_type)
}
if (status_type == BBSTATUS_XML)
- octstr_format_append(tmp, "<status>%s</status>\n\t\t<received>%ld</received>"
- "\n\t\t<sent>%ld</sent>\n\t\t<failed>%ld</failed>\n\t\t"
+ octstr_format_append(tmp, "<status>%s</status>\n\t\t"
+ "<received><sms>%ld</sms><dlr>%ld</dlr></received>\n\t\t"
+ "<sent><sms>%ld</sms><dlr>%ld</dlr></sent>\n\t\t"
+ "<failed>%ld</failed>\n\t\t"
"<queued>%ld</queued>\n\t</smsc>\n", tmp3,
- info.received, info.sent, info.failed,
+ info.received, info.received_dlr, info.sent, info.sent_dlr, info.failed,
info.queued);
else
- octstr_format_append(tmp, " (%s, rcvd %ld, sent %ld, failed %ld, "
+ octstr_format_append(tmp, " (%s, rcvd: sms %ld / dlr %ld, sent: sms %ld / dlr %ld, failed %ld, "
"queued %ld msgs)%s", tmp3,
- info.received, info.sent, info.failed,
+ info.received, info.received_dlr, info.sent, info.sent_dlr, info.failed,
info.queued, lb);
}
gw_rwlock_unlock(&smsc_list_lock);
diff --git a/gw/bearerbox.c b/gw/bearerbox.c
index 07a5644..2175222 100644
--- a/gw/bearerbox.c
+++ b/gw/bearerbox.c
@@ -89,6 +89,8 @@ List *outgoing_wdp;
Counter *incoming_sms_counter;
Counter *outgoing_sms_counter;
+Counter *incoming_dlr_counter;
+Counter *outgoing_dlr_counter;
Counter *incoming_wdp_counter;
Counter *outgoing_wdp_counter;
@@ -99,6 +101,8 @@ long max_outgoing_sms_qlength;
Load *outgoing_sms_load;
Load *incoming_sms_load;
+Load *incoming_dlr_load;
+Load *outgoing_dlr_load;
/* this is not a list of items; instead it is used as
@@ -457,6 +461,8 @@ static Cfg *init_bearerbox(Cfg *cfg)
outgoing_sms_counter = counter_create();
incoming_sms_counter = counter_create();
+ incoming_dlr_counter = counter_create();
+ outgoing_dlr_counter = counter_create();
outgoing_wdp_counter = counter_create();
incoming_wdp_counter = counter_create();
@@ -472,6 +478,16 @@ static Cfg *init_bearerbox(Cfg *cfg)
load_add_interval(incoming_sms_load, 60);
load_add_interval(incoming_sms_load, 300);
load_add_interval(incoming_sms_load, -1);
+ incoming_dlr_load = load_create();
+ /* add 60,300,-1 entries to dlr */
+ load_add_interval(incoming_dlr_load, 60);
+ load_add_interval(incoming_dlr_load, 300);
+ load_add_interval(incoming_dlr_load, -1);
+ outgoing_dlr_load = load_create();
+ /* add 60,300,-1 entries to dlr */
+ load_add_interval(outgoing_dlr_load, 60);
+ load_add_interval(outgoing_dlr_load, 300);
+ load_add_interval(outgoing_dlr_load, -1);
setup_signal_handlers();
@@ -556,19 +572,25 @@ static void empty_msg_lists(void)
debug("bb", 0, "Remaining SMS: %ld incoming, %ld outgoing",
gwlist_len(incoming_sms), gwlist_len(outgoing_sms));
- info(0, "Total SMS messages: received %ld, sent %ld",
+ info(0, "Total SMS messages: received %ld, dlr %ld, sent %ld, dlr %ld",
counter_value(incoming_sms_counter),
- counter_value(outgoing_sms_counter));
+ counter_value(incoming_dlr_counter),
+ counter_value(outgoing_sms_counter),
+ counter_value(outgoing_dlr_counter));
#endif
gwlist_destroy(incoming_sms, msg_destroy_item);
gwlist_destroy(outgoing_sms, msg_destroy_item);
counter_destroy(incoming_sms_counter);
+ counter_destroy(incoming_dlr_counter);
counter_destroy(outgoing_sms_counter);
+ counter_destroy(outgoing_dlr_counter);
load_destroy(incoming_sms_load);
+ load_destroy(incoming_dlr_load);
load_destroy(outgoing_sms_load);
+ load_destroy(outgoing_dlr_load);
}
@@ -876,9 +898,12 @@ Octstr *bb_print_status(int status_type)
" <p>WDP: received %ld (%ld queued), sent %ld "
"(%ld queued)</p>\n\n"
" <p>SMS: received %ld (%ld queued), sent %ld "
- "(%ld queued), store size %ld</p>\n"
- " <p>SMS: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
- " <p>DLR: %ld queued, using %s storage</p>\n\n";
+ "(%ld queued), store size %ld<br>\n"
+ " SMS: inbound (%.2f,%.2f,%.2f) msg/sec, "
+ "outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
+ " <p>DLR: received %ld, sent %ld<br>\n"
+ " DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec<br>\n"
+ " DLR: %ld queued, using %s storage</p>\n\n";
footer = "<p>";
} else if (status_type == BBSTATUS_WML) {
frmt = "%s</p>\n\n"
@@ -889,8 +914,12 @@ Octstr *bb_print_status(int status_type)
" SMS: sent %ld (%ld queued)<br/>\n"
" SMS: store size %ld<br/>\n"
" SMS: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"
- " SMS: outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
- " <p>DLR: %ld queued<br/>\n"
+ " SMS: outbound (%.2f,%.2f,%.2f) msg/sec</p>\n"
+ " <p>DLR: received %ld<br/>\n"
+ " DLR: sent %ld<br/>\n"
+ " DLR: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"
+ " DLR: outbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"
+ " DLR: %ld queued<br/>\n"
" DLR: using %s storage</p>\n\n";
footer = "<p>";
} else if (status_type == BBSTATUS_XML) {
@@ -902,14 +931,23 @@ Octstr *bb_print_status(int status_type)
"\t<sms>\n\t\t<received><total>%ld</total><queued>%ld</queued>"
"</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>"
"</sent>\n\t\t<storesize>%ld</storesize>\n\t\t"
- "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t<outbound>%.2f,%.2f,%.2f</outbound>\n\t</sms>\n"
- "\t<dlr>\n\t\t<queued>%ld</queued>\n\t\t<storage>%s</storage>\n\t</dlr>\n";
+ "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t"
+ "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t"
+ "</sms>\n"
+ "\t<dlr>\n\t\t<received><total>%ld</total></received>\n\t\t"
+ "<sent><total>%ld</total></sent>\n\t\t"
+ "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t"
+ "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t"
+ "<queued>%ld</queued>\n\t\t<storage>%s</storage>\n\t</dlr>\n";
footer = "";
} else {
frmt = "%s\n\nStatus: %s, uptime %ldd %ldh %ldm %lds\n\n"
"WDP: received %ld (%ld queued), sent %ld (%ld queued)\n\n"
"SMS: received %ld (%ld queued), sent %ld (%ld queued), store size %ld\n"
- "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n\n"
+ "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, "
+ "outbound (%.2f,%.2f,%.2f) msg/sec\n\n"
+ "DLR: received %ld, sent %ld\n"
+ "DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n"
"DLR: %ld queued, using %s storage\n\n";
footer = "";
}
@@ -925,6 +963,9 @@ Octstr *bb_print_status(int status_type)
store_messages(),
load_get(incoming_sms_load,0), load_get(incoming_sms_load,1), load_get(incoming_sms_load,2),
load_get(outgoing_sms_load,0), load_get(outgoing_sms_load,1), load_get(outgoing_sms_load,2),
+ counter_value(incoming_dlr_counter), counter_value(outgoing_dlr_counter),
+ load_get(incoming_dlr_load,0), load_get(incoming_dlr_load,1), load_get(incoming_dlr_load,2),
+ load_get(outgoing_dlr_load,0), load_get(outgoing_dlr_load,1), load_get(outgoing_dlr_load,2),
dlr_messages(), dlr_type());
octstr_destroy(version);
diff --git a/gw/smscconn.c b/gw/smscconn.c
index a5d30c3..a8e12a8 100644
--- a/gw/smscconn.c
+++ b/gw/smscconn.c
@@ -170,7 +170,9 @@ SMSCConn *smscconn_create(CfgGroup *grp, int start_as_stopped)
conn->is_stopped = start_as_stopped;
conn->received = counter_create();
+ conn->received_dlr = counter_create();
conn->sent = counter_create();
+ conn->sent_dlr = counter_create();
conn->failed = counter_create();
conn->flow_mutex = mutex_create();
@@ -334,7 +336,9 @@ int smscconn_destroy(SMSCConn *conn)
mutex_lock(conn->flow_mutex);
counter_destroy(conn->received);
+ counter_destroy(conn->received_dlr);
counter_destroy(conn->sent);
+ counter_destroy(conn->sent_dlr);
counter_destroy(conn->failed);
octstr_destroy(conn->name);
@@ -599,6 +603,8 @@ int smscconn_info(SMSCConn *conn, StatusInfo *infotable)
infotable->sent = counter_value(conn->sent);
infotable->received = counter_value(conn->received);
+ infotable->sent_dlr = counter_value(conn->sent_dlr);
+ infotable->received_dlr = counter_value(conn->received_dlr);
infotable->failed = counter_value(conn->failed);
if (conn->queued)
diff --git a/gw/smscconn.h b/gw/smscconn.h
index c11e5c3..f011951 100644
--- a/gw/smscconn.h
+++ b/gw/smscconn.h
@@ -114,7 +114,9 @@ typedef struct smsc_state {
smscconn_killed_t killed; /* if we are killed, why */
int is_stopped; /* is connection currently in stopped state? */
unsigned long received; /* total number */
+ unsigned long received_dlr; /* total number */
unsigned long sent; /* total number */
+ unsigned long sent_dlr; /* total number */
unsigned long failed; /* total number */
long queued; /* set our internal outgoing queue length */
long online; /* in seconds */
diff --git a/gw/smscconn_p.h b/gw/smscconn_p.h
index d6cc3ed..ee0a2e6 100644
--- a/gw/smscconn_p.h
+++ b/gw/smscconn_p.h
@@ -159,7 +159,9 @@ struct smscconn {
/* connection specific counters (created in smscconn.c, updated
* by callback functions in bb_smscconn.c, NOT used by specific driver) */
Counter *received;
+ Counter *received_dlr;
Counter *sent;
+ Counter *sent_dlr;
Counter *failed;
/* SMSCConn variables set in smscconn.c */