-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrun.sh
executable file
·128 lines (123 loc) · 2.98 KB
/
run.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
DASHBOARD_USER=${DASHBOARD_USER:-admin}
DASHBOARD_PASS=${DASHBOARD_PASS:-sensu}
SENSU_HOST=${SENSU_HOST:-localhost}
SKIP_CONFIG=${SKIP_CONFIG:-}
SENSU_CONFIG_URL=${SENSU_CONFIG_URL:-}
SENSU_CLIENT_CONFIG_URL=${SENSU_CLIENT_CONFIG_URL:-}
SENSU_CHECKS_CONFIG_URL=${SENSU_CHECKS_CONFIG_URL:-}
if [ ! -z "$SENSU_CONFIG_URL" ] ; then
wget --no-check-certificate -O /etc/sensu/config.json $SENSU_CONFIG_URL
else
if [ ! -e "/etc/sensu/config.json" ] ; then
cat << EOF > /etc/sensu/config.json
{
"rabbitmq": {
"port": 5672,
"host": "$SENSU_HOST",
"user": "guest",
"password": "guest",
"vhost": "/"
},
"redis": {
"host": "$SENSU_HOST",
"port": 6379
},
"api": {
"host": "$SENSU_HOST",
"port": 4567
},
"dashboard": {
"host": "$SENSU_HOST",
"port": 8080,
"user": "$DASHBOARD_USER",
"password": "$DASHBOARD_PASS"
},
"handlers": {
"default": {
"type": "pipe",
"command": "true"
}
}
}
EOF
fi
fi
if [ ! -z "$SENSU_CLIENT_CONFIG_URL" ] ; then
wget --no-check-certificate -O /etc/sensu/conf.d/client.json $SENSU_CLIENT_CONFIG_URL
else
if [ ! -e "/etc/sensu/conf.d/client.json" ] ; then
cat << EOF > /etc/sensu/conf.d/client.json
{
"client": {
"name": "sensu-server",
"address": "127.0.0.1",
"subscriptions": [ "default", "sensu" ]
}
}
EOF
fi
fi
if [ ! -z "$SENSU_CHECKS_CONFIG_URL" ] ; then
wget --no-check-certificate -O /etc/sensu/conf.d/checks.json $SENSU_CHECKS_CONFIG_URL
else
if [ ! -e "/etc/sensu/conf.d/checks.json" ] ; then
cat << EOF > /etc/sensu/conf.d/checks.json
{
"checks": {
"sensu-rabbitmq-beam": {
"handlers": [
"default"
],
"command": "/etc/sensu/plugins/processes/check-procs.rb -p beam -C 1 -w 4 -c 5",
"interval": 60,
"occurrences": 2,
"refresh": 300,
"subscribers": [ "sensu" ]
},
"sensu-rabbitmq-epmd": {
"handlers": [
"default"
],
"command": "/etc/sensu/plugins/processes/check-procs.rb -p epmd -C 1 -w 1 -c 1",
"interval": 60,
"occurrences": 2,
"refresh": 300,
"subscribers": [ "sensu" ]
},
"sensu-redis": {
"handlers": [
"default"
],
"command": "/etc/sensu/plugins/processes/check-procs.rb -p redis-server -C 1 -w 4 -c 5",
"interval": 60,
"occurrences": 2,
"refresh": 300,
"subscribers": [ "sensu" ]
},
"sensu-api": {
"handlers": [
"default"
],
"command": "/etc/sensu/plugins/processes/check-procs.rb -p sensu-api -C 1 -w 4 -c 5",
"interval": 60,
"occurrences": 2,
"refresh": 300,
"subscribers": [ "sensu" ]
},
"sensu-dashboard": {
"handlers": [
"default"
],
"command": "/etc/sensu/plugins/processes/check-procs.rb -p sensu-dashboard -C 1 -w 1 -c 1",
"interval": 60,
"occurrences": 2,
"refresh": 300,
"subscribers": [ "sensu" ]
}
}
}
EOF
fi
fi
/usr/bin/supervisord