ELK Stack系列:Frostmourne (霜之哀伤)日誌监控系统部署安装

简介

Frostmourne(霜之哀伤)是用于帮助监控几乎所有数据库数据(包括ElasticsearchPrometheusSkyWalkingMySql 等等)。如果你已经建立起了日誌系统, 指标体系,却苦恼于没有一个配套监控系统,也许它能帮到你。

支持数据源:Elasticsearch, HTTP, SkyWalking, Prometheus, InfluxDB, MySQL/TiDb, ClickHouse, SqlServer, PING, IotDB, Telnet

支持告警发送方式:钉钉(机器人)、企业微信(机器人)、飞书机器人、OneMessage机器人、Email、短信、HTTP。(text, markdown)

支持LDAP认证和自动创建用户。

Elasticsearch数据查询、分享和下载

报警消息抑制功能,防止消息轰炸;也有报警升级功能,避免故障相关方长时间得不到通知。

个人博客:https://songxwn.com/
RSS订阅:https://songxwn.com/atom.xml

Github地址:https://github.com/AutohomeCorp/frostmourne

环境要求:JAVA8-14、Mysql 8数据库。

教程使用Linux版本:Rocky Linux 8 (关闭SELinux)

版本:部署1.0版本

注意:目前不支持ES8 的加密认证,需要等后期支持JAVA 17。

使用ZIP包部署(使用Linux环境)

下载JDK(推荐使用JDK8)

dnf install wget tree## 安装wget treecd /optmkdir java1.8cd /opt/java1.8wget --execute robots=off -nc -nd -r -l1 -A '*.gz' https://mirrors.tuna.tsinghua.edu.cn/Adoptium/8/jdk/x64/linux/## 下载OpenJDK8二进制包,源为清华大学源,会自动下载最新版。tar -zxvf OpenJDK8U-jdk_*.tar.gz ## 解压tree -L 2 /opt/java1.8//opt/java1.8/├── jdk8u362-b09│   ├── ASSEMBLY_EXCEPTION│   ├── bin│   ├── include│   ├── jre│   ├── lib│   ├── LICENSE│   ├── man│   ├── NOTICE│   ├── release│   ├── sample│   ├── src.zip│   └── THIRD_PARTY_README└── OpenJDK8U-jdk_x64_linux_hotspot_8u362b09.tar.gz7 directories, 7 files## 查看当前文件树

PS:JDK也可以手动去https://mirrors.tuna.tsinghua.edu.cn/Adoptium/8/jdk/x64/linux/ 目录下进行下载最新版。

部署Mysql(建议为8版本)

dnf install mysql-server##Rocky 8源默认安装mysql8systemctl enable --now mysqldsystemctl status mysqld.service ## 设置开机并启动,查看启动状态
mysql_secure_installation ## 初始化Mysql## 如下,都选择Y即可,密码等级选择0,然后配置root密码。Securing the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD COMPONENT can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD component?Press y|Y for Yes, any other key for No: yThere are three levels of password validation policy:LOW    Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special characters and dictionary                  filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0Please set the password for root here.New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done! 

创建数据库导入SQL文件

wget https://github.com/AutohomeCorp/frostmourne/blob/master/doc/mysql-schema/frostmourne.sql## 可能需要挂国际代理,或浏览器下载,使用SCP上传即可.mysql -uroot -p < frostmourne.sql#输入密码即可导入创建数据库。mysql -uroot -pmysql> show databases;+--------------------+| Database           |+--------------------+| frostmourne        || information_schema || mysql              || performance_schema || sys                |+--------------------+5 rows in set (9527.01 sec)#查看数据库是否正常创建, quit命令退出。

下载frostmourne

cd /optmkdir frostmournecd frostmournewget https://github.com/AutohomeCorp/frostmourne/releases/download/1.0-RELEASE/frostmourne-monitor-1.0-RELEASE.zip## 可能需要挂国际代理,或浏览器下载,使用SCP上传到opt目录即可.## Github 下载地址 https://github.com/AutohomeCorp/frostmourne/releasesdnf install unzip unzip frostmourne-monitor*.zip tree .├── application.properties├── env├── frostmourne-monitor-1.0-RELEASE.jar├── frostmourne-monitor-1.0-RELEASE.zip└── scripts    ├── shutdown.sh    └── startup.sh1 directory, 6 files## 文件树如上。

修改ENV 环境文件,配置java路径

vim /opt/frostmourne/env JAVA_HOME=/opt/java1.8/jdk8u362-b09##配置文件上面操作解压的JDK路径即可JAVA_OPTS="-Xms1200m -Xmx2000m -Xss1024K -XX:PermSize=128m -XX:MaxPermSize=256m -Dfile.encoding=utf-8"##JAVA参数,可适当改大内存等参数。

修改启动app配置(也可以配置邮件发送服务器和LDAP)

vim /opt/frostmourne/application.properties alarmlog_reserve_days=30#配置监控日志保留天数datasource_frostmourne_url=jdbc:mysql://127.0.0.1:3306/frostmourne?characterEncoding=utf8#配置mysql数据库IP地址、数据库名字、编码。datasource_frostmourne_username=rootdatasource_frostmourne_password=Wow@123#配置mysql数据库账号密码frostmourne_monitor_address=192.168.124.100#配置为本机IP地址即可frostmourne_message_title=Wow#配置实例名字

启动测试

/opt/frostmourne/scripts/startup.sh ./startup.sh: line 7: dos2unix: command not foundLOG_DIR: /opt/frostmourne/scripts/../logsPID_FOLDER: /opt/frostmourne/scripts/../pidSun Mar 26 16:42:27 CST 2023 ==== Starting ==== Application is running as root (UID 0). This is considered insecure.Started [5477]Waiting for server startup..Sun Mar 26 16:42:37 CST 2023 Server started in 10 secondsss -an | grep 10054tcp   LISTEN 0      100                    *:10054           *:*                  ## 查看10054端口监听即可判断已正常启动。/opt/frostmourne/scripts/shutdown.sh ## 停止服务                 

Web访问: http://192.168.124.100:10054 即可测试,注意替换IP

admin 管理账号默认的账号密码是123456

注意:开启了LDAP认证,admin账号仍然可以用初始密码登录。

配置为Systemd自定义服务并设置开机启动

vim /usr/lib/systemd/system/frostmourne.service [Unit]Description=frostAfter=network.target mysqld.service[Service]User=rootType=forkingExecStart=/opt/frostmourne/scripts/startup.shExecStop=/opt/frostmourne/scripts/shutdown.shRemainAfterExit=yes[Install]WantedBy=multi-user.target##写入到文件保存。systemctl daemon-reload## 加载自定义服务systemctl start frostmourne.service systemctl status frostmourne.service ## 尝试启动,并查看状态。systemctl enable frostmourne.service ## 设置开启及并启动

注意:需要等待网络服务和mysql启动之后,才会启动。

技术架构

frostmourne-vue:前端项目,使用vue-element-template实现,打包时会把生成的资源文件构建到frostmourne-monitor

frostmourne-monitor:监控运行主体服务

主要技术栈

springboot 2.xelement uivue-admin-templatexxl-jobmybatisfreemarkerelasticsearchInfluxDBjjwtnashorn

参考

官方文档:https://github.com/AutohomeCorp/frostmourne

注意:推荐配合https://songxwn.com/elk/ ES部署使用。
集群:安装教程:https://songxwn.com/elk_cluster/


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章