-
Notifications
You must be signed in to change notification settings - Fork 522
/
curve-monitor.sh
63 lines (51 loc) · 942 Bytes
/
curve-monitor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#sh update_dashboard.sh
#echo "update dashboards success!"
WORKDIR=/etc/curve/monitor
if [ ! -d $WORKDIR ]; then
echo "${WORKDIR} not exists"
exit 1
fi
cd $WORKDIR
chmod -R 777 prometheus
chmod -R 777 grafana
start() {
echo "==========start==========="
echo "" > monitor.log
docker-compose up >> monitor.log 2>&1 &
echo "start metric system success!"
}
stop() {
echo "===========stop============"
docker-compose down
ID=`(ps -ef | grep "target_json.py"| grep -v "grep") | awk '{print $2}'`
for id in $ID
do
kill -9 $id
echo "killed $id"
done
}
restart() {
stop
echo "sleeping........."
sleep 3
start
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'status')
status
;;
'restart')
restart
;;
*)
echo "usage: $0 {start|stop|restart}"
exit 1
;;
esac