title: SNMP Exporter (prometheus) + Extend OID
body: <p>I'm new on Prometheus and i'm trying to monitor some extend OID I created with the snmp_exporter, but it doesn't work as expected.</p>
  
  <p>My script just does an "echo $VALUE" (value is an integer or a string).</p>
  
  <p>I have this snmpd.conf :</p>
  
  <pre><code>extend value-return-test /usr/local/bin/script.sh
  </code></pre>
  
  <p>I generated his OID :</p>
  
  <pre><code>snmpwalk -v2c -c public localhost NET-SNMP-EXTEND-MIB::nsExtendResult.\"value-return-test\" -On
  </code></pre>
  
  <p>Now I'm able to get all the snmp extend link to my configuration :</p>
  
  <pre><code>snmpwalk -v2c -c public localhost NET-SNMP-EXTEND-MIB::nsExtendObjects |grep value-return-test
  </code></pre>
  
  <p>Now, here is my prometheus configuration prometheus.yml :</p>
  
  <pre><code>global:
    scrape_interval: 5s
  
    - job_name: 'snmp'
      metrics_path: /snmp
      params:
        module: [tests]
      static_configs:
        - targets:
          - 127.0.0.1  # SNMP device - add your IPs here
      relabel_configs:
        - source_labels: [__address__]
          target_label: __param_target
        - source_labels: [__param_target]
          target_label: instance
        - target_label: __address__
          replacement: 127.0.0.1:9116  # SNMP exporter.
  </code></pre>
  
  <p>and my snmp.yaml :</p>
  
  <pre><code>tests:
    walk:
    - 1.3.6.1.4.1.8072.1.3.2.4.1.2.23.109.97.105.108.45.113.117.101.117.101.45.115.101.110.100.105.110.103.45.114.97.116.101.1
    - 1.3.6.1.4.1.8072.1.3.2.4.1.2.23.109.97.105.108.45.113.117.101.117.101.45.115.101.110.100.105.110.103.45.114.97.116.101.2
    metrics:
    - name: snmp_test1
      oid: 1.3.6.1.4.1.8072.1.3.2.4.1.2.23.109.97.105.108.45.113.117.101.117.101.45.115.101.110.100.105.110.103.45.114.97.116.101.1
      type: DisplayString
      indexes:
      - labelname: ifIndex
        type: Integer32
    - name: snmp_test2
      oid: 1.3.6.1.4.1.8072.1.3.2.4.1.2.23.109.97.105.108.45.113.117.101.117.101.45.115.101.110.100.105.110.103.45.114.97.116.101.2
      type: DisplayString
      indexes:
      - labelname: ifIndex
        type: Integer32
  </code></pre>
  
  <p>With that configuration I'm not able to get my value on the page <a href="http://localhost:9116/snmp?target=127.0.0.1&amp;module=tests" rel="nofollow noreferrer">http://localhost:9116/snmp?target=127.0.0.1&amp;module=tests</a> :</p>
  
  <pre><code># HELP snmp_scrape_duration_seconds Total SNMP time scrape took (walk and processing).
  # TYPE snmp_scrape_duration_seconds gauge
  snmp_scrape_duration_seconds 0.004676028
  # HELP snmp_scrape_pdus_returned PDUs returned from walk.
  # TYPE snmp_scrape_pdus_returned gauge
  snmp_scrape_pdus_returned 0
  # HELP snmp_scrape_walk_duration_seconds Time SNMP walk/bulkwalk took.
  # TYPE snmp_scrape_walk_duration_seconds gauge
  snmp_scrape_walk_duration_seconds 0.004477656
  </code></pre>
  
  <p>However if I put my configuration into an other block like the if_mib, I'm able to get the values BUT they are put in the wrong place :
  <a href="https://i.stack.imgur.com/4qUsK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4qUsK.png" alt="enter image description here"></a></p>
  
  <p>As you can see I got the value "1" instead of "6".</p>
  
  <p>I also tried the snmp exporter generator but i'm not able to build it :</p>
  
  <pre><code>$ go build
  # github.com/prometheus/snmp_exporter/generator
  ./net_snmp.go:6:38: fatal error: net-snmp/net-snmp-config.h: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>Thanks for your help</p>