首页 > 其他分享 >使用Prometheus+Grafana搭建服务器监控系统

使用Prometheus+Grafana搭建服务器监控系统

时间:2022-11-30 15:31:51浏览次数:81  
标签:node amd64 -- prometheus grafana Prometheus linux 服务器 Grafana


安装

$ wget https://github.com/prometheus/prometheus/releases/download/v2.7.2/prometheus-2.7.2.linux-amd64.tar.gz
$ tar xvfz prometheus-2.7.2.linux-amd64.tar.gz
$ cd prometheus-2.7.2.linux-amd64
// 查看版本
$ ./prometheus --version
// 运行server
$ ./prometheus --config.file=prometheus.yml

浏览器请求ip:9090

使用Prometheus+Grafana搭建服务器监控系统_Grafana

输入:promhttp_metric_handler_requests_total   点击执行

使用Prometheus+Grafana搭建服务器监控系统_Grafana_02

 添加机器状态监控

 安装​​node_exporter​

// 下载,可以在github的release中对最新版本右键获取下载链接
$ wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
// 解压
$ tar xvfz node_exporter-0.17.0.linux-amd64.tar.gz
// 进入解压出的目录
$ cd node_exporter-0.17.0.linux-amd64
// 运行监控采集服务
$ ./node_exporter

请求  ip+9100

使用Prometheus+Grafana搭建服务器监控系统_Prometheus_03

去 prometheus的配置文件(prometheus.yml)中,加上一个target

scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'server'
static_configs:
- targets: ['localhost:9100']

使用Prometheus+Grafana搭建服务器监控系统_监控_04

如果新加的target的status是“UP”的话,就说明监听成功了。

此时去Graph中,输入框输入node可以发现有很多node开头的监控项了,都是和机器状态有关的,可以自己执行看一看。

使用Prometheus+Grafana搭建服务器监控系统_监控_05

安装Grafana:

​https://grafana.com/grafana/download​

ps:如果下载很慢可以联系博主qq 可以发文件给各位  教程是rpm

rpm -ivh grafana-6.5.2-1.x86_64.rpm 

如果报错说依赖不够  自行百度可以解决

yum install --downloadonly --downloaddir=./ fontconfig
yum localinstall fontconfig-2.13.0-4.3.el7.x86_64.rpm
yum install --downloadonly --downloaddir=./ urw-fonts
yum localinstall urw-fonts-2.4-16.el7.noarch.rpm
yum install urw-fonts

rpm -ivh grafana-6.5.2-1.x86_64.rpm 

启动

service grafana-server start

访问IP:3000

使用Prometheus+Grafana搭建服务器监控系统_Grafana_06

去下载仪表盘

​https://grafana.com/grafana/dashboards​

点开第一个:

使用Prometheus+Grafana搭建服务器监控系统_Grafana_07

使用Prometheus+Grafana搭建服务器监控系统_Prometheus_08

 然后回来 grafana的首页

粘贴到下方的文本框里头

使用Prometheus+Grafana搭建服务器监控系统_Prometheus_09

 博主因为导入过  所以不能再次导入  导入后有个下拉框需要选择下 顺带取个名字

使用Prometheus+Grafana搭建服务器监控系统_github_10

 完事之后  找到刚刚整个仪表盘

使用Prometheus+Grafana搭建服务器监控系统_github_11

使用Prometheus+Grafana搭建服务器监控系统_linux_12

 

使用Prometheus+Grafana搭建服务器监控系统_Grafana_13

使用Prometheus+Grafana搭建服务器监控系统_github_14

 效果图比zabbix好看点  

其中有更多的监控选项   数据库  http链接  服务器指数  等等  就请各位看官自行去挖掘了  如果能帮到你的话 可以帮忙点个赞加个关注

标签:node,amd64,--,prometheus,grafana,Prometheus,linux,服务器,Grafana
From: https://blog.51cto.com/u_15897407/5899845

相关文章

  • web服务器1-socket编程
    基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:time服务器的客户端服务器,提交程序运行截图echo服务器的客户端服务器,提交程序运行截图,服务器把客户端传进来......
  • Web服务器1-socket编程
    Web服务器1-socket编程1.time服务器的客户端服务器2.echo服务器的客户端服务器,提交程序运行截图,服务器把客户端传进来的内容加入“服务器进程pid你的学号姓名......
  • web服务器2
    基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:Web服务器的客户端服务器,提交程序运行截图实现GET即可,请求,响应要符合HTTP协议规范服务器部署到华为云服务......
  • 实验四 Web服务器1-socket编程
    基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:time服务器的客户端服务器,提交程序运行截图echo服务器的客户端服务器,提交程序运行截图,服务器把客户端传进......
  • 实验四 Web服务器1-socket编程
    基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:1.time服务器的客户端服务器,提交程序运行截图代码://timeclient.c#include<stdio.h>#include<netinet/in......
  • 实验四 Web服务器1-socket编程
    实验四Web服务器1-socket编程基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:1.time服务器的客户端服务器,提交程序运行截图2.echo服务器的客户端服务器,提......
  • 浏览器和服务器之间的通信 ajax axios 接口 接口文档
    浏览器和服务器通讯过程以咱们用的最多的浏览器为例,和服务器通讯的过程就像聊微信?浏览器:输入URL地址-->请求服务器:接收请求并返回对应的资源-->响应浏览器:......
  • linux服务器出厂测试抓包
    注:适用于超微x86_64主板,已测阿里龙蜥8.4,华为欧拉20.03,centos7,centos8,细节部分根据自己实际情况调整[root@test~]#catTheServer_test_supermicro_x86_64.shBaseboard......
  • 实验四 Web服务器1-socket编程
    实验要求:基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用LinuxSocket实现:time服务器的客户端服务器,提交程序运行截图echo服务器的客户端服务器,提交程序运行截图,服务器把......
  • Tengine 主动式后端服务器健康检查功能 ngx_http_upstream_check_module
    本文使用的版本:Tengine-2.3.3在Tengine2.3.3中ngx_http_upstream_check_module默认是不包含的,所以编译配置的时候需要手动添加上去./configure--add-module=modu......