Browse code

new stats table introduced; filter_log for searching messages by RegExp in ngrep logs introduced

Jiri Kuthan authored on 30/06/2003 11:56:47
Showing 2 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,58 @@
1
+#!/bin/sh
2
+#
3
+# $Id$
4
+#
5
+# tool for filtering SIP messages from log by a RegExp
6
+#
7
+# Example of use: ./filter_msg.sh /var/log/sip/sip.1056844800 'CallId: abc'
8
+#
9
+
10
+
11
+#####################
12
+
13
+usage()
14
+{
15
+	echo "Usage: $0 <filename> <RegExp>"
16
+}
17
+
18
+if [ "$#" -ne 2 ] ; then
19
+	usage
20
+	exit
21
+fi
22
+
23
+AWK_PG='
24
+BEGIN {
25
+	IGNORECASE=1;
26
+	line=0;
27
+	msg_match=0;
28
+}
29
+
30
+/^#$/ {
31
+	line=0
32
+	msg_match=0
33
+	next
34
+}
35
+
36
+msg_match==1 {
37
+	print
38
+	next
39
+}
40
+
41
+{ 
42
+	if (match($0, RE)) {
43
+		msg_match=1;
44
+		# dump all accumulated lines here
45
+		for (i=1; i<=line; i++) print buffer[i];
46
+		print
47
+		next
48
+	}
49
+	# there are still chances for a match in following lines;
50
+	# keep buffering this request
51
+	line++
52
+	buffer[line]=$0
53
+}
54
+
55
+'
56
+
57
+
58
+cat $1 | awk "$AWK_PG" RE="$2"
... ...
@@ -200,7 +200,7 @@ INSERT INTO version VALUES ( 'realm', '1');
200 200
 INSERT INTO version VALUES ( 'domain', '1');
201 201
 INSERT INTO version VALUES ( 'uri', '1');
202 202
 INSERT INTO version VALUES ( 'server_monitoring', '1');
203
-INSERT INTO version VALUES ( 'server_monitoring_ul', '1');
203
+INSERT INTO version VALUES ( 'server_monitoring_agg', '1');
204 204
 
205 205
 
206 206
 #
... ...
@@ -491,58 +491,40 @@ CREATE TABLE uri (
491 491
 #
492 492
 
493 493
 
494
+DROP TABLE IF EXISTS server_monitoring;
494 495
 CREATE TABLE server_monitoring (
495 496
   time datetime NOT NULL default '0000-00-00 00:00:00',
496
-  ts_current int(10) unsigned default NULL,
497
-  ts_waiting int(10) unsigned default NULL,
498
-  ts_total int(10) unsigned default NULL,
499
-  ts_total_local int(10) unsigned default NULL,
500
-  ts_replied int(10) unsigned default NULL,
501
-  ts_6xx int(10) unsigned default NULL,
502
-  ts_5xx int(10) unsigned default NULL,
503
-  ts_4xx int(10) unsigned default NULL,
504
-  ts_3xx int(10) unsigned default NULL,
505
-  ts_2xx int(10) unsigned default NULL,
506
-  sl_200 int(10) unsigned default NULL,
507
-  sl_202 int(10) unsigned default NULL,
508
-  sl_2xx int(10) unsigned default NULL,
509
-  sl_300 int(10) unsigned default NULL,
510
-  sl_301 int(10) unsigned default NULL,
511
-  sl_302 int(10) unsigned default NULL,
512
-  sl_3xx int(10) unsigned default NULL,
513
-  sl_400 int(10) unsigned default NULL,
514
-  sl_401 int(10) unsigned default NULL,
515
-  sl_403 int(10) unsigned default NULL,
516
-  sl_404 int(10) unsigned default NULL,
517
-  sl_407 int(10) unsigned default NULL,
518
-  sl_408 int(10) unsigned default NULL,
519
-  sl_483 int(10) unsigned default NULL,
520
-  sl_4xx int(10) unsigned default NULL,
521
-  sl_500 int(10) unsigned default NULL,
522
-  sl_5xx int(10) unsigned default NULL,
523
-  sl_6xx int(10) unsigned default NULL,
524
-  sl_xxx int(10) unsigned default NULL,
525
-  sl_failures int(10) unsigned default NULL,
526
-  PRIMARY KEY  (time)
497
+  id int(10) unsigned NOT NULL default '0',
498
+  param varchar(32) NOT NULL default '',
499
+  value int(10) NOT NULL default '0',
500
+  increment int(10) NOT NULL default '0',
501
+  PRIMARY KEY  (id,param)
527 502
 ) $TABLE_TYPE;
528 503
 
529 504
 
530
-
531
-
532 505
 #
533
-# Table structure for table 'server_monitoring_ul'
506
+# Table structure for table 'server_monitoring_agg'
534 507
 #
535 508
 
536 509
 
537
-CREATE TABLE server_monitoring_ul (
538
-  time datetime NOT NULL default '0000-00-00 00:00:00',
539
-  domain varchar(64) NOT NULL default '',
540
-  registered int(10) unsigned default NULL,
541
-  expired int(10) unsigned default NULL,
542
-  PRIMARY KEY  (domain,time)
510
+DROP TABLE IF EXISTS server_monitoring_agg;
511
+CREATE TABLE server_monitoring_agg (
512
+  param varchar(32) NOT NULL default '',
513
+  s_value int(10) NOT NULL default '0',
514
+  s_increment int(10) NOT NULL default '0',
515
+  last_aggregated_increment int(10) NOT NULL default '0',
516
+  av float NOT NULL default '0',
517
+  mv int(10) NOT NULL default '0',
518
+  ad float NOT NULL default '0',
519
+  lv int(10) NOT NULL default '0',
520
+  min_val int(10) NOT NULL default '0',
521
+  max_val int(10) NOT NULL default '0',
522
+  min_inc int(10) NOT NULL default '0',
523
+  max_inc int(10) NOT NULL default '0',
524
+  lastupdate datetime NOT NULL default '0000-00-00 00:00:00',
525
+  PRIMARY KEY  (param)
543 526
 ) $TABLE_TYPE;
544 527
 
545
-
546 528
 # add an admin user "admin" with password==heslo, 
547 529
 # so that one can try it out on quick start
548 530