部署Alerta统一监控平台

简介: 1.安装mongodb-server [alerta@SUSE ~]$ curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.
1.安装mongodb-server
[alerta@SUSE ~]$ curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.6.tgz
[alerta@SUSE ~]$ tar zxvf mongodb-linux-x86_64-rhel62-3.4.6.tgz 
[alerta@SUSE mongodb-linux-x86_64-rhel62-3.4.6]$ cd mongodb-linux-x86_64-rhel62-3.4.6 && mkdir data
[alerta@SUSE ~]$ nohup ./mongodb-linux-x86_64-rhel62-3.4.6/bin/mongod --dbpath /usr/local/alerta/mongodb-linux-x86_64-rhel62-3.4.6/data/ &






安装python3.6版本
[alerta@SUSE ~]$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
[alerta@SUSE ~]$ tar xvf Python-3.6.1.tar.xz 
[alerta@SUSE Python-3.6.1]$ ./configure --prefix=/usr/local/alerta/python3.6.1 && make && make install






安装alerta-server
[alerta@SUSE bin]$ ./pip3 install alerta-server
Collecting alerta-server
  Downloading alerta-server-4.9.6.tar.gz (44kB)
    100% |████████████████████████████████| 51kB 187kB/s 
Collecting Flask (from alerta-server)
  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 130kB/s 
Collecting Flask-Cors>=3.0.2 (from alerta-server)
  Downloading Flask_Cors-3.0.3-py2.py3-none-any.whl
Collecting pymongo>=3.0 (from alerta-server)
  Downloading pymongo-3.4.0.tar.gz (583kB)
    100% |████████████████████████████████| 583kB 55kB/s 
Collecting argparse (from alerta-server)
  Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting requests (from alerta-server)
  Downloading requests-2.18.1-py2.py3-none-any.whl (88kB)
    100% |████████████████████████████████| 92kB 35kB/s 
Collecting python-dateutil (from alerta-server)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 19kB/s 
Collecting pytz (from alerta-server)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |████████████████████████████████| 491kB 12kB/s 
Collecting PyJWT (from alerta-server)
  Downloading PyJWT-1.5.2-py2.py3-none-any.whl
Collecting bcrypt (from alerta-server)
  Downloading bcrypt-3.1.3-cp36-cp36m-manylinux1_x86_64.whl (54kB)
    100% |████████████████████████████████| 61kB 9.9kB/s 
Collecting Werkzeug>=0.7 (from Flask->alerta-server)
  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 14kB/s 
Collecting click>=2.0 (from Flask->alerta-server)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 15kB/s 
Collecting itsdangerous>=0.21 (from Flask->alerta-server)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 25kB/s 
Collecting Jinja2>=2.4 (from Flask->alerta-server)
  Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
    100% |████████████████████████████████| 348kB 27kB/s 
Collecting Six (from Flask-Cors>=3.0.2->alerta-server)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting idna=2.5 (from requests->alerta-server)
  Downloading idna-2.5-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 25kB/s 
Collecting urllib3=1.21.1 (from requests->alerta-server)
  Downloading urllib3-1.21.1-py2.py3-none-any.whl (131kB)
    100% |████████████████████████████████| 133kB 13kB/s 
Collecting certifi>=2017.4.17 (from requests->alerta-server)
  Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 16kB/s 
Collecting chardet=3.0.2 (from requests->alerta-server)
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 8.9kB/s 
Collecting cffi>=1.1 (from bcrypt->alerta-server)
  Downloading cffi-1.10.0-cp36-cp36m-manylinux1_x86_64.whl (406kB)
    100% |████████████████████████████████| 409kB 12kB/s 
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask->alerta-server)
  Downloading MarkupSafe-1.0.tar.gz
Collecting pycparser (from cffi>=1.1->bcrypt->alerta-server)
  Downloading pycparser-2.18.tar.gz (245kB)
    100% |████████████████████████████████| 256kB 26kB/s 
Installing collected packages: Werkzeug, click, itsdangerous, MarkupSafe, Jinja2, Flask, Six, Flask-Cors, pymongo, argparse, idna, urllib3, certifi, chardet, requests, python-dateutil, pytz, PyJWT, pycparser, cffi, bcrypt, alerta-server
  Running setup.py install for itsdangerous ... done
  Running setup.py install for MarkupSafe ... done
  Running setup.py install for pymongo ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for alerta-server ... done
Successfully installed Flask-0.12.2 Flask-Cors-3.0.3 Jinja2-2.9.6 MarkupSafe-1.0 PyJWT-1.5.2 Six-1.10.0 Werkzeug-0.12.2 alerta-server-4.9.6 argparse-1.4.0 bcrypt-3.1.3 certifi-2017.4.17 cffi-1.10.0 chardet-3.0.4 click-6.7 idna-2.5 itsdangerous-0.24 pycparser-2.18 pymongo-3.4.0 python-dateutil-2.6.0 pytz-2017.2 requests-2.18.1 urllib3-1.21.1






使用uwsgi部署alerta-server,内置的alertad在测试时使用,上线不建议使用。
[alerta@SUSE ~]$ cat wsgi.py    
from alerta.app import app
[alerta@SUSE ~]$ cat uwsgi.ini 
[uwsgi]
chdir = /usr/local/alerta
mount = /api=wsgi.py
callable = app
manage-script-name = true




master = true
processes = 5
logger = syslog:alertad




socket = /usr/local/alerta/uwsgi.sock
chmod-socket = 664
uid = alerta
gid = alerta
vacuum = true




die-on-term = true
启动
[alerta@SUSE ~]$ nohup uwsgi --ini uwsgi.ini  &
[1] 18626
[uWSGI] getting INI configuration from uwsgi.ini






安装nginx web服务器
wget http://nginx.org/download/nginx-1.12.0.tar.gz
tar zxvf nginx-1.12.0.tar.gz
./configure --prefix=/usr/local/nginx-1.5.1 --with-http_ssl_module --with-http_spdy_module --with-http_stub_status_module --with-pcre
make && make install
注释掉原来的server,添加
include vhosts/*.conf;
[alerta@SUSE ~]$ cat ~/nginx1.12/conf/vhosts/alerta.conf
server {
    listen  28880;
    server_name  192.168.1.228 ;




    location /api { try_files $uri @api; }
    location @api {
    include uwsgi_params;
        uwsgi_pass unix:/usr/local/alerta/uwsgi.sock;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }




    location / {
        root /usr/local/alerta/angular-alerta-webui/app/;
    }




    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/local/nginx1.12/nginx/html;
    }
}
./nginx -t
./nginx
启动服务


安装alerta-webui前端
[alerta@SUSE ~]$ git clone https://github.com/alerta/angular-alerta-webui.git
[alerta@SUSE ~]$ vim /usr/local/alerta/angular-alerta-webui/app/config.js
'use strict';




angular.module('config', [])
  .constant('config', {
    'endpoint'    : "/api",
    'provider'    : "basic", // google, github, gitlab, keycloak or basic
    'client_id'   : "INSERT-CLIENT-ID-HERE",
    'github_url'  : null,  // replace with your enterprise github server
    'gitlab_url'  : "https://gitlab.com",  // replace with your gitlab server
    'keycloak_url': "https://keycloak.example.org",  // replace with your keycloak server
    'keycloak_realm': "master",  // replace with your keycloak realm
    'colors'      : {}, // use default colors
    'severity'    : {}, // use default severity codes
    'audio'       : {}, // no audio
    'tracking_id' : ""  // Google Analytics tracking ID eg. UA-NNNNNN-N
  });
  


安装alerta客户端测试
发送2条测试,显示1条重复。
[alerta@SUSE ~]$ pip install alerta
[alerta@SUSE ~]$ alerta --endpoint-url http://192.168.1.228:28880/api send --resource webserver01 --event down --environment Production --service Website01 --severity major --text "Web server 01 is down." --value ERROR
6e28d3a5-f764-452b-9916-f6d54c533402 (indeterminate -> major)
[alerta@SUSE ~]$ alerta --endpoint-url http://192.168.1.228:28880/api send --resource webserver01 --event down --environment Production --service Website01 --severity major --text "Web server 01 is down." --value ERROR
6e28d3a5-f764-452b-9916-f6d54c533402 (1 duplicates)





目录
相关文章
|
Linux 异构计算 Python
【linux】nvidia-smi 查看GPU使用率100%
nvidia-smi 查看GPU使用率一直是100%解决办法
【linux】nvidia-smi 查看GPU使用率100%
|
监控 Linux 数据安全/隐私保护
【实践】德国开源监控平台Checkmk的搭建
【实践】德国开源监控平台Checkmk的搭建
1579 0
|
数据可视化 测试技术
一文了解软件测试规范
软件测试规范是测试工作的依据和准则,在进行软件测试时,应在相关国标文件的要求和指导下完成测试工作,这样可以从根本上保证软件测试工作的质量,进而提升软件产品的质量。 一个完整的软件测试规范应该包括对规范本身的详细说明,例如规范的目的、范围、文档结构、词汇表、参考信息、可追溯性、方针、过程/规范、指南、模板、检查表、培训、工具、参考资料等。
1757 0
一文了解软件测试规范
|
8月前
|
人工智能 自然语言处理 机器人
保姆级教学:OpenClaw(Clawdbot)阿里云及本地部署接入伟达免费API全指南
在AI工具使用中,Token消耗过高始终是用户的核心痛点,而2026年英伟达推出的免费API彻底解决了这一问题——支持GLM5、GLM4.7、MiniMax M2.1、Kimi2.5等主流模型,仅限制40rpm请求速率,无其他配额约束,成为OpenClaw(原Clawdbot)的最佳算力搭档。OpenClaw作为高性能AI自动化代理,结合英伟达免费API后,可实现零成本的自然语言推理与自动化执行,再搭配飞书等即时通讯工具的交互能力,能打造出高效、便捷的全场景AI助手。
8601 5
|
安全 Linux 虚拟化
Proxmox Mail Gateway 9.0 正式版发布 - 全面的开源邮件安全平台
Proxmox Mail Gateway 9.0 正式版发布 - 全面的开源邮件安全平台
786 7
Proxmox Mail Gateway 9.0 正式版发布 - 全面的开源邮件安全平台
|
11月前
|
存储 Prometheus 监控
Prometheus 撑不住了?上 Thanos、Cortex、M3!一篇给你讲明白大规模监控的江湖
Prometheus 撑不住了?上 Thanos、Cortex、M3!一篇给你讲明白大规模监控的江湖
749 14
|
XML Java 测试技术
Spring IOC—基于注解配置和管理Bean 万字详解(通俗易懂)
Spring 第三节 IOC——基于注解配置和管理Bean 万字详解!
1152 26
|
12月前
|
Kubernetes 调度 异构计算
Kubernetes集群中,部分使用GPU资源的Pod出现UnexpectedAdmissionError问题的解决方案。
如果在进行上述检查之后,问题依然存在,可以尝试创建一个最小化的Pod配置,仅请求GPU资源而不
759 5
|
监控 Ubuntu 安全
如何在 Ubuntu Linux 中设置和使用 FTP 服务器?
如何在 Ubuntu Linux 中设置和使用 FTP 服务器?
809 2
如何在 Ubuntu Linux 中设置和使用 FTP 服务器?
|
监控 前端开发 NoSQL
Zabbix6.0下部署开源的Zabbix报表系统ZbxTable
Zabbix6.0下部署开源的Zabbix报表系统ZbxTable
3036 0
Zabbix6.0下部署开源的Zabbix报表系统ZbxTable