· 6 years ago · Jul 22, 2019, 07:38 AM
1# pwd
2/usr/share/nginx/html/alerta
3
4# cat config.json
5{"endpoint": "http://alerta.domain.com/api"}
6
7# env
8LC_ALL=C.UTF-8
9ALERTA_DEFAULT_PROFILE=production
10ALERTA_CONF_FILE=/root/.alerta.conf
11LANG=C.UTF-8
12ALERTA_API_KEY=magickey
13VUE_APP_ALERTA_ENDPOINT=http://alerta.domain.com/api
14ALERTA_ENDPOINT=http://alerta.domain.com/api
15
16# cat ~/.alerta.conf
17[DEFAULT]
18timezone = Europe/Stockholm
19output = json
20
21[profile production]
22endpoint = http://alerta.domain.com/api
23key = magickey
24sslverify = off
25timeout = 10.0
26
27# cat /etc/alertad.conf
28
29# BASIC
30DEBUG = True
31
32BASE_URL = '/api'
33
34LOGGER_NAME = 'alerta'
35LOG_FILE = '/var/log/alertad.log'
36#LOG_FILE = '$HOME/alertad.log'
37LOG_HANDLERS = ['console','file']
38#LOG_FORMAT = '%(asctime)s - %(name)s[%(process)d]: %(levelname)s - %(message)s [in %(pathname)s:%(lineno)d]'
39LOG_FORMAT = 'verbose'
40
41# MONGODB
42MONGO_URI = 'mongodb://127.0.0.1:27017/monitoring'
43MONGO_DATABASE = 'monitoring'
44
45# CORS
46CORS_ORIGINS = [
47 'http://127.0.0.1',
48 'http://localhost',
49 'http://alerta.domain.com',
50 'https://127.0.0.1',
51 'https://localhost',
52 'https://alerta.domain.com'
53]
54
55# AUTH
56AUTH_REQUIRED = True
57
58SECRET_KEY = 'secretkey'
59ADMIN_USERS = ['something@else.com']
60
61CUSTOMER_VIEWS = True
62SIGNUP_ENABLED = False
63
64TOKEN_EXPIRE_DAYS = 7
65
66# API
67QUERY_LIMIT = 10000
68HISTORY_LIMIT = 100
69API_KEY_EXPIRE_DAYS = 365
70AUTO_REFRESH_ALLOW = 'ON'
71SENDER_API_ALLOW = 'ON'
72
73# EMAIL
74EMAIL_VERIFICATION = False
75SMTP_HOST = 'localhost'
76SMTP_PORT = 25
77MAIL_FROM = 'alerta@domain.com'
78SMTP_PASSWORD = ''
79
80# SUP
81BLACKOUT_DURATION = 86400
82
83SEVERITY_MAP = {
84 'security': 0,
85 'fatal': 0,
86 'critical': 1,
87 'major': 2,
88 'minor': 3,
89 'warning': 4,
90 'indeterminate': 5,
91 'cleared': 5,
92 'normal': 5,
93 'ok': 5,
94 'informational': 6,
95 'debug': 7,
96 'trace': 8,
97 'unknown': 9
98}
99DEFAULT_SEVERITY = 'indeterminate'
100
101PLUGINS = ['reject', 'blackout']
102PLUGINS_RAISE_ON_ERROR = False # keep processing other plugins if exception
103
104ALLOWED_ENVIRONMENTS=['Production', 'Development', 'Testing', 'Code']
105
106#use if proxy is terminating HTTPS traffic
107USE_PROXYFIX = True
108
109# cat /etc/uwsgi.ini
110[uwsgi]
111chdir = /usr/share/nginx/html/alerta
112mount = /api=wsgi.py
113callable = app
114manage-script-name = true
115
116master = true
117processes = 5
118logger = syslog:alertad
119
120socket = /tmp/uwsgi.sock
121chmod-socket = 664
122uid = nginx
123gid = nginx
124vacuum = true
125
126die-on-term = true
127
128# cat /etc/nginx/sites-available/alerta.conf
129server {
130
131 listen 127.0.0.1:80;
132 listen 443 ssl;
133
134 # SSL settings
135 include snippets/certbot.conf;
136
137 ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
138 ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
139
140 client_max_body_size 25m;
141 client_body_timeout 30;
142
143 add_header Content-Security-Policy upgrade-insecure-requests;
144
145 index index.html index.htm index.php index.cgi index.pl index.xhtml index.view;
146 default_type application/octet-stream;
147
148 server_name alerta.domain.com;
149 root /usr/share/nginx/html/alerta;
150
151 location /api { try_files $uri @api; }
152
153 location @api {
154 include uwsgi_params;
155 uwsgi_pass unix:/tmp/uwsgi.sock;
156 proxy_set_header Host $host:$server_port;
157 proxy_set_header X-Real-IP $remote_addr;
158 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
159 }
160
161 location / {
162 root /usr/share/nginx/html/alerta;
163 try_files $uri $uri/ /index.html;
164 }
165
166}