grafana管理基础配置

dashboard设置变量

       

       

 导入dashboard json方法

       

   删除dashboard

       

     新版删除操作

       

管理面板功能

       

展示模式

     1.展示了dashboard名称

     2.隐藏左边管理菜单栏

        

     3.隐藏dashboard名称

       

    4.dashboard分组

       

 变量设置

         

        

        

保存dashboard或者页面配置

     grafana要进行保存图表配置必须先登录,否则只能查看图表

       

       

 管理API Key

       

       可以通过此API KEY调用grafana的API接口

复制代码
update_prometheus_datasources()
{
  cat <<EOF
{
    "id": 1,
    "name": "Prometheus",
    "type": "prometheus",
    "access": "proxy",
    "url": "http://127.0.0.1:9090",
    "isDefault":true
}
EOF
}


curl -k -X PUT \
    -H "Authorization: Bearer eyJrIjoiMWNWejdKYWZKQ2dsMlpiMmNFNTRXUkxYcDEwdFVGTnkiLCJuIjoiaW5zdGFsbCIsImlkIjoxfQ==" \
    -H "Content-Type: application/json" \
    -d "$(update_prometheus_datasources)" http://127.0.0.1:3000/api/datasources/1
shell调用grafana api
复制代码

     

      grep -rn "Bearer" *

      * : 表示当前目录所有文件,也可以是某个文件名

grafana允许嵌入页面

        

Grafana配置nginx代理嵌套显示

复制代码
//这个nginx配置文件内容一点都不能变

location ^~ /devops/monitor/ {
  #请求全部转给后端的Grafana
  proxy_pass http://10.72.17.12:3000;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
nginx.conf
复制代码
复制代码
//grafana的配置文件需要的配置项目
# The http port to use
http_port = 3000

# The public facing domain name used to access grafana from a browser
domain = 10.72.17.12

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = false

# The full public facing url
root_url =  %(protocol)s://%(domain)s:%(http_port)s/devops/monitor/

# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
serve_from_sub_path = true

# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
allow_embedding = true

[auth.anonymous]
# enable anonymous access
enabled = true
grafana.ini
复制代码

     如果配置不对,嵌套的页面就会显示404或者proxy 配置错误

     

     

 

posted @   不懂123  阅读(600)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
历史上的今天:
2018-03-30 操作系统磁盘分区
点击右上角即可分享
微信分享提示