前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Mac 电脑搭建监控开发环境

Mac 电脑搭建监控开发环境

原创
作者头像
Bob hadoop
修改2020-12-16 14:42:18
1.4K0
修改2020-12-16 14:42:18
举报
文章被收录于专栏:日常杂记

监控软件

软件选择

1、Grafana大屏展示

2、prometheus数据库

3、node_exporter采集

brew安装

代码语言:javascript
复制
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

安装好后

安装Grafana

代码语言:javascript
复制
brew update brew install grafana 

运行Grafana

代码语言:javascript
复制
brew services start grafana 

停止Grafana

代码语言:javascript
复制
brew services stop grafana 

升级Grafana

代码语言:javascript
复制
brew update brew reinstall grafana 

查看版本

代码语言:javascript
复制
grafana-server -v
代码语言:javascript
复制
Version 7.0.0 (commit: unknown-dev, branch: master)  grafana-server -v Version 7.2.0 (commit: unknown-dev, branch: master) 

登陆Grafana

默认用户名密码admin

代码语言:javascript
复制
http://localhost:3000/login

安装prometheus

代码语言:javascript
复制
brew install prometheus 

运行prometheus

代码语言:javascript
复制
brew services start prometheus 

停止prometheus

代码语言:javascript
复制
brew services stop prometheus 

带参数启动:参数意义可以热加载

代码语言:javascript
复制
prometheus --config.file=/usr/local/etc/prometheus.yml  --web.enable-lifecycle 2>&1 & 

页面访问

代码语言:javascript
复制
http://localhost:9090/graph

查看prometheus版本

代码语言:javascript
复制
prometheus --version

显示如下

代码语言:javascript
复制
prometheus, version 2.21.0 (branch: non-git, revision: non-git)

配置文件位置

代码语言:javascript
复制
/usr/local/etc/prometheus.yml
代码语言:javascript
复制
cat prometheus.yml
global:
  scrape_interval: 15s

  external_labels:
       monitor: 'codelab-monitor'
       origin_prometheus: 'whx'
scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]

更改相关配置就是在prometheus.yml文件里,实际我的开发配置如下

代码语言:javascript
复制
 cat prometheus.yml
global:
  scrape_interval: 15s

  external_labels:
       monitor: 'codelab-monitor'
       origin_prometheus: 'whx'
scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
    - targets: ["127.0.0.1:9100"]

  - job_name: 'cm_monitor'
    file_sd_configs:
    - files: ['/usr/local/etc/moniter_config/*.yml']
      refresh_interval: 5s

第一个job为prometheus,第二个为我安装的本机采集工具node_exporter,第三个为我自己写的Hadoop一些指标采集job,这里涉及了刮擦文件可以在prometheus.yml同级目录创建一个文件夹来防止要采集的机器端口,并且还可以创建rules文件夹。

代码语言:javascript
复制
bob@bob etc % ls -l
total 16
drwxr-xr-x  4 bob  admin  128 12 15 11:21 bash_completion.d
drwxr-xr-x  6 bob  admin  192 12 15 14:23 data
drwxr-xr-x  4 bob  admin  128 12 15 11:20 grafana
drwxr-xr-x  3 bob  admin   96 12 16 10:37 moniter_config
-rw-r--r--  1 bob  admin    0 12 15 14:38 node_exporter.args
-rw-r--r--  1 bob  admin  126 12 15 14:18 prometheus.args
-rw-r--r--  1 bob  admin  424 12 16 10:35 prometheus.yml

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 监控软件
  • brew安装
  • 安装Grafana
  • 安装prometheus
相关产品与服务
Grafana 服务
Grafana 服务(TencentCloud Managed Service for Grafana,TCMG)是腾讯云基于社区广受欢迎的开源可视化项目 Grafana ,并与 Grafana Lab 合作开发的托管服务。TCMG 为您提供安全、免运维 Grafana 的能力,内建腾讯云多种数据源插件,如 Prometheus 监控服务、容器服务、日志服务 、Graphite 和 InfluxDB 等,最终实现数据的统一可视化。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档