Browse code

etc: cleaned up folder, moving unused files to examples

Daniel-Constantin Mierla authored on 14/03/2014 18:59:02
Showing 1 changed files
1 1
deleted file mode 100755
... ...
@@ -1,137 +0,0 @@
1
-#!/bin/sh 
2
-#
3
-# $Id$
4
-#
5
-# PLEASE configure before use !!!
6
-#
7
-# This script uses sipsak (http://sipsak.berlios.de) to test if a
8
-# SIP server is still responding to requests and will send messages
9
-# to the developers. It is configured for the iptel.org enviroment.
10
-# PLEASE adapt it to your local enviroment.
11
-#
12
-
13
-NOTIFY=sr@iptel.org
14
-SIPSAK=/home/srouter/sipsak/sipsak
15
-SIPURI=sip:sipsak@iptel.org
16
-LOCKDIR=/var/lock
17
-LOCKFILE=serresponse
18
-LOCK_TIMEOUT=240
19
-TMP=/tmp/serresponse.$$
20
-MAILCOMMAND=/bin/mail
21
-HOSTN=`hostname`
22
-RUNHOST=iptel.org
23
-SMSSEND=/home/sms/smstools/bin/putsms
24
-SMSDEVICE=/dev/ttyS0
25
-SMSNUMBERS=""
26
-
27
-############################
28
-
29
-LOCKF=$LOCKDIR/$LOCKFILE
30
-TMP2=$TMP.dns
31
-TMP3=$TMP.ips
32
-SIPSAKCMD="$SIPSAK -v -s $SIPURI"
33
-SIPSAKNCMD="$SIPSAK -v -n -s $SIPURI"
34
-SMSCMD="$SMSSEND -d$SMSDEVICE -b9600"
35
-
36
-if [ -e $LOCKF ] ; then
37
-	find $LOCKDIR -name $LOCKFILE -amin +$LOCK_TIMEOUT -exec rm {} ';'
38
-	if [ ! -e $LOCKF ] ; then
39
-		echo "This is a reminder !!!" > $TMP
40
-		echo "The lockfile $LOCKF" >> $TMP
41
-		echo "was just removed because ist was older then $LOCK_TIMEOUT minutes." >> $TMP
42
-		echo "But if you receive this mail the cause of this error still exists or respawned." >> $TMP
43
-		SERR_SUBJECT="serresponse reminder"
44
-	fi
45
-fi
46
-
47
-if [ ! -e $LOCKF ] ; then
48
-	if [ ! -x $SIPSAK ] ; then
49
-		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
50
-		SERR_SUBJECT="serresponse config failure"
51
-	elif [ ! -x $SMSSEND ]; then
52
-		echo "serresponse did not find the required SMS send executable $SMSSEND" >> $TMP
53
-		SERR_SUBJECT="serresponse config failure"
54
-	else
55
-		date >> $TMP2
56
-		echo "  $SIPSAKCMD" >> $TMP2
57
-		echo "produced this output:" >> $TMP2
58
-		$SIPSAKCMD >> $TMP2 2>&1
59
-		if [ $? -eq 3 ] ; then
60
-			grep -i "Connection refused" $TMP2
61
-			if [ $? -eq 0 ] ; then
62
-				sleep 30
63
-			fi
64
-			date >> $TMP3
65
-			echo "  $SIPSAKNCMD" >> $TMP3
66
-			echo "produced this output:" >> $TMP3
67
-			$SIPSAKNCMD >> $TMP3 2>&1
68
-			if [ $? -le 1 ] ; then
69
-				echo "ser did not responsed (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
70
-				echo "but the test with IPs in Via succeeded." >> $TMP
71
-				echo "" >> $TMP
72
-				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
73
-				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
74
-				echo "$LOCKF @ $HOSTN" >> $TMP
75
-				echo "(you presumably need to be root to do this)" >> $TMP
76
-				echo "" >> $TMP
77
-				echo "Command output of sipsak with fqdn in Via follows:" >> $TMP
78
-				cat $TMP2 >> $TMP
79
-				SERR_SUBJECT="serresponse delayed"
80
-			else
81
-				echo "ser did not responsed (fast enough) on requests with fqdn in Via" >> $TMP
82
-				echo "but also requests with IPs in Via failed." >> $TMP
83
-				echo "" >> $TMP
84
-				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
85
-				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
86
-				echo "$LOCKF @ $HOSTN" >> $TMP
87
-				echo "(you presumably need to be root to do this)" >> $TMP
88
-				echo "" >> $TMP
89
-				echo "First command output with fqdn in Via:" >> $TMP
90
-				cat $TMP2 >> $TMP
91
-				echo "" >> $TMP
92
-				echo "Second command output with IPs in Via:" >> $TMP
93
-				cat $TMP3 >> $TMP
94
-				SERR_SUBJECT="serresponse failed"
95
-			fi
96
-			rm -f $TMP3
97
-			rm -f $TMP2
98
-		elif [ $? -eq 2 ] ; then
99
-			echo "The ser response test failed due to a local error on" >> $TMP
100
-			echo "host $HOSTN ." >> $TMP
101
-			echo "" >> $TMP
102
-			echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
103
-			echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
104
-			echo "$LOCKF @ $HOSTN" >> $TMP
105
-			echo "(you presumably need to be root to do this)" >> $TMP
106
-			echo "" >> $TMP
107
-			echo "Command output of sipsak with fqdn follows:" >> $TMP
108
-			cat $TMP2 >> $TMP
109
-			rm -f $TMP2
110
-			SERR_SUBJECT="serresponse local failure"
111
-		else
112
-			rm -f $TMP2
113
-			rm -f $TMP
114
-		fi
115
-	fi
116
-	
117
-	if [ -e $TMP ] ; then
118
-		if [ $HOSTN = $RUNHOST ] ; then
119
-			$MAILCOMMAND -s "$SERR_SUBJECT" $NOTIFY < $TMP
120
-			rm -f $TMP
121
-			touch $LOCKF
122
-			for i in $SMSNUMBERS; do
123
-				$SMSCMD $i "serresponse failed. please check your emails for details"
124
-			done
125
-		else
126
-			echo "unconfigured serresponse executed on ${HOSTN}." > $TMP
127
-			echo "Warning: This script if configured for the iptel.org enviroment."
128
-			echo "         Please configure it to your local settings first."
129
-			echo
130
-			echo "If you do not press CTRL-C within 2 seconds an informational message"
131
-			echo "with your hostname will be send to the ser developers."
132
-			sleep 2
133
-			$MAILCOMMAND -s "serresponse executed on ${HOSTN}" $NOTIFY < $TMP
134
-			rm -f $TMP
135
-		fi
136
-	fi
137
-fi
Browse code

Fixed a typo in mail subject

Nils Ohlmeier authored on 09/09/2003 00:28:31
Showing 1 changed files
... ...
@@ -116,7 +116,7 @@ if [ ! -e $LOCKF ] ; then
116 116
 	
117 117
 	if [ -e $TMP ] ; then
118 118
 		if [ $HOSTN = $RUNHOST ] ; then
119
-			$MAILCOMMAND -s "$SER_SUBJECT" $NOTIFY < $TMP
119
+			$MAILCOMMAND -s "$SERR_SUBJECT" $NOTIFY < $TMP
120 120
 			rm -f $TMP
121 121
 			touch $LOCKF
122 122
 			for i in $SMSNUMBERS; do
Browse code

Synched with bat version

Nils Ohlmeier authored on 07/09/2003 21:56:10
Showing 1 changed files
... ...
@@ -19,7 +19,7 @@ LOCK_TIMEOUT=240
19 19
 TMP=/tmp/serresponse.$$
20 20
 MAILCOMMAND=/bin/mail
21 21
 HOSTN=`hostname`
22
-RUNHOST=bat.iptel.org
22
+RUNHOST=iptel.org
23 23
 SMSSEND=/home/sms/smstools/bin/putsms
24 24
 SMSDEVICE=/dev/ttyS0
25 25
 SMSNUMBERS=""
... ...
@@ -40,30 +40,33 @@ if [ -e $LOCKF ] ; then
40 40
 		echo "The lockfile $LOCKF" >> $TMP
41 41
 		echo "was just removed because ist was older then $LOCK_TIMEOUT minutes." >> $TMP
42 42
 		echo "But if you receive this mail the cause of this error still exists or respawned." >> $TMP
43
+		SERR_SUBJECT="serresponse reminder"
43 44
 	fi
44 45
 fi
45 46
 
46 47
 if [ ! -e $LOCKF ] ; then
47 48
 	if [ ! -x $SIPSAK ] ; then
48 49
 		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
50
+		SERR_SUBJECT="serresponse config failure"
49 51
 	elif [ ! -x $SMSSEND ]; then
50 52
 		echo "serresponse did not find the required SMS send executable $SMSSEND" >> $TMP
53
+		SERR_SUBJECT="serresponse config failure"
51 54
 	else
52 55
 		date >> $TMP2
53 56
 		echo "  $SIPSAKCMD" >> $TMP2
54 57
 		echo "produced this output:" >> $TMP2
55 58
 		$SIPSAKCMD >> $TMP2 2>&1
56 59
 		if [ $? -eq 3 ] ; then
57
-			grep "Connection refused" $TMP2
60
+			grep -i "Connection refused" $TMP2
58 61
 			if [ $? -eq 0 ] ; then
59
-				sleep 15
62
+				sleep 30
60 63
 			fi
61 64
 			date >> $TMP3
62 65
 			echo "  $SIPSAKNCMD" >> $TMP3
63 66
 			echo "produced this output:" >> $TMP3
64 67
 			$SIPSAKNCMD >> $TMP3 2>&1
65 68
 			if [ $? -le 1 ] ; then
66
-				echo "ser did not responses (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
69
+				echo "ser did not responsed (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
67 70
 				echo "but the test with IPs in Via succeeded." >> $TMP
68 71
 				echo "" >> $TMP
69 72
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
... ...
@@ -73,8 +76,9 @@ if [ ! -e $LOCKF ] ; then
73 76
 				echo "" >> $TMP
74 77
 				echo "Command output of sipsak with fqdn in Via follows:" >> $TMP
75 78
 				cat $TMP2 >> $TMP
79
+				SERR_SUBJECT="serresponse delayed"
76 80
 			else
77
-				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
81
+				echo "ser did not responsed (fast enough) on requests with fqdn in Via" >> $TMP
78 82
 				echo "but also requests with IPs in Via failed." >> $TMP
79 83
 				echo "" >> $TMP
80 84
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
... ...
@@ -87,6 +91,7 @@ if [ ! -e $LOCKF ] ; then
87 91
 				echo "" >> $TMP
88 92
 				echo "Second command output with IPs in Via:" >> $TMP
89 93
 				cat $TMP3 >> $TMP
94
+				SERR_SUBJECT="serresponse failed"
90 95
 			fi
91 96
 			rm -f $TMP3
92 97
 			rm -f $TMP2
... ...
@@ -102,6 +107,7 @@ if [ ! -e $LOCKF ] ; then
102 107
 			echo "Command output of sipsak with fqdn follows:" >> $TMP
103 108
 			cat $TMP2 >> $TMP
104 109
 			rm -f $TMP2
110
+			SERR_SUBJECT="serresponse local failure"
105 111
 		else
106 112
 			rm -f $TMP2
107 113
 			rm -f $TMP
... ...
@@ -110,7 +116,7 @@ if [ ! -e $LOCKF ] ; then
110 116
 	
111 117
 	if [ -e $TMP ] ; then
112 118
 		if [ $HOSTN = $RUNHOST ] ; then
113
-			$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
119
+			$MAILCOMMAND -s "$SER_SUBJECT" $NOTIFY < $TMP
114 120
 			rm -f $TMP
115 121
 			touch $LOCKF
116 122
 			for i in $SMSNUMBERS; do
Browse code

- Added check for the running host - Added check for the SMS send program - Removed Jiri's mobile phone number

Nils Ohlmeier authored on 24/11/2002 17:56:05
Showing 1 changed files
... ...
@@ -2,9 +2,13 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# use to check whether ser is still responding; if not mail an alert
5
+# PLEASE configure before use !!!
6
+#
7
+# This script uses sipsak (http://sipsak.berlios.de) to test if a
8
+# SIP server is still responding to requests and will send messages
9
+# to the developers. It is configured for the iptel.org enviroment.
10
+# PLEASE adapt it to your local enviroment.
6 11
 #
7
-
8 12
 
9 13
 NOTIFY=sr@iptel.org
10 14
 SIPSAK=/home/srouter/sipsak/sipsak
... ...
@@ -15,9 +19,10 @@ LOCK_TIMEOUT=240
15 19
 TMP=/tmp/serresponse.$$
16 20
 MAILCOMMAND=/bin/mail
17 21
 HOSTN=`hostname`
22
+RUNHOST=bat.iptel.org
18 23
 SMSSEND=/home/sms/smstools/bin/putsms
19 24
 SMSDEVICE=/dev/ttyS0
20
-SMSNUMBERS="491795061546"
25
+SMSNUMBERS=""
21 26
 
22 27
 ############################
23 28
 
... ...
@@ -41,6 +46,8 @@ fi
41 46
 if [ ! -e $LOCKF ] ; then
42 47
 	if [ ! -x $SIPSAK ] ; then
43 48
 		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
49
+	elif [ ! -x $SMSSEND ]; then
50
+		echo "serresponse did not find the required SMS send executable $SMSSEND" >> $TMP
44 51
 	else
45 52
 		date >> $TMP2
46 53
 		echo "  $SIPSAKCMD" >> $TMP2
... ...
@@ -102,11 +109,23 @@ if [ ! -e $LOCKF ] ; then
102 109
 	fi
103 110
 	
104 111
 	if [ -e $TMP ] ; then
105
-		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
106
-		rm -f $TMP
107
-		touch $LOCKF
108
-		for i in $SMSNUMBERS; do
109
-			$SMSCMD $i "serresponse failed. please check your emails for details"
110
-		done
112
+		if [ $HOSTN = $RUNHOST ] ; then
113
+			$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
114
+			rm -f $TMP
115
+			touch $LOCKF
116
+			for i in $SMSNUMBERS; do
117
+				$SMSCMD $i "serresponse failed. please check your emails for details"
118
+			done
119
+		else
120
+			echo "unconfigured serresponse executed on ${HOSTN}." > $TMP
121
+			echo "Warning: This script if configured for the iptel.org enviroment."
122
+			echo "         Please configure it to your local settings first."
123
+			echo
124
+			echo "If you do not press CTRL-C within 2 seconds an informational message"
125
+			echo "with your hostname will be send to the ser developers."
126
+			sleep 2
127
+			$MAILCOMMAND -s "serresponse executed on ${HOSTN}" $NOTIFY < $TMP
128
+			rm -f $TMP
129
+		fi
111 130
 	fi
112 131
 fi
Browse code

Moved lock file creation to an earlier point.

Nils Ohlmeier authored on 12/09/2002 01:11:20
Showing 1 changed files
... ...
@@ -103,10 +103,10 @@ if [ ! -e $LOCKF ] ; then
103 103
 	
104 104
 	if [ -e $TMP ] ; then
105 105
 		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
106
+		rm -f $TMP
107
+		touch $LOCKF
106 108
 		for i in $SMSNUMBERS; do
107 109
 			$SMSCMD $i "serresponse failed. please check your emails for details"
108 110
 		done
109
-		touch $LOCKF
110
-		rm -f $TMP
111 111
 	fi
112 112
 fi
Browse code

Added date of sipsak runs.

Nils Ohlmeier authored on 09/09/2002 22:14:24
Showing 1 changed files
... ...
@@ -42,6 +42,7 @@ if [ ! -e $LOCKF ] ; then
42 42
 	if [ ! -x $SIPSAK ] ; then
43 43
 		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
44 44
 	else
45
+		date >> $TMP2
45 46
 		echo "  $SIPSAKCMD" >> $TMP2
46 47
 		echo "produced this output:" >> $TMP2
47 48
 		$SIPSAKCMD >> $TMP2 2>&1
... ...
@@ -50,6 +51,7 @@ if [ ! -e $LOCKF ] ; then
50 51
 			if [ $? -eq 0 ] ; then
51 52
 				sleep 15
52 53
 			fi
54
+			date >> $TMP3
53 55
 			echo "  $SIPSAKNCMD" >> $TMP3
54 56
 			echo "produced this output:" >> $TMP3
55 57
 			$SIPSAKNCMD >> $TMP3 2>&1
... ...
@@ -62,7 +64,7 @@ if [ ! -e $LOCKF ] ; then
62 64
 				echo "$LOCKF @ $HOSTN" >> $TMP
63 65
 				echo "(you presumably need to be root to do this)" >> $TMP
64 66
 				echo "" >> $TMP
65
-				echo "Command output of sipsak with fqdn follows:" >> $TMP
67
+				echo "Command output of sipsak with fqdn in Via follows:" >> $TMP
66 68
 				cat $TMP2 >> $TMP
67 69
 			else
68 70
 				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
... ...
@@ -73,7 +75,7 @@ if [ ! -e $LOCKF ] ; then
73 75
 				echo "$LOCKF @ $HOSTN" >> $TMP
74 76
 				echo "(you presumably need to be root to do this)" >> $TMP
75 77
 				echo "" >> $TMP
76
-				echo "First command output with fqdn:" >> $TMP
78
+				echo "First command output with fqdn in Via:" >> $TMP
77 79
 				cat $TMP2 >> $TMP
78 80
 				echo "" >> $TMP
79 81
 				echo "Second command output with IPs in Via:" >> $TMP
Browse code

Added delay after connection refused.

Nils Ohlmeier authored on 09/09/2002 03:31:10
Showing 1 changed files
... ...
@@ -46,13 +46,16 @@ if [ ! -e $LOCKF ] ; then
46 46
 		echo "produced this output:" >> $TMP2
47 47
 		$SIPSAKCMD >> $TMP2 2>&1
48 48
 		if [ $? -eq 3 ] ; then
49
+			grep "Connection refused" $TMP2
50
+			if [ $? -eq 0 ] ; then
51
+				sleep 15
52
+			fi
49 53
 			echo "  $SIPSAKNCMD" >> $TMP3
50 54
 			echo "produced this output:" >> $TMP3
51 55
 			$SIPSAKNCMD >> $TMP3 2>&1
52 56
 			if [ $? -le 1 ] ; then
53 57
 				echo "ser did not responses (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
54 58
 				echo "but the test with IPs in Via succeeded." >> $TMP
55
-				echo "  => DNS PROBLEM !?!" >> $TMP
56 59
 				echo "" >> $TMP
57 60
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
58 61
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
... ...
@@ -64,7 +67,6 @@ if [ ! -e $LOCKF ] ; then
64 67
 			else
65 68
 				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
66 69
 				echo "but also requests with IPs in Via failed." >> $TMP
67
-				echo "  => DNS IS NOT THE PROBLEM !!" >> $TMP
68 70
 				echo "" >> $TMP
69 71
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
70 72
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
Browse code

Removed debug output.

Nils Ohlmeier authored on 30/08/2002 17:43:34
Showing 1 changed files
... ...
@@ -45,12 +45,10 @@ if [ ! -e $LOCKF ] ; then
45 45
 		echo "  $SIPSAKCMD" >> $TMP2
46 46
 		echo "produced this output:" >> $TMP2
47 47
 		$SIPSAKCMD >> $TMP2 2>&1
48
-		echo "$SIPSAKCMD = $?"
49 48
 		if [ $? -eq 3 ] ; then
50 49
 			echo "  $SIPSAKNCMD" >> $TMP3
51 50
 			echo "produced this output:" >> $TMP3
52 51
 			$SIPSAKNCMD >> $TMP3 2>&1
53
-			echo "$SIPSAKNCMD = $?"
54 52
 			if [ $? -le 1 ] ; then
55 53
 				echo "ser did not responses (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
56 54
 				echo "but the test with IPs in Via succeeded." >> $TMP
Browse code

Added SMS notification. Fixes cause of sipsak changes.

Nils Ohlmeier authored on 30/08/2002 17:04:43
Showing 1 changed files
... ...
@@ -7,10 +7,7 @@
7 7
 
8 8
 
9 9
 NOTIFY=sr@iptel.org
10
-SERHOME=/home/srouter
11
-SERDIR=$SERHOME/sip_router
12
-TESTDIR=$SERDIR/test
13
-BIN=$TESTDIR/sipsak
10
+SIPSAK=/home/srouter/sipsak/sipsak
14 11
 SIPURI=sip:sipsak@iptel.org
15 12
 LOCKDIR=/var/lock
16 13
 LOCKFILE=serresponse
... ...
@@ -18,12 +15,18 @@ LOCK_TIMEOUT=240
18 15
 TMP=/tmp/serresponse.$$
19 16
 MAILCOMMAND=/bin/mail
20 17
 HOSTN=`hostname`
18
+SMSSEND=/home/sms/smstools/bin/putsms
19
+SMSDEVICE=/dev/ttyS0
20
+SMSNUMBERS="491795061546"
21 21
 
22 22
 ############################
23 23
 
24 24
 LOCKF=$LOCKDIR/$LOCKFILE
25 25
 TMP2=$TMP.dns
26 26
 TMP3=$TMP.ips
27
+SIPSAKCMD="$SIPSAK -v -s $SIPURI"
28
+SIPSAKNCMD="$SIPSAK -v -n -s $SIPURI"
29
+SMSCMD="$SMSSEND -d$SMSDEVICE -b9600"
27 30
 
28 31
 if [ -e $LOCKF ] ; then
29 32
 	find $LOCKDIR -name $LOCKFILE -amin +$LOCK_TIMEOUT -exec rm {} ';'
... ...
@@ -36,17 +39,19 @@ if [ -e $LOCKF ] ; then
36 39
 fi
37 40
 
38 41
 if [ ! -e $LOCKF ] ; then
39
-	if [ ! -x $BIN ] ; then
40
-		echo "serresponse did not find the required sipsak executable $BIN" >> $TMP
42
+	if [ ! -x $SIPSAK ] ; then
43
+		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
41 44
 	else
42
-		echo "  $BIN -s $SIPURI" >> $TMP2
45
+		echo "  $SIPSAKCMD" >> $TMP2
43 46
 		echo "produced this output:" >> $TMP2
44
-		$BIN -s $SIPURI >> $TMP2 2>&1
45
-		if [ $? -eq 1 ] ; then
46
-			echo "  $BIN -n -s $SIPURI" >> $TMP3
47
+		$SIPSAKCMD >> $TMP2 2>&1
48
+		echo "$SIPSAKCMD = $?"
49
+		if [ $? -eq 3 ] ; then
50
+			echo "  $SIPSAKNCMD" >> $TMP3
47 51
 			echo "produced this output:" >> $TMP3
48
-			$BIN -n -s $SIPURI >> $TMP3 2>&1
49
-			if [ $? -eq 0 ] ; then
52
+			$SIPSAKNCMD >> $TMP3 2>&1
53
+			echo "$SIPSAKNCMD = $?"
54
+			if [ $? -le 1 ] ; then
50 55
 				echo "ser did not responses (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
51 56
 				echo "but the test with IPs in Via succeeded." >> $TMP
52 57
 				echo "  => DNS PROBLEM !?!" >> $TMP
... ...
@@ -96,6 +101,9 @@ if [ ! -e $LOCKF ] ; then
96 101
 	
97 102
 	if [ -e $TMP ] ; then
98 103
 		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
104
+		for i in $SMSNUMBERS; do
105
+			$SMSCMD $i "serresponse failed. please check your emails for details"
106
+		done
99 107
 		touch $LOCKF
100 108
 		rm -f $TMP
101 109
 	fi
Browse code

Added check on local errors.

Nils Ohlmeier authored on 03/07/2002 15:24:10
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@ if [ ! -e $LOCKF ] ; then
42 42
 		echo "  $BIN -s $SIPURI" >> $TMP2
43 43
 		echo "produced this output:" >> $TMP2
44 44
 		$BIN -s $SIPURI >> $TMP2 2>&1
45
-		if [ $? -ne 0 ] ; then
45
+		if [ $? -eq 1 ] ; then
46 46
 			echo "  $BIN -n -s $SIPURI" >> $TMP3
47 47
 			echo "produced this output:" >> $TMP3
48 48
 			$BIN -n -s $SIPURI >> $TMP3 2>&1
... ...
@@ -53,9 +53,10 @@ if [ ! -e $LOCKF ] ; then
53 53
 				echo "" >> $TMP
54 54
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
55 55
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
56
-				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
56
+				echo "$LOCKF @ $HOSTN" >> $TMP
57
+				echo "(you presumably need to be root to do this)" >> $TMP
57 58
 				echo "" >> $TMP
58
-				echo "command output of sipsak with fqdn follows:" >> $TMP
59
+				echo "Command output of sipsak with fqdn follows:" >> $TMP
59 60
 				cat $TMP2 >> $TMP
60 61
 			else
61 62
 				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
... ...
@@ -64,14 +65,29 @@ if [ ! -e $LOCKF ] ; then
64 65
 				echo "" >> $TMP
65 66
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
66 67
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
67
-				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
68
+				echo "$LOCKF @ $HOSTN" >> $TMP
69
+				echo "(you presumably need to be root to do this)" >> $TMP
68 70
 				echo "" >> $TMP
69
-				echo "first command output with fqdn follows then with IPs:" >> $TMP
71
+				echo "First command output with fqdn:" >> $TMP
70 72
 				cat $TMP2 >> $TMP
73
+				echo "" >> $TMP
74
+				echo "Second command output with IPs in Via:" >> $TMP
71 75
 				cat $TMP3 >> $TMP
72 76
 			fi
73 77
 			rm -f $TMP3
74 78
 			rm -f $TMP2
79
+		elif [ $? -eq 2 ] ; then
80
+			echo "The ser response test failed due to a local error on" >> $TMP
81
+			echo "host $HOSTN ." >> $TMP
82
+			echo "" >> $TMP
83
+			echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
84
+			echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
85
+			echo "$LOCKF @ $HOSTN" >> $TMP
86
+			echo "(you presumably need to be root to do this)" >> $TMP
87
+			echo "" >> $TMP
88
+			echo "Command output of sipsak with fqdn follows:" >> $TMP
89
+			cat $TMP2 >> $TMP
90
+			rm -f $TMP2
75 91
 		else
76 92
 			rm -f $TMP2
77 93
 			rm -f $TMP
Browse code

Added disclaimer about the lockfile.

Nils Ohlmeier authored on 26/06/2002 13:10:29
Showing 1 changed files
... ...
@@ -17,6 +17,7 @@ LOCKFILE=serresponse
17 17
 LOCK_TIMEOUT=240
18 18
 TMP=/tmp/serresponse.$$
19 19
 MAILCOMMAND=/bin/mail
20
+HOSTN=`hostname`
20 21
 
21 22
 ############################
22 23
 
... ...
@@ -50,6 +51,10 @@ if [ ! -e $LOCKF ] ; then
50 51
 				echo "but the test with IPs in Via succeeded." >> $TMP
51 52
 				echo "  => DNS PROBLEM !?!" >> $TMP
52 53
 				echo "" >> $TMP
54
+				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
55
+				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
56
+				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
57
+				echo "" >> $TMP
53 58
 				echo "command output of sipsak with fqdn follows:" >> $TMP
54 59
 				cat $TMP2 >> $TMP
55 60
 			else
... ...
@@ -57,6 +62,10 @@ if [ ! -e $LOCKF ] ; then
57 62
 				echo "but also requests with IPs in Via failed." >> $TMP
58 63
 				echo "  => DNS IS NOT THE PROBLEM !!" >> $TMP
59 64
 				echo "" >> $TMP
65
+				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
66
+				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
67
+				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
68
+				echo "" >> $TMP
60 69
 				echo "first command output with fqdn follows then with IPs:" >> $TMP
61 70
 				cat $TMP2 >> $TMP
62 71
 				cat $TMP3 >> $TMP
Browse code

Added additional sipsak test with IPs instead of fqdn in Via.

Nils Ohlmeier authored on 16/06/2002 13:09:52
Showing 1 changed files
... ...
@@ -21,6 +21,8 @@ MAILCOMMAND=/bin/mail
21 21
 ############################
22 22
 
23 23
 LOCKF=$LOCKDIR/$LOCKFILE
24
+TMP2=$TMP.dns
25
+TMP3=$TMP.ips
24 26
 
25 27
 if [ -e $LOCKF ] ; then
26 28
 	find $LOCKDIR -name $LOCKFILE -amin +$LOCK_TIMEOUT -exec rm {} ';'
... ...
@@ -36,11 +38,33 @@ if [ ! -e $LOCKF ] ; then
36 38
 	if [ ! -x $BIN ] ; then
37 39
 		echo "serresponse did not find the required sipsak executable $BIN" >> $TMP
38 40
 	else
39
-		echo "The execution of this command:" >> $TMP
40
-		echo "  $BIN -s $SIPURI" >> $TMP
41
-		echo "produced this output:" >> $TMP
42
-		$BIN -s $SIPURI >> $TMP 2>&1
43
-		if [ $? -eq 0 ] ; then
41
+		echo "  $BIN -s $SIPURI" >> $TMP2
42
+		echo "produced this output:" >> $TMP2
43
+		$BIN -s $SIPURI >> $TMP2 2>&1
44
+		if [ $? -ne 0 ] ; then
45
+			echo "  $BIN -n -s $SIPURI" >> $TMP3
46
+			echo "produced this output:" >> $TMP3
47
+			$BIN -n -s $SIPURI >> $TMP3 2>&1
48
+			if [ $? -eq 0 ] ; then
49
+				echo "ser did not responses (fast enough) on the sipsak requests with fqdn in Via" >> $TMP
50
+				echo "but the test with IPs in Via succeeded." >> $TMP
51
+				echo "  => DNS PROBLEM !?!" >> $TMP
52
+				echo "" >> $TMP
53
+				echo "command output of sipsak with fqdn follows:" >> $TMP
54
+				cat $TMP2 >> $TMP
55
+			else
56
+				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
57
+				echo "but also requests with IPs in Via failed." >> $TMP
58
+				echo "  => DNS IS NOT THE PROBLEM !!" >> $TMP
59
+				echo "" >> $TMP
60
+				echo "first command output with fqdn follows then with IPs:" >> $TMP
61
+				cat $TMP2 >> $TMP
62
+				cat $TMP3 >> $TMP
63
+			fi
64
+			rm -f $TMP3
65
+			rm -f $TMP2
66
+		else
67
+			rm -f $TMP2
44 68
 			rm -f $TMP
45 69
 		fi
46 70
 	fi
Browse code

Replaced /usr/bin/mail with /bin/mail

Nils Ohlmeier authored on 14/06/2002 20:49:36
Showing 1 changed files
... ...
@@ -16,7 +16,7 @@ LOCKDIR=/var/lock
16 16
 LOCKFILE=serresponse
17 17
 LOCK_TIMEOUT=240
18 18
 TMP=/tmp/serresponse.$$
19
-MAILCOMMAND=/usr/bin/mail
19
+MAILCOMMAND=/bin/mail
20 20
 
21 21
 ############################
22 22
 
Browse code

Added removal of the lockfile after timeout.

Nils Ohlmeier authored on 14/06/2002 19:46:30
Showing 1 changed files
... ...
@@ -11,19 +11,32 @@ SERHOME=/home/srouter
11 11
 SERDIR=$SERHOME/sip_router
12 12
 TESTDIR=$SERDIR/test
13 13
 BIN=$TESTDIR/sipsak
14
-# MESSAGE=$TESTDIR/sipsak.sip
15 14
 SIPURI=sip:sipsak@iptel.org
16
-LOCKFILE=/var/lock/serresponse
15
+LOCKDIR=/var/lock
16
+LOCKFILE=serresponse
17
+LOCK_TIMEOUT=240
17 18
 TMP=/tmp/serresponse.$$
18 19
 MAILCOMMAND=/usr/bin/mail
19 20
 
20
-if [ ! -e $LOCKFILE ] ; then
21
+############################
22
+
23
+LOCKF=$LOCKDIR/$LOCKFILE
24
+
25
+if [ -e $LOCKF ] ; then
26
+	find $LOCKDIR -name $LOCKFILE -amin +$LOCK_TIMEOUT -exec rm {} ';'
27
+	if [ ! -e $LOCKF ] ; then
28
+		echo "This is a reminder !!!" > $TMP
29
+		echo "The lockfile $LOCKF" >> $TMP
30
+		echo "was just removed because ist was older then $LOCK_TIMEOUT minutes." >> $TMP
31
+		echo "But if you receive this mail the cause of this error still exists or respawned." >> $TMP
32
+	fi
33
+fi
34
+
35
+if [ ! -e $LOCKF ] ; then
21 36
 	if [ ! -x $BIN ] ; then
22
-		echo "serresponse did not find the required sipsak executable $BIN" > $TMP
23
-	#elif [ ! -f $MESSAGE ] ; then
24
-	#	echo "serresponse did not find the required message $MESSAGE" > $TMP
37
+		echo "serresponse did not find the required sipsak executable $BIN" >> $TMP
25 38
 	else
26
-		echo "The execution of this command:" > $TMP
39
+		echo "The execution of this command:" >> $TMP
27 40
 		echo "  $BIN -s $SIPURI" >> $TMP
28 41
 		echo "produced this output:" >> $TMP
29 42
 		$BIN -s $SIPURI >> $TMP 2>&1
... ...
@@ -34,7 +47,7 @@ if [ ! -e $LOCKFILE ] ; then
34 47
 	
35 48
 	if [ -e $TMP ] ; then
36 49
 		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
37
-		touch $LOCKFILE
50
+		touch $LOCKF
38 51
 		rm -f $TMP
39 52
 	fi
40 53
 fi
Browse code

removed message file check.

Nils Ohlmeier authored on 14/06/2002 16:52:22
Showing 1 changed files
... ...
@@ -18,10 +18,10 @@ TMP=/tmp/serresponse.$$
18 18
 MAILCOMMAND=/usr/bin/mail
19 19
 
20 20
 if [ ! -e $LOCKFILE ] ; then
21
-	if [ ! -f $MESSAGE ] ; then
22
-		echo "serresponse did not find the required message $MESSAGE" > $TMP
23
-	elif [ ! -x $BIN ] ; then
21
+	if [ ! -x $BIN ] ; then
24 22
 		echo "serresponse did not find the required sipsak executable $BIN" > $TMP
23
+	#elif [ ! -f $MESSAGE ] ; then
24
+	#	echo "serresponse did not find the required message $MESSAGE" > $TMP
25 25
 	else
26 26
 		echo "The execution of this command:" > $TMP
27 27
 		echo "  $BIN -s $SIPURI" >> $TMP
Browse code

Removed the needless message file

Nils Ohlmeier authored on 14/06/2002 16:41:00
Showing 1 changed files
... ...
@@ -11,8 +11,8 @@ SERHOME=/home/srouter
11 11
 SERDIR=$SERHOME/sip_router
12 12
 TESTDIR=$SERDIR/test
13 13
 BIN=$TESTDIR/sipsak
14
-MESSAGE=$TESTDIR/sipsak.sip
15
-SERHOST=sip:iptel.org
14
+# MESSAGE=$TESTDIR/sipsak.sip
15
+SIPURI=sip:sipsak@iptel.org
16 16
 LOCKFILE=/var/lock/serresponse
17 17
 TMP=/tmp/serresponse.$$
18 18
 MAILCOMMAND=/usr/bin/mail
... ...
@@ -24,9 +24,9 @@ if [ ! -e $LOCKFILE ] ; then
24 24
 		echo "serresponse did not find the required sipsak executable $BIN" > $TMP
25 25
 	else
26 26
 		echo "The execution of this command:" > $TMP
27
-		echo "  $BIN -f $MESSAGE -s $SERHOST" >> $TMP
27
+		echo "  $BIN -s $SIPURI" >> $TMP
28 28
 		echo "produced this output:" >> $TMP
29
-		$BIN -f $MESSAGE -s $SERHOST >> $TMP 2>&1
29
+		$BIN -s $SIPURI >> $TMP 2>&1
30 30
 		if [ $? -eq 0 ] ; then
31 31
 			rm -f $TMP
32 32
 		fi
Browse code

Initial version of a bash script which uses sipsak to check if ser is still responding.

Nils Ohlmeier authored on 12/06/2002 23:04:56
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,40 @@
1
+#!/bin/sh 
2
+#
3
+# $Id$
4
+#
5
+# use to check whether ser is still responding; if not mail an alert
6
+#
7
+
8
+
9
+NOTIFY=sr@iptel.org
10
+SERHOME=/home/srouter
11
+SERDIR=$SERHOME/sip_router
12
+TESTDIR=$SERDIR/test
13
+BIN=$TESTDIR/sipsak
14
+MESSAGE=$TESTDIR/sipsak.sip
15
+SERHOST=sip:iptel.org
16
+LOCKFILE=/var/lock/serresponse
17
+TMP=/tmp/serresponse.$$
18
+MAILCOMMAND=/usr/bin/mail
19
+
20
+if [ ! -e $LOCKFILE ] ; then
21
+	if [ ! -f $MESSAGE ] ; then
22
+		echo "serresponse did not find the required message $MESSAGE" > $TMP
23
+	elif [ ! -x $BIN ] ; then
24
+		echo "serresponse did not find the required sipsak executable $BIN" > $TMP
25
+	else
26
+		echo "The execution of this command:" > $TMP
27
+		echo "  $BIN -f $MESSAGE -s $SERHOST" >> $TMP
28
+		echo "produced this output:" >> $TMP
29
+		$BIN -f $MESSAGE -s $SERHOST >> $TMP 2>&1
30
+		if [ $? -eq 0 ] ; then
31
+			rm -f $TMP
32
+		fi
33
+	fi
34
+	
35
+	if [ -e $TMP ] ; then
36
+		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
37
+		touch $LOCKFILE
38
+		rm -f $TMP
39
+	fi
40
+fi