栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

监控知识与Prometheus和Grafana安装

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

监控知识与Prometheus和Grafana安装

监控知识与Prometheus和Grafana安装

监控知识体系

1.为什么要是要监控2.监控哪些3.监控有哪些分类(场景)

单机监控(自动化)集群监控云原生(容器) 安装 Prometheus

Install GolangInstall Prometheus

Systemd ServiceStart Server Install Grafana

Start Server Install node-exporter

Systemd ServiceStart server Monitor LinuxConfig grafana

监控知识体系 1.为什么要是要监控

业务跑在服务器上
什么是服务器?
一台特殊的设备(主机或者机器)
需要724365*2连续不间断运行

稳定性可靠性 (服务器多路-多cpu ECC内存 磁盘阵列)

1.对系统不间断的实时监控 (监控硬件->硬盘)
2.实时反馈系统当前状态
3.保证服务器可靠性,安全性
4.保证业务持续文档运行

2.监控哪些
    硬件监控 -->路由器,交换机,服务器(硬件),防火墙系统监控 -->CPU,硬盘,内存,网络,进程,TCP服务监控 --> Nginx(端口保活),php,tomcat,redis,mysqWeb监控 -->接口响应时间,加载时间,渲染时间日志监控 -->ELK,EFK(收集,存储,分析,展示)安全监控 -->fire WAF(nginx+lua),安全保,安全狗,牛盾云
3.监控有哪些分类(场景) 单机监控(自动化)

topiftopfreedf

Shell脚本

集群监控

分布式集群监控

Zabbix -->告警 云原生(容器)

容器云平台的监控 -->Rancher通过探针Zabbix/普罗米修斯 -->负责收集 (数据源)

数据分析+展示
Grafana -->展示

安装 Prometheus

    安装go 语言环境在监控服务器上安装prometheus在被监控环境上安装export安装grafana
Install Golang

需要go语言环境

wget https://studygolang.com/dl/golang/go1.15.2.linux-amd64.tar.gz

tar -xvf go1.15.2.linux-amd64.tar.gz
mv go /usr/local/

vim /etc/profile
...
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
....

source /etc/profile

# check go 
go version
Install Prometheus

https://prometheus.io/

https://prometheus.io/download/wget https://github.com/prometheus/prometheus/releases/download/v2.21.0/prometheus-2.21.0.freebsd-amd64.tar.gztar -xvf prometheus-2.21.0.linux-amd64.tar.gzmv prometheus-2.21.0.linux-amd64 /usr/local/prometheus./prometheus访问IP地址:9090chmod +x /usr/local/prometheus/prom*cp -rp /usr/local/prometheus/promtool /usr/bin/promtool -h Systemd Service

做成一个服务

cat > /etc/systemd/system/prometheus.service < 
Start Server 
systemctl status prometheus
systemctl start prometheus
systemctl enable prometheus  # 开机自动启动

ip+9090端口访问

Install Grafana
wget https://dl.grafana.com/oss/release/grafana-6.7.3-1.x86_64.rpm
yum localinstall grafana-6.7.3-1.x86_64.rpm
Start Server
systemctl daemon-reload
systemctl enable grafana-server.service
systemctl start grafana-server.service

http://ip:3000
admin admin

Install node-exporter

想监控哪台机器装哪台!

wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gztar -xvf node_exporter-1.0.1.linux-amd64.tar.gzmv node_exporter-1.0.1.linux-amd64/ /usr/local/node_exporter

启动 ./node_exporter

Systemd Service
cat > /etc/systemd/system/node_exporter.service < 
Start server 
systemctl daemon-reload
systemctl enable node_exporter
systemctl start node_exporter
systemctl status node_exporter

http://ip:9100/metrics


Monitor Linux
vim /usr/local/prometheus/prometheus.yml


- job_name: 'Linux'
    static_configs:
    - targets: ['192.168.110.37:9100']
    
systemctl restart prometheus

http://ip:9090/targets

Config grafana

https://grafana.com/grafana/dashboards




普罗米修斯配置好后就会显示

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/729458.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号