当前位置: 首页 > wzjs >正文

可以做外贸私单的网站软文文案案例

可以做外贸私单的网站,软文文案案例,深圳高端品牌网站设计,政府门户网站建设的建议一、环境准备 准备一台Linux主机(最低2CPU/4G内存)这里的IP是:192.168.10.10 二、安装Prometheus相关组件 Prometheus 采集、存储数据 Grafana 用于图表展示 alertmanager 用于接收 Prometheus 发送的告警信息 node-exporter 用于收集操…

一、环境准备

准备一台Linux主机(最低2CPU/4G内存)这里的IP是:192.168.10.10

二、安装Prometheus相关组件

  • Prometheus 采集、存储数据
  • Grafana 用于图表展示
  • alertmanager 用于接收 Prometheus 发送的告警信息
  • node-exporter 用于收集操作系统和硬件信息的metrics

1、安装Prometheus

官网下载地址,获取最新下载URL

#切换到root用户
sudo -i#下载prometheus二进制压缩包
wget https://github.com/prometheus/prometheus/releases/download/v2.37.6/prometheus-2.37.6.linux-amd64.tar.gz#解压
tar xf prometheus-2.37.6.linux-amd64.tar.gz#查看解压后的文件名
ls -lmkdir /opt/prometheus -p#移动解压后的文件名到/opt/,并改名prometheus
mv prometheus-2.37.6.linux-amd64/ /opt/prometheus/prometheus

创建一个专门的prometheus用户:

useradd -M -s /usr/sbin/nologin prometheus

更改prometheus用户的文件夹权限:

chown prometheus:prometheus -R /opt/prometheus

创建 systemd 服务

cat > /etc/systemd/system/prometheus.service << "EOF"
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/opt/prometheus/prometheus/prometheus \--config.file=/opt/prometheus/prometheus/prometheus.yml \--storage.tsdb.path=/opt/prometheus/prometheus/data \--storage.tsdb.retention.time=60d \--web.enable-lifecycle[Install]
WantedBy=multi-user.target
EOF

配置参数解释:

通过/opt/prometheus/prometheus -h查看帮助详情

--config.file=/opt/prometheus/prometheus/prometheus.yml                 #主配置文件
--storage.tsdb.path=/opt/prometheus/prometheus/data 	                #数据库存储目录
--web.console.libraries=/opt/prometheus/prometheus/console_libraries    #指定控制台库目录路径
--web.console.templates=/opt/prometheus/prometheus/consoles 	        #指定控制台模版目录路径
--storage.tsdb.retention=60d                                            #指明数据保留天数,默认15天
--web.enable-lifecycle                                                  #热加载

启动 Prometheus

systemctl daemon-reload
systemctl start prometheus.service

加入到开机自启动

systemctl enable prometheus.service

检查

systemctl status prometheus.service

查看 Prometheus 的日志以进行故障排除:

journalctl -u prometheus.service -f

访问地址

应用

访问地址

备注

prometheus

http://192.168.10.10:9090

无用户和密码

监控指标

http://192.168.10.10:9090/metrics

2、安装alertmanager

下载alertmanager

官网下载地址,获取最新下载URL.

  • 注 在root用户下执行
下载alertmanager二进制压缩包
wget https://github.com/prometheus/alertmanager/releases/download/v0.25.0/alertmanager-0.25.0.linux-amd64.tar.gz#解压
tar xf alertmanager-0.25.0.linux-amd64.tar.gz#查看解压后的文件名
ls -l#移动解压后的文件名到/opt/,并改名为alertmanager
mv alertmanager-0.25.0.linux-amd64 /opt/prometheus/alertmanager

更改alertmanager文件夹权限:

chown prometheus:prometheus -R /opt/prometheus/alertmanager

创建 systemd 服务

cat >/etc/systemd/system/alertmanager.service << "EOF"[Unit]
Description=Alert Manager
Wants=network-online.target
After=network-online.target[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/opt/prometheus/alertmanager/alertmanager \--config.file=/opt/prometheus/alertmanager/alertmanager.yml \--storage.path=/opt/prometheus/alertmanager/dataRestart=always[Install]
WantedBy=multi-user.targetEOF

启动 alertmanager

systemctl daemon-reload
systemctl start alertmanager.service

加入到开机自启动

systemctl enable alertmanager.service

检查

systemctl status alertmanager.service

修改prometheus配置

加入alertmanager

如果alertmanager不是和prometheus安装在同一台服务器上,把loaclhost修改为alertmanager具体的ip

vim /opt/prometheus/prometheus/prometheus.ymlalerting:alertmanagers:- static_configs:- targets:#根据实际填写alertmanager的地址- localhost:9093rule_files:#根据实际名修改文件名- "alert.yml"# 搜刮配置
scrape_configs:- job_name: 'alertmanager'scrape_interval: 15sstatic_configs:- targets: ['localhost:9093']

增加触发器配置文件

cat > /opt/prometheus/prometheus/alert.yml <<"EOF"
groups:
- name: Prometheus alertrules:# 对任何实例超过30秒无法联系的情况发出警报- alert: 服务告警expr: up == 0for: 30slabels:severity: criticalannotations:summary: "服务异常,实例:{{ $labels.instance }}"description: "{{ $labels.job }} 服务已关闭"
EOF

检查配置

cd /opt/prometheus/prometheus/
./promtool check config prometheus.yml

重启prometheus或重新加载配置文件(二选一)

#重启
systemctl restart prometheus
或:
#重载,需要--web.enable-lifecycle配置
curl -X POST http://localhost:9090/-/reload

访问地址

应用

访问地址

备注

alertmanager

http://192.168.10.10:9093

无用户和密码

检查

3、安装grafana

官网下载地址:Download Grafana | Grafana Labs

二进制安装

cd ~wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.4.3.linux-amd64.tar.gztar -zxvf grafana-enterprise-9.4.3.linux-amd64.tar.gzls -lmv grafana-9.4.3/ /opt/prometheus/grafana

更改grafana文件夹权限:

chown prometheus:prometheus -R /opt/prometheus

创建 systemd 服务

cat >/etc/systemd/system/grafana-server.service<<"EOF"
[Unit]
Description=Grafana server
Documentation=http://docs.grafana.org
[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/opt/prometheus/grafana/bin/grafana-server \--config=/opt/prometheus/grafana/conf/defaults.ini \--homepath=/opt/prometheus/grafana
[Install]
WantedBy=multi-user.target
EOF

启动 alertmanager

systemctl daemon-reload
systemctl start grafana-server.service

加入到开机自启动

systemctl enable grafana-server.service

检查

systemctl status grafana-server.service

检查日志

journalctl -u grafana-server.service -f

web访问地址

应用

访问地址

备注

grafana

http://192.168.10.10:3000

默认:admin/admin

4、安装node_exporter

官网下载地址:Download | Prometheus

wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gztar xvf node_exporter-1.5.0.linux-amd64.tar.gzls -lmv node_exporter-1.5.0.linux-amd64 /opt/prometheus/node_exporter

更改node_exporter文件夹权限:

chown prometheus:prometheus -R /opt/prometheus/node_exporter

创建 systemd 服务

cat > /etc/systemd/system/node_exporter.service <<"EOF"
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
User=prometheus
Group=prometheus
ExecStart=/opt/prometheus/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF

启动 node_exporter

systemctl daemon-reload
systemctl start node_exporter.service

加入到开机自启动

systemctl enable node_exporter.service

检查

systemctl status node_exporter.service

检查日志

journalctl -u node_exporter.service -f

web访问地址

应用

访问地址

备注

node-exporter

http://192.168.10.10:9100/metrics

无用户和密码

修改prometheus配置

prometheus服务器操作

cat >> /opt/prometheus/prometheus/prometheus.yml <<"EOF"# 再scrape_configs这行下面添加如下配置:#node-exporter配置- job_name: 'node-exporter'scrape_interval: 15sstatic_configs:- targets: ['localhost:9100']labels:instance: Prometheus服务器 
EOF

重载prometheus

curl -X POST http://localhost:9090/-/reload

Prometheus web上检查

http://192.168.10.10:9090/

三、使用grafana展示prometheus的图形

1、登陆grafana

http://192.168.10.10:3000

用户名:admin

密码: admin

 

第一次登陆,需要修改密码,填入新的密码后,再submit(提交)如下图:

2、创建 Prometheus 数据源

在 Grafana 中创建 Prometheus 数据源:

  1. 单击边栏中的“齿轮”,打开“配置”菜单。
  1. 单击“数据源”。
  1. 单击“添加数据源”。
  1. 选择“Prometheus”作为类型。
  1. 设置适当的 Prometheus 服务器 URL(例如,http://localhost:9090
  1. 单击“保存并测试”以保存新的数据源。

如下图:

点击Prometheus

url填入:http://localhost:9090 注:localhost表示本机,如果grafana和prometheus不在同台机器的活,这里要写prometheus的所在地址,granfan和prometheus要能通信

3、创建仪表盘

从 Grafana.com 导入仪表板

Grafana dashboards | Grafana Labs

打开grafana的dashboards官网,在搜索栏输入node exporter回车,点击下载量大的dashboards如下图:

在拷贝id

打开grafana web控制台--点击dashbord图标--在点import导入--粘贴之前复制的id--在点load加载

name填写“服务器监控”(根据实际修改),选择“prometheus”--在点import导入

导入dashbord完成后,如下图:

http://www.dtcms.com/wzjs/408590.html

相关文章:

  • 国外服务器哪家好seo免费
  • 网上接单做网站拼多多搜索关键词排名
  • 页面设计在哪打开杭州优化外包哪里好
  • 登录广东省建设监理协会网站首页江苏网站推广公司
  • 可信网站验证 费用直通车怎么开
  • 免费模板网站制作长沙网站seo推广
  • 外企网站建设网站备案
  • wordpress 搜索出图片郑州seo推广
  • 推广软件是什么新区seo整站优化公司
  • 广州 网站开发百度图片查找
  • 建设网站需要哪些费用制作网站要多少费用
  • 我自己的网站 怎样做防火墙seo网站监测
  • 哪个做简历的网站可以中英的免费注册二级域名的网站
  • 湖南网站制作重庆百度搜索优化
  • 线上设计师网站打开免费百度啊
  • 怎样用网站做淘宝客cms
  • 网站怎么优化seo广告设计自学教程
  • 云服务器做网站要备案吗网站宣传和推广的方法有哪些
  • 做网站uiseo快速工具
  • 网站服务类型是什么意思软文推广案例大全
  • 公司设计图图片简笔画优化大师怎么强力卸载
  • 做律师网站电销如何申请一个网站域名
  • 专门做设计的网站站长统计网站
  • 珠海pc网站建设网络营销ppt案例
  • 网站建设综合技术搜索网站的软件
  • 住房和城乡建设部网站防排烟网站开发月薪多少钱
  • 重庆企业公司网站建设网络销售新手入门
  • 网站建设的实训总结推广软文200字
  • 织梦网站管理安装网络营销环境宏观微观分析
  • wordpress添加底部导航seo咨询茂名