summaryrefslogtreecommitdiff
path: root/ot_stats.c
diff options
context:
space:
mode:
authorerdgeist <>2007-12-04 23:57:29 +0000
committererdgeist <>2007-12-04 23:57:29 +0000
commit31d876d53dfdafc4370b7c23febbb6978b271a77 (patch)
tree8ccc3959e75f5e61c5bf4acd6f96367c8793afca /ot_stats.c
parenta146a328856a1f8b5099064f0262a34d5623021b (diff)
Count invalid requests
Diffstat (limited to 'ot_stats.c')
-rw-r--r--ot_stats.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ot_stats.c b/ot_stats.c
index e682599..32dcc91 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -37,6 +37,7 @@ static unsigned long long ot_overall_udp_connects = 0;
37static unsigned long long ot_full_scrape_count = 0; 37static unsigned long long ot_full_scrape_count = 0;
38static unsigned long long ot_full_scrape_request_count = 0; 38static unsigned long long ot_full_scrape_request_count = 0;
39static unsigned long long ot_full_scrape_size = 0; 39static unsigned long long ot_full_scrape_size = 0;
40static unsigned long long ot_failed_request_counts[CODE_HTTPERROR_COUNT];
40 41
41static time_t ot_start_time; 42static time_t ot_start_time;
42 43
@@ -263,6 +264,12 @@ static size_t stats_peers_mrtg( char * reply ) {
263 ); 264 );
264} 265}
265 266
267static size_t stats_httperrors_txt ( char * reply ) {
268 return sprintf( reply, "400 ... %llu\n400 PAR %llu\n400 COM %llu\n403 IP %llu\n404 INV %llu\n500 SRV %llu\n",
269 ot_failed_request_counts[0], ot_failed_request_counts[1], ot_failed_request_counts[2],
270 ot_failed_request_counts[3], ot_failed_request_counts[4], ot_failed_request_counts[5]);
271}
272
266size_t return_stats_for_tracker( char *reply, int mode, int format ) { 273size_t return_stats_for_tracker( char *reply, int mode, int format ) {
267 format = format; 274 format = format;
268 switch( mode ) { 275 switch( mode ) {
@@ -282,6 +289,8 @@ size_t return_stats_for_tracker( char *reply, int mode, int format ) {
282 return stats_top5_txt( reply ); 289 return stats_top5_txt( reply );
283 case TASK_STATS_FULLSCRAPE: 290 case TASK_STATS_FULLSCRAPE:
284 return stats_fullscrapes_mrtg( reply ); 291 return stats_fullscrapes_mrtg( reply );
292 case TASK_STATS_HTTPERRORS:
293 return stats_httperrors_txt( reply );
285 default: 294 default:
286 return 0; 295 return 0;
287 } 296 }
@@ -317,7 +326,10 @@ void stats_issue_event( ot_status_event event, int is_tcp, size_t event_data ) {
317 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE GZIP\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] ); 326 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE GZIP\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] );
318 ot_full_scrape_request_count++; 327 ot_full_scrape_request_count++;
319 } 328 }
320 break; 329 break;
330 case EVENT_FAILED:
331 ot_failed_request_counts[event_data]++;
332 break;
321 case EVENT_SYNC_IN_REQUEST: 333 case EVENT_SYNC_IN_REQUEST:
322 case EVENT_SYNC_IN: 334 case EVENT_SYNC_IN:
323 case EVENT_SYNC_OUT_REQUEST: 335 case EVENT_SYNC_OUT_REQUEST: