linux 服务器监控 grafana

14 篇文章 0 订阅


服务器监控

参考博客地址:

https://www.cnblogs.com/caoweixiong/p/12120301.html
https://www.cnblogs.com/fatyao/p/11007357.html    


-influxdb---时间序列数据库-


官网地址:https://portal.influxdata.com/downloads/
wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.0.3.arm64.rpm
sudo yum localinstall influxdb2-2.0.3.arm64.rpm
启动:
#systemctl enable influxdb
#systemctl start influxdb   service influxdb start

查询数据:influx  相当于mysql -u root -p 
创建jmeter数据库: create database jmeter;      (主要)
创建管理员权限的用户:     (主要)
    CREATE USER admin WITH PASSWORD admin WITH ALL PRIVILEGES

配置文件路径 :/etc/influxdb/influxdb.conf  启用部分配置      (主要)
[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true
  bind-address = ":8086"

[[graphite]]
  # Determines whether the graphite endpoint is enabled.
  enabled = true
  database = "jmeter"
  bind-address = ":2003"
  protocol = "tcp"
  consistency-level = "one"
  batch-size = 5000
  batch-pending = 10
  batch-timeout = "1s"
  udp-read-buffer = 0
  separator = "."

修改配置后重启
查看配置:influxd config   

-- 查看所有的数据库
show databases;
-- 使用特定的数据库
use database_name;
-- 查看所有的measurement  (表)
show measurements;
-- 查询10条数据
select * from measurement_name limit 10;
-- 数据中的时间字段默认显示的是一个纳秒时间戳,改成可读格式
precision rfc3339; -- 之后再查询,时间就是rfc3339标准格式
-- 或可以在连接数据库的时候,直接带该参数
influx -precision rfc3339
-- 查看一个measurement中所有的tag key 
show tag keys
-- 查看一个measurement中所有的field key 
show field keys
-- 查看一个measurement中所有的保存策略(可以有多个,一个标识为default)
show retention policies;


-grafana-


官网安装指南:https://grafana.com/docs/grafana/latest/installation/rpm/
安装依赖:yum install initscripts urw-fonts wget
wget https://dl.grafana.com/oss/release/grafana-7.3.0-1.x86_64.rpm
yum install grafana-7.3.0-1.x86_64.rpm 
grafana-cli plugins list-remote  # 查看可用插件
grafana-cli plugins install alexanderzobnin-zabbix-app  # 安装zabbix插件
插件安装位置:/var/lib/grafana/plugins
$ systemctl daemon-reload
$ systemctl start grafana-server
$ systemctl status grafana-server

grafana配置文件地址  /etc/grafana/grafana.ini


service grafana-server start 启动服务,打开浏览器,输入IP+端口,3000为Grafana的默认侦听端口。
系统默认用户名和密码为admin/admin,第一次登陆系统会要求修改密码,修改密码后登陆,
添加数据源 influxdb
    http 填入:http://localhost:8086
    influxdb detail databse: jmeter
    user: admin
    password: admin
    Min time interval: 5s
    
添加JMeter Load Test Dashboard (id=1152)(id=5496)


-node_exporter-


wget https://prometheus.io/download/#node_exporter
解压后 添加path
后台启动:node_exporter &
浏览器打开 http://101.201.233.207:9100  查看服务器监控信息


-prometheus-


wget  https://prometheus.io/download/ 
解压后 添加path
后台启动:prometheus &
修改配置文件:prometheus.yml
添加如下node_exporter监控:
- job_name: 'node'
    static_configs:
    - targets: ['localhost:9100']

重新启动 Prometheus Server
浏览器打开  http://101.201.233.207:9090/  输入up  显示node和Prometheus值为1

-grafana 添加 prometheus -


1.安装pie插件
官网:https://grafana.net/plugins/grafana-piechart-panel  
grafana-cli plugins install grafana-piechart-panel

添加prometheus数据源
导入 Prometheus Node Exporter Full 模板(id=1860)
浏览器打开: http://101.201.233.207:3000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值