SNMP Exporter - Different Community Strings/ Different Jobs

3,789 views
Skip to first unread message

jmdar...@gmail.com

unread,
Apr 29, 2018, 5:17:36 AM4/29/18
to Prometheus Users

Hi All,

snmp exporter (version=0.9.0)
Promethus:  version 2.2.1
Ubuntu: 16:04 LTS
go version go1.6.2 linux/amd64


What is the correct way to monitor network devices with different community strings?
I'm trying to use different jobs to monitor network traffic on routers with different community strings. Configs are belows. The snmp job using the office_gateway module is working as expected,
however the second job, cores using the cores module returns the following error:

 Apr 28 13:57:02 monitoring prometheus[24905]: level=warn ts=2018-04-28T04:57:02.385905948Z caller=scrape.go:696 component="scrape manager" scrape_pool=cores target="http://192.168.0.245:9116/cores?module=cores&target=192.168.0.61" msg="append failed" err="no  token found"

At present, this is all I need to monitor so snmp.yml has been created manually.  



# snmp.yml


office_gateway
:
  version
: 2
  auth
:
    community
: some-community


  walk
:
 
- 1.3.6.1.2.1.1.3 # sysUpTime
 
- 1.3.6.1.2.1.31.1 # ifHCInOctets
 
- 1.3.6.1.2.1.2.2.1.10 # ifInOctets
 
- 1.3.6.1.2.1.2.2.1.16
 
- 1.3.6.1.2.1.31.1.1.1


 
- name: ifHCInOctets
    oid
: 1.3.6.1.2.1.31.1.1.1.6
    type
: counter
    indexes
:
   
- labelname: interface
      type
: gauge
    lookups
:
     
- labels: [interface]
        oid
: 1.3.6.1.2.1.2.2.1.2
        labelname
: DisplayString
     
- labels: [interface]
        oid
: 1.3.6.1.2.1.31.1.1.1.18
        labelname
: alias
        type
: DisplayString
       
cores
:
  version
: 2
  auth
:
    community
: a-different-community


  walk
:
 
- 1.3.6.1.2.1.1.3 # sysUpTime
 
- 1.3.6.1.2.1.31.1 # ifHCInOctets
 
- 1.3.6.1.2.1.2.2.1.10 # ifInOctets
 
- 1.3.6.1.2.1.2.2.1.16
 
- 1.3.6.1.2.1.31.1.1.1


  metrics
:
 
- name: ifHCInOctets
    oid
: 1.3.6.1.2.1.31.1.1.1.6
    type
: counter
    indexes
:
   
- labelname: interface
      type
: gauge
    lookups
:
     
- labels: [interface]
        oid
: 1.3.6.1.2.1.2.2.1.2
        labelname
: DisplayString
     
- labels: [interface]
        oid
: 1.3.6.1.2.1.31.1.1.1.18
        labelname
: alias
        type
: DisplayString



             
#prometheus.yml
 
 - job_name: 'snmp'
    scrape_interval
: "10s"
    metrics_path
: /snmp
    params:
      module: [office_gateway]
    static_configs:
      - targets: ['192.168.100.254']
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.0.245:9116


  - job_name: 'cores'
    scrape_interval: "10s"
    metrics_path: /
cores
   
params:
     
module: [cores]
    static_configs
:
     
- targets: ['192.168.0.61']
    relabel_configs
:
     
- source_labels: [__address__]
        target_label
: __param_target
     
- source_labels: [__param_target]
        target_label
: instance
     
- target_label: __address__
        replacement
: 192.168.0.245:9116

        
        

Brian Brazil

unread,
Apr 29, 2018, 5:24:22 AM4/29/18
to jmdar...@gmail.com, Prometheus Users
Don't change the path, it should remain /snmp.

Brian
 
    params:
     
module: [cores]
    static_configs
:
     
- targets: ['192.168.0.61']
    relabel_configs
:
     
- source_labels: [__address__]
        target_label
: __param_target
     
- source_labels: [__param_target]
        target_label
: instance
     
- target_label: __address__
        replacement
: 192.168.0.245:9116

        
        

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5b0ba6f7-387a-4309-93b7-186cf50d3d9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

John Darville

unread,
Apr 29, 2018, 5:47:29 AM4/29/18
to Brian Brazil, Prometheus Users

Hi Brian,

Thanks a lot, it works great now.

John 
Reply all
Reply to author
Forward
0 new messages