wsgi应用服务器警报
alerta-server的Python项目详细描述
Alerta 7.0版
Alerta监视工具的开发目的如下:
- 分布式和去耦合,因此它是scalable
- 最小的配置可轻松接受来自任何来源的警报
- 快速浏览visualization并深入了解详细信息
python 2.7支持为eol
从6.0版开始,仅支持Python3.5+。版本5.2是 最后一个支持Python2.7和此版本的功能增强在 2018年8月31日。只有关键的错误修复才会被移植到5.2版。
要求
唯一的强制依赖项是mongodb或postgresql。其他都是可选的。
- Postgres 9.5版或更高版本
- MongoDB 3.2版或更高版本
安装
要在debian/ubuntu上安装mongodb,请运行:
$ sudo apt-get install -y mongodb-org
$ mongod
要在CentOS/RHEL上安装MongoDB,请运行:
$ sudo yum install -y mongodb
$ mongod
要安装Alerta服务器和客户端,请运行:
$ pip install alerta-server alerta
$ alertad run
要安装Web控制台,请运行:
$ wget https://github.com/alerta/alerta-webui/releases/latest/download/alerta-webui.tar.gz
$ tar zxvf alerta-webui.tar.gz
$ cd dist
$ python3 -m http.server 8000
>> browse to http://localhost:8000
Docker
alerta和mongodb也可以使用docker容器运行,请参见alerta/docker-alerta。
配置
配置alertad
服务器将覆盖/etc/alertad.conf
中的默认设置。
或者使用ALERTA_SVR_CONF_FILE
环境变量::
$ ALERTA_SVR_CONF_FILE=~/.alertad.conf
$ echo "DEBUG=True" > $ALERTA_SVR_CONF_FILE
文档
有关Alerta的配置和其他方面的更多信息 在http://docs.alerta.io
开发
要在开发模式下运行,请在端口5000上侦听:
$ export FLASK_APP=alerta FLASK_ENV=development
$ pip install -e .
$ flask run
在开发模式下运行,监听端口8080,使用postgres和 向Sentry报告错误:
$ export FLASK_APP=alerta FLASK_ENV=development
$ export DATABASE_URL=postgres://localhost:5432/alerta5
$ export SENTRY_DSN=https://8b56098250544fb78b9578d8af2a7e13:fa9d628da9c4459c922293db72a3203f@sentry.io/153768
$ pip install -e .[postgres]
$ flask run --debugger --port 8080 --with-threads --reload
故障排除
通过在api服务器中设置DEBUG=True
来启用调试日志输出
配置:
DEBUG=True
LOG_HANDLERS = ['console','file']
LOG_FORMAT = 'verbose'
LOG_FILE = '$HOME/alertad.log'
检查web浏览器开发人员控制台 javascript日志、网络问题和api错误响应。
测试
要使用本地postgres数据库运行测试,请运行:
$ pip install -r requirements.txt
$ pip install -e .[postgres]
$ createdb test5
$ ALERTA_SVR_CONF_FILE= DATABASE_URL=postgres:///test5 pytest
云部署
alerta可以使用herokuhttps://github.com/alerta/heroku-api-alerta轻松部署到云上, aws ec2 https://github.com/alerta/alerta-cloudformation,或google云平台 https://github.com/alerta/gcloud-api-alerta
许可证
Alerta monitoring system and console
Copyright 2012-2019 Nick Satterly
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.