File tree 6 files changed +61
-11
lines changed
bin/commands/scripts/healthcheck
6 files changed +61
-11
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
status=" "
3
- wget -q --spider 127.0.0.1:6001/ping
3
+ wget -q -t 1 --timeout=10 127.0.0.1:6001/ping
4
4
if [ $? -ne 0 ]; then
5
5
status=${status} " \n Dashboard is not accessible" ;
6
6
fi
7
7
8
- wget -q --spider 127.0.0.1:3001/o/ping
8
+ wget -q -t 1 --timeout=10 127.0.0.1:3001/o/ping
9
9
if [ $? -ne 0 ]; then
10
10
status=${status} " \n Api is not accessible" ;
11
11
fi
12
12
13
- wget -q --spider 127.0.0.1/ping
13
+ wget -q -t 1 --timeout=10 127.0.0.1/ping
14
14
if [ $? -ne 0 ]; then
15
15
status=${status} " \n Dashboard is not accessible through Nginx" ;
16
16
fi
17
17
18
- wget -q --spider 127.0.0.1/o/ping
18
+ wget -q -t 1 --timeout=10 127.0.0.1/o/ping
19
19
if [ $? -ne 0 ]; then
20
20
status=${status} " \n Api is not accessible through Nginx" ;
21
21
fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ con=$( countly mongo)
3
+ res=$( mongo countly ${con} --eval " print('CLYTest')" )
4
+ if ! [[ $res == * " CLYTest" * ]]; then
5
+ echo -e " Can't connect to MongoDB" ;
6
+ fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ nginxpath=" /var/log/nginx/error.log"
4
+ curdate=$( date " +%Y/%m/%d %H" )
5
+ errors=$( cat ${nginxpath} | grep " ${curdate} " | wc -l) ;
6
+
7
+ if [ ${errors} -gt 0 ]; then
8
+ echo -e " You have $errors error(s) in the last hour in your nginx error.log" ;
9
+ fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ if [ -x " $( command -v ntpstat) " ]; then
4
+ ntpstat;
5
+ if [ $? -ne 0 ]; then
6
+ echo -e " NTP does not seem to work properly" ;
7
+ fi
8
+ elif [ -x " $( command -v ntpq) " ]; then
9
+ ntp_offset=$( ntpq -pn | awk ' BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }' ) ;
10
+ if [ ${ntp_offset} -gt 1000 ]; then
11
+ echo -e " NTP does not seem to work properly" ;
12
+ fi
13
+ elif [ -x " $( command -v timedatectl) " ]; then
14
+ res=$( timedatectl status | grep ' NTP synchronized' | tr -d ' ' | cut -d ' :' -f 2) ;
15
+ if ! [ $res = " yes" ]; then
16
+ echo -e " NTP does not seem to work properly" ;
17
+ fi
18
+ else
19
+ echo -e " NTP does not seem to be installed or configured correctly" ;
20
+ fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ procowner=" 0"
4
+ fileowner=$( stat -c ' %U' ` countly dir` )
5
+ paths=$( ps -ux | grep countly)
6
+ while read line; do
7
+ if [[ $line = * " dashboard node" * ]]; then
8
+ procowner=$( echo ${line} | tr -s ' ' | cut -d ' ' -f 1)
9
+ break
10
+ fi
11
+ done <<< " $paths"
12
+ if ! [ ${procowner} == ${fileowner} ]; then
13
+ echo -e " Permission problems:"
14
+ echo -e " Process owner: $procowner " ;
15
+ echo -e " Directory owner: $fileowner " ;
16
+ fi
Original file line number Diff line number Diff line change @@ -32,16 +32,15 @@ workersthreshold=$(nproc)
32
32
appproc=0
33
33
apiproc=0
34
34
workers=0
35
- paths=$( ps -ax | grep node )
35
+ paths=$( ps -ax | grep countly )
36
36
while read line; do
37
- path=$( echo ${line} | awk ' {print $NF}' )
38
- if [[ $path = * " frontend/express/app.js" * ]]; then
37
+ if [[ $line = * " dashboard node" * ]]; then
39
38
appproc=$(( appproc+ 1 ))
40
39
fi
41
- if [[ $path = * " api/api.js " * ]] && ! [[ $path = * " /bin/config/ " * ]]; then
40
+ if [[ $line = * " api master node " * ]]; then
42
41
apiproc=$(( apiproc+ 1 ))
43
42
fi
44
- if [[ $path = * " api/api.js " * ]] && [[ $path = * " /bin/config/ " * ]]; then
43
+ if [[ $line = * " api worker node " * ]]; then
45
44
workers=$(( workers+ 1 ))
46
45
fi
47
46
done <<< " $paths"
@@ -57,9 +56,9 @@ elif [ ${apiproc} == 0 ]; then
57
56
res=${res} " \n Process api.js is not found"
58
57
fi
59
58
if [ ${workers} -gt ${workersthreshold} ]; then
60
- res=${res} " \n Too many processes for api.js workers: " $apiproc
59
+ res=${res} " \n Too many processes for api.js workers: " $workers " nproc: " $workersthreshold
61
60
elif [ ${workers} -lt ${workersthreshold} ]; then
62
- res=${res} " \n Too little processes for api.js workers: " $apiproc " nproc: " $workersthreshold
61
+ res=${res} " \n Too little processes for api.js workers: " $workers " nproc: " $workersthreshold
63
62
fi
64
63
65
64
if ! [ -z " ${res} " ]; then
You can’t perform that action at this time.
0 commit comments