使用Prometheus监控Padavan路由器

2023-12-04 02:04

本文主要是介绍使用Prometheus监控Padavan路由器,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Prometheus监控Padavan路由器

1、背景

近期在Synology(群辉)中安装一套Prometheus监控程序,目前已经监控Synology,然后家中有有路由器(Padavan)型号,也准备使用Prometheus+Grafan进行监控。

环境:

Prometheus:2.48.0

Grafan:10

Padavan:固件版本:3.4.3.9-099_22-05-1

image

2、监控步骤

1、padavan_exporter 正确使用

地址:https://github.com/Bpazy/padavan_exporter/blob/master/README-zh_CN.md

padavan_exporter有两种方式(不是放到Padavan系统上的)

  1. 安装到Linux操作系统,通过ssh连接到路由器进行数据获取
  2. 安装到Docker上,通过ssh连接到路由器进行数据获取
Linux操作系统

在Linux操作系统下载padavan_exporter

参数使用

$ ./padavan_exporter --help
Flags:--help                        Show context-sensitive help (also try--help-long and --help-man).--web.listen-address=":9100"  Address on which to expose metrics and webinterface--padavan.ssh.host="127.0.0.1:22"Padavan ssh host--padavan.ssh.username="admin"Padavan ssh username--padavan.ssh.password="admin"Padavan ssh password--debug                       Debug mode

安装 padavan_exporter 并使用正确的参数启动(点击跳转项目首页)

wget https://github.com/Bpazy/padavan_exporter/releases/download/v0.0.2/padavan_exporter-linux-amd64-v0.0.2
sudo mv ./padavan_exporter-linux-amd64-v0.0.2 /usr/local/bin/padavan_exporter
sudo chmod u=rwx,o=rx,g=rx /usr/local/bin/padavan_exporter
sudo chgrp root /usr/local/bin/padavan_exporter
sudo chown root /usr/local/bin/padavan_exporter# 自定义 systemd service
sudo touch /lib/systemd/system/padavan_exporter.service
sudo cat <<EOF >/lib/systemd/system/padavan_exporter.service
[Unit]
Description=Node exporter
After=network.target[Service]
Type=simple
ExecStart=/usr/local/bin/padavan_exporter  --padavan.ssh.host="127.0.0.1:22"  --padavan.ssh.username="admin"  --padavan.ssh.password="admin"
Restart=on-failure[Install]
WantedBy=multi-user.target
EOF# 加载自定义的 service
sudo systemctl daemon-reload
# 开机自启
sudo systemctl enable padavan_exporter 
# 启动
sudo systemctl start padavan_exporter 

Docker Compose(推荐)

当然更好的方式是使用 Docker Compose,你可以参考本项目预置的 docker-compose.yml 文件。

此处要注意,我把9100端口 映射到 9101,因为 我的 9100端口已经被占用,你们要注意

version: '3'
services:padavan_exporter:image: bpazy/padavan_exporter:latestrestart: alwaysports:- "9101:9100"command: ["--padavan.ssh.host=192.168.123.1:22", "--padavan.ssh.username=admin", "--padavan.ssh.password=admin"]

image

测试数据

image

Prometheus修改配置重载
- job_name: 'padavan'static_configs:- targets: ['192.168.123.200:9101']

2、Grafana 导入图形

这个图在Dashboard: https://grafana.com/grafana/dashboards/15978 进行修改 根补充

Padavan

如果导入没数据,请编辑
在这里插入图片描述

然后在Prometheus上进行调试
在这里插入图片描述

下载Json文件导入
Padavan-1701611865144.json

{"__inputs": [{"name": "DS_PROMETHEUS","label": "Prometheus","description": "","type": "datasource","pluginId": "prometheus","pluginName": "Prometheus"}],"__elements": {},"__requires": [{"type": "grafana","id": "grafana","name": "Grafana","version": "10.2.2"},{"type": "panel","id": "graph","name": "Graph (old)"},{"type": "datasource","id": "prometheus","name": "Prometheus","version": "1.0.0"},{"type": "panel","id": "timeseries","name": "Time series"}],"annotations": {"list": [{"builtIn": 1,"datasource": {"type": "datasource","uid": "grafana"},"enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]},"description": "Padavan exporter's Dashboard 南宫乘风 fix ","editable": true,"fiscalYearStartMonth": 0,"gnetId": 15978,"graphTooltip": 2,"id": null,"links": [{"asDropdown": false,"icon": "external link","includeVars": false,"keepTime": false,"tags": [],"targetBlank": false,"title": "如果不显示数据,请手动修改 页面中的标签数据(请点击,请查询博客教程)","tooltip": "","type": "link","url": "https://blog.csdn.net/heian_99"}],"liveNow": false,"panels": [{"collapsed": false,"gridPos": {"h": 1,"w": 24,"x": 0,"y": 0},"id": 9,"panels": [],"title": "基础信息","type": "row"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisBorderShow": true,"axisCenteredZero": false,"axisColorMode": "text","axisLabel": "负载","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 0,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"insertNulls": false,"lineInterpolation": "linear","lineWidth": 2,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"decimals": 2,"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]}},"overrides": []},"gridPos": {"h": 9,"w": 11,"x": 0,"y": 1},"id": 15,"options": {"legend": {"calcs": ["max","min","mean"],"displayMode": "table","placement": "bottom","showLegend": true},"tooltip": {"mode": "multi","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "node_load1{job=\"padavan\"}","instant": false,"legendFormat": "1分钟负载","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "node_load5{job=\"padavan\"}","hide": false,"instant": false,"legendFormat": "5分钟负载","range": true,"refId": "B"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "node_load15{job=\"padavan\"}","hide": false,"instant": false,"legendFormat": "15分钟负载","range": true,"refId": "C"}],"title": "设备负载","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"description": "","fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisBorderShow": false,"axisCenteredZero": false,"axisColorMode": "text","axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "line","fillOpacity": 25,"gradientMode": "none","hideFrom": {"legend": false,"tooltip": false,"viz": false},"insertNulls": false,"lineInterpolation": "smooth","lineStyle": {"fill": "solid"},"lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "none"},"thresholdsStyle": {"mode": "off"}},"fieldMinMax": true,"mappings": [],"min": 0,"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "percent"},"overrides": []},"gridPos": {"h": 9,"w": 12,"x": 11,"y": 1},"id": 14,"options": {"legend": {"calcs": ["max","min","mean"],"displayMode": "table","placement": "bottom","showLegend": true},"tooltip": {"mode": "multi","sort": "none"}},"targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "100- (\r\n  (\r\n    sum without (mode) (rate(node_cpu_seconds_total{job=\"padavan\", cpu=\"cpu\"}[5m]))\r\n    -\r\n    sum without (mode) (rate(node_cpu_seconds_total{job=\"padavan\",cpu=\"cpu\", mode=\"idle\"}[5m]))\r\n  ) / \r\n  sum without (mode) (rate(node_cpu_seconds_total{job=\"padavan\",cpu=\"cpu\"}[5m]))\r\n) * 100","instant": false,"legendFormat": "cpu使用率","range": true,"refId": "A"}],"title": "CPU使用率","type": "timeseries"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"description": "1H路由器数据","fieldConfig": {"defaults": {"color": {"mode": "palette-classic"},"custom": {"axisBorderShow": true,"axisCenteredZero": false,"axisColorMode": "text","axisLabel": "","axisPlacement": "auto","barAlignment": 0,"drawStyle": "bars","fillOpacity": 100,"gradientMode": "hue","hideFrom": {"legend": false,"tooltip": false,"viz": false},"insertNulls": false,"lineInterpolation": "linear","lineWidth": 1,"pointSize": 5,"scaleDistribution": {"type": "linear"},"showPoints": "auto","spanNulls": false,"stacking": {"group": "A","mode": "percent"},"thresholdsStyle": {"mode": "off"}},"decimals": 2,"fieldMinMax": false,"mappings": [],"thresholds": {"mode": "absolute","steps": [{"color": "green","value": null},{"color": "red","value": 80}]},"unit": "bytes"},"overrides": []},"gridPos": {"h": 9,"w": 11,"x": 0,"y": 10},"id": 8,"options": {"legend": {"calcs": [],"displayMode": "list","placement": "bottom","showLegend": true},"tooltip": {"mode": "multi","sort": "none"}},"pluginVersion": "10.2.2","targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "increase(node_network_receive_bytes_total{job=\"padavan\",device=~'br0|eth2.2'}[1h])","format": "time_series","interval": "30m","legendFormat": "{{device}} 下载","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","exemplar": false,"expr": "increase(node_network_transmit_bytes_total{job=\"padavan\",device=~'eth2|br0|eth2.2'}[1h])","interval": "30m","legendFormat": "{{device}}  上传","range": true,"refId": "B"}],"title": "1H路由器数据","type": "timeseries"},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"description": "","fieldConfig": {"defaults": {"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 9,"w": 12,"x": 11,"y": 10},"hiddenSeries": false,"id": 4,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"nullPointMode": "null","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "10.2.2","pointradius": 2,"points": false,"renderer": "flot","seriesOverrides": [{"$$hashKey": "object:250","alias": "ppp0 receive rate","color": "#5794F2","fill": 0,"yaxis": 2},{"$$hashKey": "object:251","alias": "ppp0 receive total","color": "#B877D9"}],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "increase(node_network_receive_bytes_total{job=\"padavan\", device=~\"eth2.2|br0\"}[1000w])","interval": "","legendFormat": "{{device}} 接收总数","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "rate(node_network_receive_bytes_total{device=~\"eth2.2|br0\", job=\"padavan\"}[1m])","interval": "","legendFormat": "{{device}}  接收速率","range": true,"refId": "B"}],"thresholds": [],"timeRegions": [],"title": "网络下载总计","tooltip": {"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"mode": "time","show": true,"values": []},"yaxes": [{"$$hashKey": "object:268","format": "decbytes","label": "Receive Total","logBase": 1,"show": true},{"$$hashKey": "object:269","format": "Bps","label": "Receive Rate","logBase": 1,"show": true}],"yaxis": {"align": false}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"description": "","fieldConfig": {"defaults": {"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 9,"w": 11,"x": 0,"y": 19},"hiddenSeries": false,"id": 6,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"nullPointMode": "null","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "10.2.2","pointradius": 2,"points": false,"renderer": "flot","seriesOverrides": [{"$$hashKey": "object:824","alias": "ppp0 download bandwidth","color": "#5794F2"},{"$$hashKey": "object:825","alias": "ppp0 upload bandwidth","color": "#73BF69"}],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "rate(node_network_transmit_bytes_total{device=~\"eth2.2|br0\",  job=\"padavan\"}[1m])*8","instant": false,"interval": "","legendFormat": "{{device}} 上传","refId": "A"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "rate(node_network_receive_bytes_total{device=~\"eth2.2|br0\",  job=\"padavan\"}[1m])*8","instant": false,"interval": "","legendFormat": "{{device}} 下载","refId": "B"}],"thresholds": [],"timeRegions": [],"title": "网络带宽","tooltip": {"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"mode": "time","show": true,"values": []},"yaxes": [{"$$hashKey": "object:838","format": "decbits","label": "","logBase": 1,"show": true},{"$$hashKey": "object:839","format": "short","label": "","logBase": 1,"show": false}],"yaxis": {"align": false}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"fieldConfig": {"defaults": {"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 9,"w": 12,"x": 11,"y": 19},"hiddenSeries": false,"id": 2,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"nullPointMode": "null","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "10.2.2","pointradius": 2,"points": false,"renderer": "flot","seriesOverrides": [{"$$hashKey": "object:723","alias": "ppp0 transmit rate","color": "#73BF69","fill": 0,"yaxis": 2},{"$$hashKey": "object:724","alias": "ppp0 transmit total","color": "#B877D9"}],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "increase(node_network_transmit_bytes_total{job=\"padavan\",  device=~\"eth2.2|br0\"}[1000w])","interval": "","legendFormat": "{{device}} 上传总计","range": true,"refId": "A"},{"datasource": {"type": "prometheus","uid": "${DS_PROMETHEUS}"},"editorMode": "code","expr": "rate(node_network_transmit_bytes_total{device=~\"eth2.2|br0\", job=\"padavan\"}[1m])","interval": "","legendFormat": "{{device}} 上传速率","range": true,"refId": "B"}],"thresholds": [],"timeRegions": [],"title": "网络上传总计","tooltip": {"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"mode": "time","show": true,"values": []},"yaxes": [{"$$hashKey": "object:741","format": "decbytes","label": "Transmit Total","logBase": 1,"show": true},{"$$hashKey": "object:742","format": "Bps","label": "Transmit Rate","logBase": 1,"show": true}],"yaxis": {"align": false,"alignLevel": 0}}],"refresh": "10s","schemaVersion": 38,"tags": ["jokersy"],"templating": {"list": []},"time": {"from": "now-1h","to": "now"},"timepicker": {"refresh_intervals": ["10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone": "","title": "Padavan","uid": "5BoX3my7z","version": 30,"weekStart": ""
}

这篇关于使用Prometheus监控Padavan路由器的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/451702

相关文章

流媒体平台/视频监控/安防视频汇聚EasyCVR播放暂停后视频画面黑屏是什么原因?

视频智能分析/视频监控/安防监控综合管理系统EasyCVR视频汇聚融合平台,是TSINGSEE青犀视频垂直深耕音视频流媒体技术、AI智能技术领域的杰出成果。该平台以其强大的视频处理、汇聚与融合能力,在构建全栈视频监控系统中展现出了独特的优势。视频监控管理系统EasyCVR平台内置了强大的视频解码、转码、压缩等技术,能够处理多种视频流格式,并以多种格式(RTMP、RTSP、HTTP-FLV、WebS

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

综合安防管理平台LntonAIServer视频监控汇聚抖动检测算法优势

LntonAIServer视频质量诊断功能中的抖动检测是一个专门针对视频稳定性进行分析的功能。抖动通常是指视频帧之间的不必要运动,这种运动可能是由于摄像机的移动、传输中的错误或编解码问题导致的。抖动检测对于确保视频内容的平滑性和观看体验至关重要。 优势 1. 提高图像质量 - 清晰度提升:减少抖动,提高图像的清晰度和细节表现力,使得监控画面更加真实可信。 - 细节增强:在低光条件下,抖

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

pdfmake生成pdf的使用

实际项目中有时会有根据填写的表单数据或者其他格式的数据,将数据自动填充到pdf文件中根据固定模板生成pdf文件的需求 文章目录 利用pdfmake生成pdf文件1.下载安装pdfmake第三方包2.封装生成pdf文件的共用配置3.生成pdf文件的文件模板内容4.调用方法生成pdf 利用pdfmake生成pdf文件 1.下载安装pdfmake第三方包 npm i pdfma

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]