meraki-dashboard-exporter


Namemeraki-dashboard-exporter JSON
Version 0.26.0 PyPI version JSON
download
home_pageNone
SummaryPrometheus exporter for Cisco Meraki Dashboard API metrics
upload_time2025-08-02 17:35:46
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseApache-2.0
keywords cisco iot meraki sensors
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Meraki Dashboard Exporter
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter?ref=badge_shield)


A Prometheus exporter for Cisco Meraki Dashboard API metrics with OpenTelemetry support.

## Features

- Collects metrics from all Meraki device types (MS, MR, MV, MT, MX, MG)
- Organization-level metrics (API usage, licenses, device counts)
- Device-specific metrics (status, performance, sensor readings)
- Async collection for improved performance
- **Dual metric export**: Prometheus `/metrics` endpoint + automatic OpenTelemetry export
- **Distributed tracing**: Full request tracing with OpenTelemetry instrumentation
- Structured logging with JSON output and trace correlation
- Docker support with health checks
- Configurable collection intervals

## Quick Start

### Using Docker

1. Copy `.env.example` to `.env` and add your Meraki API key:
   ```bash
   cp .env.example .env
   # Edit .env and set: MERAKI_EXPORTER_MERAKI__API_KEY=your_api_key_here
   ```

2. Run with Docker Compose:
   ```bash
   docker-compose up -d
   ```

3. Access metrics at http://localhost:9099/metrics

### Using Python

1. Install dependencies:
   ```bash
   uv pip install -e .
   ```

2. Set environment variables:
   ```bash
   export MERAKI_EXPORTER_MERAKI__API_KEY=your_api_key_here
   ```

3. Run the exporter:
   ```bash
   python -m meraki_dashboard_exporter
   ```

## OpenTelemetry Support

The exporter provides comprehensive OpenTelemetry support when enabled:

**Metrics**: All Prometheus metrics are automatically mirrored to OTEL
- Use existing Prometheus dashboards while sending to OTEL backends
- No code changes needed - new metrics are automatically exported

**Tracing**: Distributed tracing for all operations
- Every Meraki API call is traced with timing and metadata
- Automatic instrumentation of HTTP, threading, and logging
- Configurable sampling rates for production use
- Correlation with logs via trace IDs
- **Automatic RED metrics** from spans (Rate, Errors, Duration)

**Logs**: Structured logging with trace correlation
- Automatic trace context injection (trace_id, span_id)
- All logs include trace context when within a span
- Structured log fields preserved for easy parsing
- Compatible with log aggregation systems

**Benefits**:
- Full observability with metrics, traces, and logs
- Debug slow API calls and identify bottlenecks
- Track request flow across the entire system
- Compatible with Jaeger, Tempo, Datadog, New Relic, etc.

### Enabling OpenTelemetry

Set these environment variables:

```bash
# Enable OTEL export
export MERAKI_EXPORTER_OTEL__ENABLED=true

# Set the OTEL collector endpoint
export MERAKI_EXPORTER_OTEL__ENDPOINT=http://localhost:4317

# Optional: Configure export interval (default: 60 seconds)
export MERAKI_EXPORTER_OTEL__EXPORT_INTERVAL=30

# Optional: Add resource attributes
export MERAKI_EXPORTER_OTEL__RESOURCE_ATTRIBUTES='{"environment":"production","region":"us-east"}'

# Optional: Configure trace sampling rate (default: 0.1 = 10%)
export MERAKI_EXPORTER_OTEL__SAMPLING_RATE=0.1
```

### Docker Compose Example

```yaml
services:
  meraki-exporter:
    image: meraki-dashboard-exporter
    environment:
      - MERAKI_EXPORTER_MERAKI__API_KEY=${MERAKI_EXPORTER_MERAKI__API_KEY}
      - MERAKI_EXPORTER_OTEL__ENABLED=true
      - MERAKI_EXPORTER_OTEL__ENDPOINT=http://otel-collector:4317
    ports:
      - "9099:9099"

  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    command: ["--config=/etc/otel-collector-config.yaml"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
    ports:
      - "4317:4317"  # OTLP gRPC receiver
```

See [OTEL.md](OTEL.md) for detailed OpenTelemetry configuration and [TRACING.md](TRACING.md) for distributed tracing documentation.

## Configuration

All configuration is done via environment variables. See `.env.example` for all available options.

### Key Settings

#### Required
- `MERAKI_EXPORTER_MERAKI__API_KEY`: Your Meraki Dashboard API key

#### Optional
- `MERAKI_EXPORTER_MERAKI__ORG_ID`: Specific org ID to monitor (monitors all orgs if not set)
- `MERAKI_EXPORTER_LOGGING__LEVEL`: Logging level (default: INFO)
- `MERAKI_EXPORTER_MERAKI__API_BASE_URL`: API base URL for regional endpoints (default: https://api.meraki.com/api/v1)
- `MERAKI_EXPORTER_API__TIMEOUT`: API request timeout in seconds (default: 30)
- `MERAKI_EXPORTER_API__MAX_RETRIES`: Maximum API request retries (default: 4)

### Update Intervals
- `MERAKI_EXPORTER_UPDATE_INTERVALS__FAST`: Fast tier interval in seconds (default: 60, range: 30-300)
- `MERAKI_EXPORTER_UPDATE_INTERVALS__MEDIUM`: Medium tier interval in seconds (default: 300, range: 300-1800)
- `MERAKI_EXPORTER_UPDATE_INTERVALS__SLOW`: Slow tier interval in seconds (default: 900, range: 600-3600)

### Regional API Endpoints

For users in specific regions, use the appropriate API base URL:

- **Global/Default**: `https://api.meraki.com/api/v1`
- **Canada**: `https://api.meraki.ca/api/v1`
- **China**: `https://api.meraki.cn/api/v1`
- **India**: `https://api.meraki.in/api/v1`
- **US Federal**: `https://api.gov-meraki.com/api/v1`

Example:
```bash
export MERAKI_EXPORTER_MERAKI__API_BASE_URL="https://api.meraki.ca/api/v1"  # For Canada region
```

## Metrics

### Organization Metrics
- `meraki_org_api_requests_total`: Total API requests
- `meraki_org_networks_total`: Number of networks
- `meraki_org_devices_total`: Number of devices by type
- `meraki_org_licenses_total`: License counts by type and status
- `meraki_org_clients_total`: Total active clients (5-minute window)
- `meraki_org_usage_total_kb`: Total data usage in KB (5-minute window)
- `meraki_org_usage_downstream_kb`: Downstream data usage in KB (5-minute window)
- `meraki_org_usage_upstream_kb`: Upstream data usage in KB (5-minute window)

### Device Metrics
- `meraki_device_up`: Device online status
- `meraki_device_uptime_seconds`: Device uptime

### Switch (MS) Metrics
- `meraki_ms_port_status`: Port connection status
- `meraki_ms_port_traffic_bytes`: Port traffic counters
- `meraki_ms_port_errors_total`: Port error counters

### Access Point (MR) Metrics
- `meraki_mr_clients_connected`: Connected client count
- `meraki_ap_channel_utilization_*`: Channel utilization metrics
- `meraki_network_bluetooth_clients_total`: Bluetooth clients detected by MR devices

### Sensor (MT) Metrics
- `meraki_mt_temperature_celsius`: Temperature readings
- `meraki_mt_humidity_percent`: Humidity readings
- `meraki_mt_door_status`: Door sensor status
- `meraki_mt_water_detected`: Water detection status
- And more...

### Alert Metrics
- `meraki_alerts_active`: Number of active alerts by type, category, severity, and device type
- `meraki_alerts_total_by_severity`: Total alerts grouped by severity level
- `meraki_alerts_total_by_network`: Total alerts per network

### Configuration Metrics
- `meraki_org_login_security_*`: Various login security settings (see config collector for full list)
- `meraki_org_configuration_changes_total`: Total configuration changes in the last 24 hours

### Observability Metrics (Auto-generated)
When OpenTelemetry tracing is enabled, these metrics are automatically generated from spans:
- `meraki_span_requests_total`: Request rate by operation, collector, endpoint, and status
- `meraki_span_duration_seconds`: Request duration histogram by operation
- `meraki_span_errors_total`: Error rate by operation, collector, endpoint, and error type
- `meraki_sli_*`: Service Level Indicator metrics for availability, latency, and error rates

### Cardinality Monitoring
The exporter includes built-in cardinality monitoring to help track metric growth:
- `meraki_metric_cardinality_total`: Total unique label combinations per metric
- `meraki_label_cardinality_total`: Cardinality per label per metric
- `meraki_cardinality_warnings_total`: Warnings when metrics exceed thresholds
- `meraki_total_series`: Total time series count across all metrics

Access cardinality report at: `/cardinality`

### Circuit Breaker Metrics
The exporter includes circuit breaker metrics for monitoring reliability:
- `meraki_circuit_breaker_state`: Current state of circuit breakers (closed/open/half_open)
- `meraki_circuit_breaker_failures_total`: Total failures handled by circuit breakers
- `meraki_circuit_breaker_success_total`: Successful calls through circuit breakers
- `meraki_circuit_breaker_rejections_total`: Calls rejected by open circuit breakers
- `meraki_circuit_breaker_state_changes_total`: State transitions tracked by from/to state

## Development

### Running Tests
```bash
uv run pytest
```

### Linting and Type Checking
```bash
uv run ruff check .
uv run mypy .
```

## License

MIT


[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter?ref=badge_large)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "meraki-dashboard-exporter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "cisco, iot, meraki, sensors",
    "author": null,
    "author_email": "Rob Knight <12484127+rknightion@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/d3/f4/d9a41f09905d675bc2aa0b97cc587aa5985809cf29a664f3b80cc13d2ab7/meraki_dashboard_exporter-0.26.0.tar.gz",
    "platform": null,
    "description": "# Meraki Dashboard Exporter\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter?ref=badge_shield)\n\n\nA Prometheus exporter for Cisco Meraki Dashboard API metrics with OpenTelemetry support.\n\n## Features\n\n- Collects metrics from all Meraki device types (MS, MR, MV, MT, MX, MG)\n- Organization-level metrics (API usage, licenses, device counts)\n- Device-specific metrics (status, performance, sensor readings)\n- Async collection for improved performance\n- **Dual metric export**: Prometheus `/metrics` endpoint + automatic OpenTelemetry export\n- **Distributed tracing**: Full request tracing with OpenTelemetry instrumentation\n- Structured logging with JSON output and trace correlation\n- Docker support with health checks\n- Configurable collection intervals\n\n## Quick Start\n\n### Using Docker\n\n1. Copy `.env.example` to `.env` and add your Meraki API key:\n   ```bash\n   cp .env.example .env\n   # Edit .env and set: MERAKI_EXPORTER_MERAKI__API_KEY=your_api_key_here\n   ```\n\n2. Run with Docker Compose:\n   ```bash\n   docker-compose up -d\n   ```\n\n3. Access metrics at http://localhost:9099/metrics\n\n### Using Python\n\n1. Install dependencies:\n   ```bash\n   uv pip install -e .\n   ```\n\n2. Set environment variables:\n   ```bash\n   export MERAKI_EXPORTER_MERAKI__API_KEY=your_api_key_here\n   ```\n\n3. Run the exporter:\n   ```bash\n   python -m meraki_dashboard_exporter\n   ```\n\n## OpenTelemetry Support\n\nThe exporter provides comprehensive OpenTelemetry support when enabled:\n\n**Metrics**: All Prometheus metrics are automatically mirrored to OTEL\n- Use existing Prometheus dashboards while sending to OTEL backends\n- No code changes needed - new metrics are automatically exported\n\n**Tracing**: Distributed tracing for all operations\n- Every Meraki API call is traced with timing and metadata\n- Automatic instrumentation of HTTP, threading, and logging\n- Configurable sampling rates for production use\n- Correlation with logs via trace IDs\n- **Automatic RED metrics** from spans (Rate, Errors, Duration)\n\n**Logs**: Structured logging with trace correlation\n- Automatic trace context injection (trace_id, span_id)\n- All logs include trace context when within a span\n- Structured log fields preserved for easy parsing\n- Compatible with log aggregation systems\n\n**Benefits**:\n- Full observability with metrics, traces, and logs\n- Debug slow API calls and identify bottlenecks\n- Track request flow across the entire system\n- Compatible with Jaeger, Tempo, Datadog, New Relic, etc.\n\n### Enabling OpenTelemetry\n\nSet these environment variables:\n\n```bash\n# Enable OTEL export\nexport MERAKI_EXPORTER_OTEL__ENABLED=true\n\n# Set the OTEL collector endpoint\nexport MERAKI_EXPORTER_OTEL__ENDPOINT=http://localhost:4317\n\n# Optional: Configure export interval (default: 60 seconds)\nexport MERAKI_EXPORTER_OTEL__EXPORT_INTERVAL=30\n\n# Optional: Add resource attributes\nexport MERAKI_EXPORTER_OTEL__RESOURCE_ATTRIBUTES='{\"environment\":\"production\",\"region\":\"us-east\"}'\n\n# Optional: Configure trace sampling rate (default: 0.1 = 10%)\nexport MERAKI_EXPORTER_OTEL__SAMPLING_RATE=0.1\n```\n\n### Docker Compose Example\n\n```yaml\nservices:\n  meraki-exporter:\n    image: meraki-dashboard-exporter\n    environment:\n      - MERAKI_EXPORTER_MERAKI__API_KEY=${MERAKI_EXPORTER_MERAKI__API_KEY}\n      - MERAKI_EXPORTER_OTEL__ENABLED=true\n      - MERAKI_EXPORTER_OTEL__ENDPOINT=http://otel-collector:4317\n    ports:\n      - \"9099:9099\"\n\n  otel-collector:\n    image: otel/opentelemetry-collector-contrib:latest\n    command: [\"--config=/etc/otel-collector-config.yaml\"]\n    volumes:\n      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml\n    ports:\n      - \"4317:4317\"  # OTLP gRPC receiver\n```\n\nSee [OTEL.md](OTEL.md) for detailed OpenTelemetry configuration and [TRACING.md](TRACING.md) for distributed tracing documentation.\n\n## Configuration\n\nAll configuration is done via environment variables. See `.env.example` for all available options.\n\n### Key Settings\n\n#### Required\n- `MERAKI_EXPORTER_MERAKI__API_KEY`: Your Meraki Dashboard API key\n\n#### Optional\n- `MERAKI_EXPORTER_MERAKI__ORG_ID`: Specific org ID to monitor (monitors all orgs if not set)\n- `MERAKI_EXPORTER_LOGGING__LEVEL`: Logging level (default: INFO)\n- `MERAKI_EXPORTER_MERAKI__API_BASE_URL`: API base URL for regional endpoints (default: https://api.meraki.com/api/v1)\n- `MERAKI_EXPORTER_API__TIMEOUT`: API request timeout in seconds (default: 30)\n- `MERAKI_EXPORTER_API__MAX_RETRIES`: Maximum API request retries (default: 4)\n\n### Update Intervals\n- `MERAKI_EXPORTER_UPDATE_INTERVALS__FAST`: Fast tier interval in seconds (default: 60, range: 30-300)\n- `MERAKI_EXPORTER_UPDATE_INTERVALS__MEDIUM`: Medium tier interval in seconds (default: 300, range: 300-1800)\n- `MERAKI_EXPORTER_UPDATE_INTERVALS__SLOW`: Slow tier interval in seconds (default: 900, range: 600-3600)\n\n### Regional API Endpoints\n\nFor users in specific regions, use the appropriate API base URL:\n\n- **Global/Default**: `https://api.meraki.com/api/v1`\n- **Canada**: `https://api.meraki.ca/api/v1`\n- **China**: `https://api.meraki.cn/api/v1`\n- **India**: `https://api.meraki.in/api/v1`\n- **US Federal**: `https://api.gov-meraki.com/api/v1`\n\nExample:\n```bash\nexport MERAKI_EXPORTER_MERAKI__API_BASE_URL=\"https://api.meraki.ca/api/v1\"  # For Canada region\n```\n\n## Metrics\n\n### Organization Metrics\n- `meraki_org_api_requests_total`: Total API requests\n- `meraki_org_networks_total`: Number of networks\n- `meraki_org_devices_total`: Number of devices by type\n- `meraki_org_licenses_total`: License counts by type and status\n- `meraki_org_clients_total`: Total active clients (5-minute window)\n- `meraki_org_usage_total_kb`: Total data usage in KB (5-minute window)\n- `meraki_org_usage_downstream_kb`: Downstream data usage in KB (5-minute window)\n- `meraki_org_usage_upstream_kb`: Upstream data usage in KB (5-minute window)\n\n### Device Metrics\n- `meraki_device_up`: Device online status\n- `meraki_device_uptime_seconds`: Device uptime\n\n### Switch (MS) Metrics\n- `meraki_ms_port_status`: Port connection status\n- `meraki_ms_port_traffic_bytes`: Port traffic counters\n- `meraki_ms_port_errors_total`: Port error counters\n\n### Access Point (MR) Metrics\n- `meraki_mr_clients_connected`: Connected client count\n- `meraki_ap_channel_utilization_*`: Channel utilization metrics\n- `meraki_network_bluetooth_clients_total`: Bluetooth clients detected by MR devices\n\n### Sensor (MT) Metrics\n- `meraki_mt_temperature_celsius`: Temperature readings\n- `meraki_mt_humidity_percent`: Humidity readings\n- `meraki_mt_door_status`: Door sensor status\n- `meraki_mt_water_detected`: Water detection status\n- And more...\n\n### Alert Metrics\n- `meraki_alerts_active`: Number of active alerts by type, category, severity, and device type\n- `meraki_alerts_total_by_severity`: Total alerts grouped by severity level\n- `meraki_alerts_total_by_network`: Total alerts per network\n\n### Configuration Metrics\n- `meraki_org_login_security_*`: Various login security settings (see config collector for full list)\n- `meraki_org_configuration_changes_total`: Total configuration changes in the last 24 hours\n\n### Observability Metrics (Auto-generated)\nWhen OpenTelemetry tracing is enabled, these metrics are automatically generated from spans:\n- `meraki_span_requests_total`: Request rate by operation, collector, endpoint, and status\n- `meraki_span_duration_seconds`: Request duration histogram by operation\n- `meraki_span_errors_total`: Error rate by operation, collector, endpoint, and error type\n- `meraki_sli_*`: Service Level Indicator metrics for availability, latency, and error rates\n\n### Cardinality Monitoring\nThe exporter includes built-in cardinality monitoring to help track metric growth:\n- `meraki_metric_cardinality_total`: Total unique label combinations per metric\n- `meraki_label_cardinality_total`: Cardinality per label per metric\n- `meraki_cardinality_warnings_total`: Warnings when metrics exceed thresholds\n- `meraki_total_series`: Total time series count across all metrics\n\nAccess cardinality report at: `/cardinality`\n\n### Circuit Breaker Metrics\nThe exporter includes circuit breaker metrics for monitoring reliability:\n- `meraki_circuit_breaker_state`: Current state of circuit breakers (closed/open/half_open)\n- `meraki_circuit_breaker_failures_total`: Total failures handled by circuit breakers\n- `meraki_circuit_breaker_success_total`: Successful calls through circuit breakers\n- `meraki_circuit_breaker_rejections_total`: Calls rejected by open circuit breakers\n- `meraki_circuit_breaker_state_changes_total`: State transitions tracked by from/to state\n\n## Development\n\n### Running Tests\n```bash\nuv run pytest\n```\n\n### Linting and Type Checking\n```bash\nuv run ruff check .\nuv run mypy .\n```\n\n## License\n\nMIT\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Frknightion%2Fmeraki-dashboard-exporter?ref=badge_large)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Prometheus exporter for Cisco Meraki Dashboard API metrics",
    "version": "0.26.0",
    "project_urls": null,
    "split_keywords": [
        "cisco",
        " iot",
        " meraki",
        " sensors"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd7a965cda0cd87163793c27f3994cbc2a21a081cb6f23bcd4990f30697f84b9",
                "md5": "a17ea52933f0cacf3842f0fee8b25267",
                "sha256": "5cde2476e1731673ebadceb4eca97f676b84ec6b06bd7bb395c09485fdbb5336"
            },
            "downloads": -1,
            "filename": "meraki_dashboard_exporter-0.26.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a17ea52933f0cacf3842f0fee8b25267",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 185173,
            "upload_time": "2025-08-02T17:35:44",
            "upload_time_iso_8601": "2025-08-02T17:35:44.166191Z",
            "url": "https://files.pythonhosted.org/packages/cd/7a/965cda0cd87163793c27f3994cbc2a21a081cb6f23bcd4990f30697f84b9/meraki_dashboard_exporter-0.26.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d3f4d9a41f09905d675bc2aa0b97cc587aa5985809cf29a664f3b80cc13d2ab7",
                "md5": "7bc607aa6cd87a68f041c4af829aba3c",
                "sha256": "99076b7feec1b1aa120534314d209f40cf20483c5d0dd3e0243dd94c2667b922"
            },
            "downloads": -1,
            "filename": "meraki_dashboard_exporter-0.26.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7bc607aa6cd87a68f041c4af829aba3c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 158067,
            "upload_time": "2025-08-02T17:35:46",
            "upload_time_iso_8601": "2025-08-02T17:35:46.033992Z",
            "url": "https://files.pythonhosted.org/packages/d3/f4/d9a41f09905d675bc2aa0b97cc587aa5985809cf29a664f3b80cc13d2ab7/meraki_dashboard_exporter-0.26.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 17:35:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "meraki-dashboard-exporter"
}
        
Elapsed time: 1.18174s