重庆思庄Oracle、Redhat认证学习论坛
标题: SENTRY介绍与安装 [打印本页]
作者: mahan 时间: 2022-8-28 11:32
标题: SENTRY介绍与安装
本帖最后由 mahan 于 2022-8-28 11:34 编辑
一、sentry介绍Sentry 是一个开源的实时错误追踪系统,可以帮助开发者实时监控并修复异常问题。它主要专注于持续集成、提高效率并且提升用户体验。Sentry 分为服务端和客户端 SDK,前者可以直接使用它家提供的在线服务,也可以本地自行搭建;后者提供了对多种主流语言和框架的支持,包括 React、Angular、Node、Django、RoR、PHP、Laravel、Android、.NET、JAVA 等。同时它可提供了和其他流行服务集成的方案,例如 GitHub、GitLab、bitbuck、heroku、slack、Trello 等。
二、sentry的安装
1、准备一台新的机器,环境初始化sentry测试环境
CentOSLinux release 7.9.2009 (Core)
ip地址
192.168.133.120
关闭防火墙与selinux
[root@sentry ~]# systemctl stop firewalld.service
[root@sentry ~]# systemctl disablefirewalld.service
输入命令vim /etc/selinux/config,将SELINUX=enforcing改为SELINUX=disabled,然后保存退出
2、上传安装包sftp> cd /tmp/
sftp> lcd 本地安装包位置
sftp> put sentry.tar.gz mysql-5.7.36-1.el7.x86_64.rpm-bundle.tar
3、安装sentry_agent服务[root@sentry ~]# vim/usr/lib/systemd/system/sentry_agent.service
[Unit]
Description="sentry_agent"
After=network.target
[Service]
Type=simple
ExecStart=/sentry/agent/sentry_agent_linux_amd64
WorkingDirectory=/sentry/agent
KillMode=process
KillSignal=SIGQUIT
TimeoutStopSec=5
Restart=always
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=telegraf
[Install]
WantedBy=multi-user.target
[root@sentry ~]# systemctl enablesentry_agent.service
Created symlink from/etc/systemd/system/multi-user.target.wants/sentry_agent.service to/usr/lib/systemd/system/sentry_agent.service.
4、准备mysql5.6及以上版本mysql数据库;[root@sentry tmp]# tar -xvfmysql-5.7.36-1.el7.x86_64.rpm-bundle.tar
解压mysql安装包
[root@sentry tmp]# rpm -qa|grep mysql
[root@sentry tmp]# rpm -qa|grepmariadb
检查数据库如果有mysql或mariadb先删除,以免冲突
[root@sentry tmp]# rpm -ivhmysql-community-common-5.7.36-1.el7.x86_64.rpm
[root@sentry tmp]# rpm -ivhmysql-community-libs-5.7.36-1.el7.x86_64.rpm
[root@sentry tmp]# rpm -ivhmysql-community-client-5.7.36-1.el7.x86_64.rpm
[root@sentry tmp]# rpm -ivhmysql-community-server-5.7.36-1.el7.x86_64.rpm
安装mysql
[root@sentry tmp]# systemctl startmysqld
启动服务
5、mysql相关配置[root@sentry tmp]# cat/var/log/mysqld.log |grep "temporary password"
2022-08-25T07:36:26.293711Z 1 [Note] Atemporary password is generated for root@localhost: W-yo0_&mEg-t
获取登录密码(看自己log文件密码)
[root@sentry tmp]# mysql -uroot -p
Enter password: W-yo0_&mEg-t
mysql> setpassword=PASSWORD('Sentry123!@#');
flush privileges;
set @@GLOBAL.sql_mode='';
set sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
6、解压sentry安装包[root@sentry ~]# cd /
[root@sentry /]# tar -xzvf/tmp/sentry.tar.gz
注意:软件必须安装在/sentry目录下
[root@sentry /]# ls -ltr /sentry/
total 324
drwxr-xr-x 6 root root 56 Nov 30 2016 python
-rw-r--r-- 1 root root 298 Jan 3 2017 readme.txt
-rw-r--r-- 1 root root 110 Feb 7 2017 compile.py
-rw-r--r-- 1 root root 1104 Apr 1 2017 sentry_install_guide_cn.txt
-rw-r--r-- 1 root root 1163 Apr 1 2017 sentry_install_guide_en.txt
drwxr-xr-x 12 root root 180 Aug 13 2018 env
-rwxr-xr-x 1 root root 2362 Oct 19 2018 agent.sh
-rw-r--r-- 1 root root 454 Mar 28 2021 requirements.txt
-rw-r--r-- 1 root root 407 Jun 9 2021 env.sh
-rwxr-xr-x 1 root root 827 Jun 29 16:26 pack.sh
-rw-r--r-- 1 root root 1679 Jul 25 10:38 ssl.key
-rw-r--r-- 1 root root 944 Jul 25 10:40 ssl.csr
-rw-r--r-- 1 root root 1086 Jul 25 10:40 ssl.crt
-rwxr-xr-x 1 root root 2072 Jul 25 10:46 web.sh
-rw-r--r-- 1 root root 2617 Jul 29 09:07 ssl.tar.gz
-rw-r--r-- 1 root root 271266 Aug 10 09:43 sentry.sql
drwxr-xr-x 11 root root 192 Aug 10 10:34 web
drwxr-xr-x 7 root root 4096 Aug 10 10:34 agent
7、登录mysql创建用户并授权[root@sentry /]# mysql -uroot -p
Enterpassword: Sentry123!@#
createdatabase sentry charset utf8mb4;
CREATEUSER 'sentry'@'localhost' IDENTIFIED BY 'Sentry123!@#';
GRANT allON sentry.* TO 'sentry'@'localhost';
CREATEUSER 'sentry'@'127.0.0.1' IDENTIFIED BY 'Sentry123!@#';
GRANT allON sentry.* TO 'sentry'@'127.0.0.1';
CREATEUSER 'sentry'@'%' IDENTIFIED BY 'Sentry123!@#';
GRANT allON sentry.* TO 'sentry'@'%';
8、将初始数据导入mysql[root@sentry /]# cd /sentry/
[root@sentry sentry]# mysql -usentry-p sentry < sentry.sql
Enter password: Sentry123!@#
9、启动agent与web程序cd /sentry
[root@sentry sentry]# sh agent.shstart
sentry agent start success!
[root@sentry sentry]# sh web.sh start
sentry web start success!
10、访问web页面
file:///C:/Users/78769/AppData/Local/Packages/oice_16_974fa576_32c1d314_552/AC/Temp/msohtmlclip1/01/clip_image002.jpg
账号:admin/78907890
三、部署oracle监控
1、安装服务[root@orcl ~]# vim/usr/lib/systemd/system/sentry_agent.service
[Unit]
Description="sentry_agent"
After=network.target
[Service]
Type=simple
ExecStart=/sentry/agent/sentry_agent_linux_amd64
WorkingDirectory=/sentry/agent
KillMode=process
KillSignal=SIGQUIT
TimeoutStopSec=5
Restart=always
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=telegraf
[Install]
WantedBy=multi-user.target
[root@orcl ~]# systemctl enablesentry_agent.service
2、创建oracle用户并授权create user sentry identified bysentry;
grant connect to sentry;grant selectany dictionary to sentry;
grant connect to sentry;
grant select any dictionary to sentry;
grant dba to sentry;
3、修改sysctl文件sysctl.conf文件添加
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
4、安装snmpyum -y install net-snmp*
chkconfig snmpd on 开机自启
5、修改snmp配置文件vim /etc/snmp/snmpd.conf
添加:
view systemview included .1
proc mountd
proc ntalkd 4
proc sendmail 10 1
exec echotest /bin/echo hello world
disk / 10000
oad 12 14 14
6、重启snmp服务service snmpd restart
snmpwalk -v 2c -c public 192.168.133.120
7、web页面配置oracle配置>oracle配置>新增