Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .chloggen/ciscoosreceiver-initial-skeleton.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: new_component

# The name of the component (path or short name is acceptable)
component: receiver/ciscoosreceiver

# A brief description of the change
note: "Add initial skeleton of Cisco OS receiver (README, config, factory, metadata) with In Development stability."

# Mandatory: tracking issues (use PR number if no issue exists)
issues: [42647]

# Optional: additional lines shown under the main note
subtext: |
This PR adds structure only (no scraping implementation yet).
Scrapers and SSH-based collection logic (BGP, Environment, Facts, Interfaces, Optics) will be added in follow-up PRs.

# Change logs where this entry should appear
change_logs: [user]
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,10 @@ component_management:
name: receiver_chrony
paths:
- receiver/chronyreceiver/**
- component_id: receiver_ciscoos
name: receiver_ciscoos
paths:
- receiver/ciscoosreceiver/**
- component_id: receiver_cloudflare
name: receiver_cloudflare
paths:
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ receiver/azureblobreceiver/ @open-telemetry
receiver/azureeventhubreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @cparkins @dyl10s
receiver/azuremonitorreceiver/ @open-telemetry/collector-contrib-approvers @nslaughter @celian-garcia @ishleenk17
receiver/chronyreceiver/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @jamesmoessis
receiver/ciscoosreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax
receiver/cloudflarereceiver/ @open-telemetry/collector-contrib-approvers @dehaansa
receiver/cloudfoundryreceiver/ @open-telemetry/collector-contrib-approvers @crobert-1
receiver/collectdreceiver/ @open-telemetry/collector-contrib-approvers @atoulme
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/beta_stability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ body:
- receiver/bigip
- receiver/carbon
- receiver/chrony
- receiver/ciscoos
- receiver/cloudflare
- receiver/cloudfoundry
- receiver/collectd
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ body:
- receiver/bigip
- receiver/carbon
- receiver/chrony
- receiver/ciscoos
- receiver/cloudflare
- receiver/cloudfoundry
- receiver/collectd
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ body:
- receiver/bigip
- receiver/carbon
- receiver/chrony
- receiver/ciscoos
- receiver/cloudflare
- receiver/cloudfoundry
- receiver/collectd
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ body:
- receiver/bigip
- receiver/carbon
- receiver/chrony
- receiver/ciscoos
- receiver/cloudflare
- receiver/cloudfoundry
- receiver/collectd
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ body:
- receiver/bigip
- receiver/carbon
- receiver/chrony
- receiver/ciscoos
- receiver/cloudflare
- receiver/cloudfoundry
- receiver/collectd
Expand Down
1 change: 1 addition & 0 deletions .github/component_labels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ receiver/azureblobreceiver receiver/azureblob
receiver/azureeventhubreceiver receiver/azureeventhub
receiver/azuremonitorreceiver receiver/azuremonitor
receiver/chronyreceiver receiver/chrony
receiver/ciscoosreceiver receiver/ciscoos
receiver/cloudflarereceiver receiver/cloudflare
receiver/cloudfoundryreceiver receiver/cloudfoundry
receiver/collectdreceiver receiver/collectd
Expand Down
2 changes: 0 additions & 2 deletions cmd/githubgen/allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
KiranmayiB
jordivilaseca
MoreraAlejandro
1 change: 1 addition & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ receivers:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver v0.135.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/collectdreceiver v0.135.0
Expand Down
1 change: 1 addition & 0 deletions internal/tidylist/tidylist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ receiver/azureeventhubreceiver
receiver/azuremonitorreceiver
receiver/bigipreceiver
receiver/chronyreceiver
receiver/ciscoosreceiver
receiver/cloudflarereceiver
receiver/cloudfoundryreceiver
receiver/collectdreceiver
Expand Down
1 change: 1 addition & 0 deletions receiver/ciscoosreceiver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
92 changes: 92 additions & 0 deletions receiver/ciscoosreceiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Cisco OS Receiver

<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [development]: metrics |
| Distributions | [] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fciscoos%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fciscoos) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fciscoos%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fciscoos) |
| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=receiver_ciscoosreceiver)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=receiver_ciscoosreceiver&displayType=list) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax) |

[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development
<!-- end autogenerated section -->

The Cisco OS Receiver is a modular receiver that collects metrics from Cisco network devices via SSH connections. It supports multiple scrapers for comprehensive network monitoring and provides native OpenTelemetry OTLP metrics generation.

## Configuration

The following settings are available:

| Setting | Type | Required | Description |
|---------|------|----------|-------------|
| `devices` | []DeviceConfig | Yes | List of Cisco devices to monitor |
| `collection_interval` | duration | No | How often to collect metrics (default: 60s) |
| `timeout` | duration | No | SSH connection and command timeout (default: 30s) |
| `scrapers` | ScrapersConfig | Yes | Enable/disable specific scrapers |

### Device Configuration

| Setting | Type | Required | Description |
|---------|------|----------|-------------|
| `host` | string | Yes | Device address in `host:port` format |
| `username` | string | Yes | SSH username for authentication |
| `password` | string | No* | Password for authentication |
| `key_file` | string | No* | Path to SSH private key file |

*Either `password` or `key_file` is required, but not both.

### Scrapers Configuration

| Setting | Type | Description |
|---------|------|-------------|
| `bgp` | bool | BGP session metrics |
| `environment` | bool | Temperature and power metrics |
| `facts` | bool | System information metrics |
| `interfaces` | bool | Interface status and statistics |
| `optics` | bool | Optical transceiver metrics |

## Scrapers

The receiver supports the following scrapers:

- **BGP**: Collects BGP session information and statistics
- **Environment**: Collects temperature and power consumption metrics
- **Facts**: Collects system information (OS version, memory, CPU utilization)
- **Interfaces**: Collects interface statistics (bytes, packets, errors)
- **Optics**: Collects optical signal strength information

## Example Configuration

```yaml
receivers:
ciscoosreceiver:
collection_interval: 60s
timeout: 30s
scrapers:
bgp: true
environment: true
facts: true
interfaces: true
optics: true
devices:
- host: "cisco-device:22"
username: "admin"
password: "password"

exporters:
debug:
verbosity: detailed

service:
pipelines:
metrics:
receivers: [ciscoosreceiver]
exporters: [debug]
```

## Metrics

| Metric | Type | Description | Attributes |
|--------|------|-------------|------------|
| `cisco.device.connected` | Gauge | Device connectivity status (1=connected, 0=disconnected) | `host` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this metric be generic device.connected & add the device.manufacturer attribute?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the receiver is called ciscoosreceiver, so maybe to align to semconv if there is an effort. Otherwise, no point.

87 changes: 87 additions & 0 deletions receiver/ciscoosreceiver/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package ciscoosreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver"

import (
"errors"
"time"

"go.opentelemetry.io/collector/scraper/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver/internal/metadata"
)

// Config represents the receiver configuration
type Config struct {
scraperhelper.ControllerConfig `mapstructure:",squash"`
metadata.MetricsBuilderConfig `mapstructure:",squash"`

CollectionInterval time.Duration `mapstructure:"collection_interval"`
Devices []DeviceConfig `mapstructure:"devices"`
Timeout time.Duration `mapstructure:"timeout"`
Scrapers ScrapersConfig `mapstructure:"scrapers"`
}

// DeviceConfig represents configuration for a single Cisco device
type DeviceConfig struct {
Host string `mapstructure:"host"`
KeyFile string `mapstructure:"key_file"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
}

// ScrapersConfig represents which scrapers are enabled
type ScrapersConfig struct {
BGP bool `mapstructure:"bgp"`
Environment bool `mapstructure:"environment"`
Facts bool `mapstructure:"facts"`
Interfaces bool `mapstructure:"interfaces"`
Optics bool `mapstructure:"optics"`
}

// Validate checks if the receiver configuration is valid
func (cfg *Config) Validate() error {
if len(cfg.Devices) == 0 {
return errors.New("at least one device must be configured")
}

for _, device := range cfg.Devices {
if device.Host == "" {
return errors.New("device host cannot be empty")
}

// Authentication validation logic:
// 1. If using key file: username + key_file (password optional)
// 2. If not using key file: username + password required
if device.KeyFile != "" {
// Key file authentication: requires username
if device.Username == "" {
return errors.New("device username cannot be empty")
}
} else {
// Password authentication: requires both username and password
if device.Username == "" {
return errors.New("device username cannot be empty")
}
if device.Password == "" {
return errors.New("device password cannot be empty")
}
}
}

if cfg.Timeout <= 0 {
return errors.New("timeout must be greater than 0")
}

if cfg.CollectionInterval <= 0 {
return errors.New("collection_interval must be greater than 0")
}

// Check if at least one scraper is enabled
if !cfg.Scrapers.BGP && !cfg.Scrapers.Environment && !cfg.Scrapers.Facts && !cfg.Scrapers.Interfaces && !cfg.Scrapers.Optics {
return errors.New("at least one scraper must be enabled")
}

return nil
}
Loading
Loading