Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmpreceiver does not allow adding sysName.0 as attribute to polled metrics #23373

Closed
hhgsplk opened this issue Jun 14, 2023 · 5 comments
Closed
Labels
bug Something isn't working needs triage New item requiring triage receiver/snmp Stale

Comments

@hhgsplk
Copy link

hhgsplk commented Jun 14, 2023

Component(s)

receiver/snmp

What happened?

Description

to able to work with polled metrics, I need to add the polled endpoint to the metrics as an attribute so that I can break the metrics down by the polled target. The best way would be to add the sysName.0 of the correspondent target endpoint to the metrics that are polled.

Steps to Reproduce

set up a snmp demon (net-snmp for example). compile otel with snmpreceiver, use the otel config below.

Expected Result

the string saved in sysName.0 need to be shipped with the metrics.

Actual Result

2023-06-14T13:51:51.708+0200 info service/telemetry.go:104 Setting up own telemetry...
2023-06-14T13:51:51.710+0200 info service/telemetry.go:127 Serving Prometheus metrics {"address": ":8888", "level": "Basic"}
2023-06-14T13:51:51.711+0200 info [email protected]/exporter.go:275 Development component. May change in the future. {"kind": "exporter", "data_type": "metrics", "name": "logging"}
2023-06-14T13:51:51.712+0200 info [email protected]/memorylimiter.go:102 Memory limiter configured {"kind": "processor", "name": "memory_limiter", "pipeline": "metrics", "limit_mib": 1536, "spike_limit_mib": 512, "check_interval": 5}
2023-06-14T13:51:51.714+0200 info service/service.go:131 Starting otelcol... {"Version": "0.79.0-dev", "NumCPU": 5}
2023-06-14T13:51:51.714+0200 info extensions/extensions.go:30 Starting extensions...
2023-06-14T13:51:51.714+0200 info extensions/extensions.go:33 Extension is starting... {"kind": "extension", "name": "memory_ballast"}
2023-06-14T13:51:51.722+0200 info [email protected]/memory_ballast.go:41 Setting memory ballast {"kind": "extension", "name": "memory_ballast", "MiBs": 512}
2023-06-14T13:51:51.722+0200 info extensions/extensions.go:37 Extension started. {"kind": "extension", "name": "memory_ballast"}
2023-06-14T13:51:51.722+0200 info extensions/extensions.go:33 Extension is starting... {"kind": "extension", "name": "zpages"}
2023-06-14T13:51:51.722+0200 info [email protected]/zpagesextension.go:53 Registered zPages span processor on tracer provider {"kind": "extension", "name": "zpages"}
2023-06-14T13:51:51.722+0200 info [email protected]/zpagesextension.go:63 Registered Host's zPages {"kind": "extension", "name": "zpages"}
2023-06-14T13:51:51.723+0200 info [email protected]/zpagesextension.go:75 Starting zPages extension {"kind": "extension", "name": "zpages", "config": {"TCPAddr":{"Endpoint":"0.0.0.0:55679"}}}
2023-06-14T13:51:51.723+0200 info extensions/extensions.go:37 Extension started. {"kind": "extension", "name": "zpages"}
2023-06-14T13:51:51.723+0200 info service/service.go:148 Everything is ready. Begin running and processing data.
2023-06-14T13:51:51.727+0200 error scraperhelper/scrapercontroller.go:213 Error scraping metrics {"kind": "receiver", "name": "snmp", "data_type": "metrics", "error": "problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.16.1' from column OID '.1.3.6.1.2.1.2.2.1.16': not creating indexed metric 'ifOutOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.16.2' from column OID '.1.3.6.1.2.1.2.2.1.16': not creating indexed metric 'ifOutOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.10.1' from column OID '.1.3.6.1.2.1.2.2.1.10': not creating indexed metric 'ifInOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.10.2' from column OID '.1.3.6.1.2.1.2.2.1.10': not creating indexed metric 'ifInOctets' or resource: related resource attribute value is blank", "scraper": "snmp"}
go.opentelemetry.io/collector/receiver/scraperhelper.(*controller).scrapeMetricsAndReport
go.opentelemetry.io/collector/[email protected]/scraperhelper/scrapercontroller.go:213
go.opentelemetry.io/collector/receiver/scraperhelper.(*controller).startScraping.func1
go.opentelemetry.io/collector/[email protected]/scraperhelper/scrapercontroller.go:188
^C2023-06-14T13:51:53.446+0200 info otelcol/collector.go:227 Received signal from OS {"signal": "interrupt"}
2023-06-14T13:51:53.446+0200 info service/service.go:157 Starting shutdown...
2023-06-14T13:51:53.446+0200 info extensions/extensions.go:44 Stopping extensions...
2023-06-14T13:51:53.447+0200 info [email protected]/zpagesextension.go:98 Unregistered zPages span processor on tracer provider {"kind": "extension", "name": "zpages"}
2023-06-14T13:51:53.447+0200 info service/service.go:171 Shutdown complete.

Collector version

0.7.9

Environment information

Environment

OS:
root@eiffel:/opt/osotel# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

Compiler(if manually compiled): (e.g., "go 14.2")
root@eiffel:/opt/osotel# go version
go version go1.20.5 linux/amd64

OpenTelemetry Collector configuration

extensions:
  memory_ballast:
    size_mib: 512
  zpages:
    endpoint: 0.0.0.0:55679

receivers:
  snmp:
    collection_interval: 10s
    endpoint: udp://127.0.0.1:161
    version: v2c
    community: testing

    attributes:
      ifDescr:
        oid: "1.3.6.1.2.1.2.2.1.2"

    resource_attributes:
      sysName:
        oid: "1.3.6.1.2.1.1.5.0"


    metrics:
      ifInOctets:
        description: "Interface Incoming Bytes"
        unit: "By"
        sum:
          aggregation: cumulative
          monotonic: true
          value_type: int
        column_oids:
          - oid: "1.3.6.1.2.1.2.2.1.10"
            attributes:
              - name: ifDescr
            resource_attributes:
              - sysName

      ifOutOctets:
        description: "Interface Outgoing Bytes"
        unit: "By"
        sum:
          aggregation: cumulative
          monotonic: true
          value_type: int
        column_oids:
          - oid: "1.3.6.1.2.1.2.2.1.16"
            attributes:
              - name: ifDescr
            resource_attributes:
              - sysName

processors:
  batch:
  memory_limiter:
    limit_mib: 1536
    spike_limit_mib: 512
    check_interval: 5s

exporters:
  logging:
    verbosity: detailed
    sampling_initial: 5
    sampling_thereafter: 200
  file/no_rotation:
    path: /tmp/snmp.json

service:
  pipelines:
    metrics:
      receivers: [snmp]
      processors: [memory_limiter, batch]
      exporters: [logging, file/no_rotation]
  extensions: [memory_ballast, zpages]

Log output

2023-06-14T13:54:50.825+0200	error	scraperhelper/scrapercontroller.go:213	Error scraping metrics	{"kind": "receiver", "name": "snmp", "data_type": "metrics", "error": "problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.16.1' from column OID '.1.3.6.1.2.1.2.2.1.16': not creating indexed metric 'ifOutOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.16.2' from column OID '.1.3.6.1.2.1.2.2.1.16': not creating indexed metric 'ifOutOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.10.1' from column OID '.1.3.6.1.2.1.2.2.1.10': not creating indexed metric 'ifInOctets' or resource: related resource attribute value is blank; problem processing indexed metric data for OID '.1.3.6.1.2.1.2.2.1.10.2' from column OID '.1.3.6.1.2.1.2.2.1.10': not creating indexed metric 'ifInOctets' or resource: related resource attribute value is blank", "scraper": "snmp"}

Additional context

No response

@hhgsplk hhgsplk added bug Something isn't working needs triage New item requiring triage labels Jun 14, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@djaglowski
Copy link
Member

@StefanKurek, this seems reasonable to me. Any reservations about this change?

@StefanKurek
Copy link
Contributor

@djaglowski the suggestion seems like a reasonable one.

There would most likely be some significant changes under the hood as currently only indexed OIDs (for both attributes and resource attributes) can be matched to indexed metrics (metrics that use indexed OIDs). This would need to be modified pretty significantly (most likely) so that resource attributes and attributes could be differentiated in the configs from being indexed or scalar based. Then we could have another path so that indexed metrics could make a connection to single value attributes or resource attributes.

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Aug 22, 2023
djaglowski pushed a commit that referenced this issue Aug 29, 2023
…ave scalar OID attributes (#25174)

**Description:** <Describe what has changed.>
- Added a new scalar_oid field to ResourceAttribtueConfigs to allow
Scalar OIDs to be used as resource attributes (on Column OID metrics)
- Added support for (Scalar OID only) resource attributes on Scalar OID
metrics as well.

**Link to tracking Issue:** 

#23373

**Testing:** 
- Valid and invalid configs using a scalar_oid resource attribute on
both scalar and column oid metrics
- Adding indexed metrics to resources with scalar_oid resource
attributes
- Adding scalar metrics to resources with scalar_oid resource attributes

**Documentation:** <Describe the documentation added.>
- Description of new scalar_oid field in ResourceAttributeConfig and
comments on new functions
- Description of new ResourceAttributes field on Scalar OID metrics
@djaglowski
Copy link
Member

Closed by #25174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New item requiring triage receiver/snmp Stale
Projects
None yet
Development

No branches or pull requests

3 participants