Prometheus SNMP Exporter: Network Monitoring Tutorial!

Prometheus SNMP Exporter: Network Monitoring Tutorial!

19.216 Lượt nghe
Prometheus SNMP Exporter: Network Monitoring Tutorial!
Master network monitoring with this comprehensive tutorial on Prometheus SNMP Exporter and Grafana. Learn how to efficiently collect network device metrics using Prometheus SNMP Exporter and visualize them into actionable insights with stunning Grafana dashboards. Discover how to create custom dashboards, troubleshoot common issues, and unlock the full potential of Prometheus and Grafana for your network monitoring needs. For business inqueries or consultation send me an email to: [email protected] Join Discord: https://discord.gg/aj5FhGhcMy Snmpwalk confirmation snmpwalk -v3 -l authPriv -u admin -a SHA -A "PWt89voowUiDcJBi9boiSM" -x AES -X "PWt89voowUiDcJBi9boiSM" 192.168.0.84 #### snmp exporter docker compose file #### --- services: snmp-exporter: container_name: snmp-exporter image: quay.io/prometheus/snmp-exporter:v0.26.0 ports: - "9116:9116" - "161:161/udp" volumes: - ./config:/etc/snmp-exporter command: --config.file=/etc/snmp-exporter/snmp.yml restart: unless-stopped networks: prometheus_frontend: ipv4_address: 172.19.0.12 networks: prometheus_frontend: external: true #### Git clone snmp_exporter project #### git clone https://github.com/prometheus/snmp_exporter.git #### Install dependencies and compile generator #### Debian-based distributions. sudo apt-get install unzip build-essential libsnmp-dev # Debian-based distros Redhat-based distributions. sudo yum install gcc make net-snmp net-snmp-utils net-snmp-libs net-snmp-devel golang #### Compile generator #### make generator mibs #### Generator config modification #### walk: - sysUpTime - interfaces - ifXTable - sysName - ifHCInOctets - ifHCOutOctets - ifInErrors - ifOutErrors #### Prometheus docker configuration #### --- services: prometheus: image: prom/prometheus:v2.53.0 container_name: prometheus ports: - "9090:9090" volumes: - ./prometheus:/etc/prometheus - ./prometheus-data:/prometheus command: "--config.file=/etc/prometheus/prometheus.yml" restart: unless-stopped networks: frontend: ipv4_address: 172.19.0.11 networks: frontend: driver: bridge ipam: config: - subnet: 172.19.0.0/16 gateway: 172.19.0.1 #### Prometheus conf file #### --- global: scrape_interval: 15s scrape_configs: - job_name: 'snmp' static_configs: - targets: - 192.168.0.84 # SNMP device. metrics_path: /snmp params: auth: [public_v3] module: [if_mib] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 192.168.0.153:9116 # The SNMP exporter's real hostname:port. #### Grafana docker configuration #### --- services: grafana: image: grafana/grafana-oss:10.2.8 container_name: grafana ports: - "3000:3000" volumes: - ./grafana-data:/var/lib/grafana restart: unless-stopped networks: prometheus_frontend: ipv4_address: 172.19.0.13 networks: prometheus_frontend: external: true #### Grafana Dashboard #### Total Traffic sum(irate(ifHCInOctets{instance="$Device"}[$__rate_interval]) * 8) sum(irate(ifHCOutOctets{instance="$Device"}[$__rate_interval]) * 8) IN & OUT per interface irate(ifHCInOctets{instance="192.168.0.84",ifIndex="2"}[$__rate_interval]) * 8 irate(ifHCOutOctets{instance="192.168.0.84",ifIndex="2"}[$__rate_interval]) * 8 Uptime sysUpTime{instance="$Device"} * 10 System name sysName{instance="$Device"} For business inqueries or consultation send me an email to: [email protected] 0:00 - What you need 0:23 - Unifi SNMP v3 1:08 - Linux snmp tools 2:43 - snmp exporter docker compose 4:11 - snmp generator 5:49 - generator config 7:11 - snmp compiled config 8:25 - prometheus docker compose 10:34 - snmp exporter container confirmation 11:17 - grafana docker compose 12:26 - prometheus data source 13:13 - grafana snmp dashboards 13:41 - fixing prometheus 14:21 - switch hostname panel 15:15 - switch total traffic panel 17:48 - switch port traffic panel 19:32 - switch uptime panel #prometheus #snmp #snmp_exporter #networkmonitoring #devops