iT邦幫忙

0

ELK Stack系列:Frostmourne (霜之哀傷)日誌監控系統部署安裝

  • 分享至 

  • xImage
  •  

简介

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 tree

cd /opt
mkdir java1.8
cd /opt/java1.8
wget --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.gz

7 directories, 7 files


## 查看当前文件树

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

部署Mysql(建议为8版本)

dnf install mysql-server

##Rocky 8源默认安装mysql8

systemctl enable --now mysqld

systemctl 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 passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please 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) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


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 changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

创建数据库导入SQL文件

wget https://github.com/AutohomeCorp/frostmourne/blob/master/doc/mysql-schema/frostmourne.sql

## 可能需要挂国际代理,或浏览器下载,使用SCP上传即可.

mysql -uroot -p < frostmourne.sql

#输入密码即可导入创建数据库。

mysql -uroot -p
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| frostmourne        |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (9527.01 sec)


#查看数据库是否正常创建, quit命令退出。

下载frostmourne

cd /opt
mkdir frostmourne
cd frostmourne

wget https://github.com/AutohomeCorp/frostmourne/releases/download/1.0-RELEASE/frostmourne-monitor-1.0-RELEASE.zip

## 可能需要挂国际代理,或浏览器下载,使用SCP上传到opt目录即可.
## Github 下载地址 https://github.com/AutohomeCorp/frostmourne/releases

dnf 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.sh

1 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=root
datasource_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 found
LOG_DIR: /opt/frostmourne/scripts/../logs
PID_FOLDER: /opt/frostmourne/scripts/../pid
Sun 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 seconds

ss -an | grep 10054
tcp   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=frost
After=network.target mysqld.service

[Service]
User=root
Type=forking
ExecStart=/opt/frostmourne/scripts/startup.sh
ExecStop=/opt/frostmourne/scripts/shutdown.sh
RemainAfterExit=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.x
  • element ui
  • vue-admin-template
  • xxl-job
  • mybatis
  • freemarker
  • elasticsearch
  • InfluxDB
  • jjwt
  • nashorn

参考

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

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


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言