Skip to main content

Multi-cloud automation tool for LogicMonitor integrations. GCP support in v2.0, AWS/Azure coming soon.

Project description

LM Cloud Sync

Multi-cloud automation tool for LogicMonitor integrations.

Automatically discover and sync cloud resources (AWS accounts, Azure subscriptions, GCP projects) to LogicMonitor as device groups.

Features

  • GCP Support (v2.0.0): Full support for Google Cloud Platform
    • Auto-discovery using Resource Manager API
    • Project-level integration management
    • Dry-run mode and orphan detection
  • Coming Soon: AWS and Azure support (in development)
  • CLI & Terraform: Deploy via command line or infrastructure-as-code
  • Flexible Authentication: Bearer token or LMv1 auth

Requirements

  • Python 3.11 or higher (check with python3 --version)
  • LogicMonitor API credentials (Bearer token or LMv1)
  • Cloud provider credentials (GCP service account for v2.0.0)

Installation

Recommended: Using uv or pipx

These tools handle Python version management and avoid system conflicts:

# Using uv (recommended)
uv tool install lm-cloud-sync

# Or using pipx
pipx install lm-cloud-sync

Alternative: Using pip

If using pip directly, a virtual environment is recommended:

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install
pip install lm-cloud-sync

Note for macOS users: Direct pip install may fail with "externally-managed-environment" error. Use uv tool install or pipx install instead.

From Source (For Development)

# Clone the repository
git clone https://github.com/ryanmat/lm-cloud-sync.git
cd lm-cloud-sync

# Option 1: Run directly with uv
uv run lm-cloud-sync --help

# Option 2: Install in virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .
lm-cloud-sync --help

# Option 3: Install as a tool globally
uv tool install --editable .
lm-cloud-sync --help

Quick Start

1. Set Up Environment Variables

Create a .env file in your project root (or set environment variables):

# Copy the example file
cp .env.example .env

# Edit .env with your credentials
# LogicMonitor (required for all providers)
LM_COMPANY=your-company-name
LM_BEARER_TOKEN=your-bearer-token

# GCP (if using GCP provider)
GCP_SA_KEY_PATH=/path/to/service-account.json

# AWS (if using AWS provider)
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key

# Azure (if using Azure provider)
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret

2. Discover GCP Projects

# Discover GCP projects
lm-cloud-sync gcp discover

# With auto-discovery (org-level)
lm-cloud-sync gcp discover --auto-discover

3. Check Sync Status

# Check what's already synced vs what needs to be added
lm-cloud-sync gcp status

4. Preview Changes (Dry Run)

# See what would be created without making changes
lm-cloud-sync gcp sync --dry-run

5. Execute Sync

# Create integrations in LogicMonitor
lm-cloud-sync gcp sync --yes

CLI Commands

lm-cloud-sync
├── gcp               # GCP support (v2.0.0)
│   ├── discover      # List GCP projects
│   ├── status        # Show sync status
│   ├── sync          # Sync projects to LM
│   └── delete        # Delete an integration
├── aws               # Coming in v2.1.0
├── azure             # Coming in v2.2.0
├── all               # Multi-cloud sync (future)
└── config
    ├── init          # Create config file
    └── validate      # Validate config

Common Options

# Discover with auto-discovery (org-level)
lm-cloud-sync gcp discover --auto-discover

# Sync with dry-run
lm-cloud-sync gcp sync --dry-run

# Sync to a specific LogicMonitor parent group
lm-cloud-sync gcp sync --parent-group-id 123 --yes

# Sync and delete orphaned integrations
lm-cloud-sync gcp sync --delete-orphans --yes

# Check status with orphan detection
lm-cloud-sync gcp status --show-orphans

Configuration

Environment Variables (v2.0.0)

Required:

Variable Description
LM_COMPANY LogicMonitor portal name
LM_BEARER_TOKEN Bearer token for auth*
GCP_SA_KEY_PATH Path to GCP service account JSON

*Or use LM_ACCESS_ID and LM_ACCESS_KEY for LMv1 authentication.

See .env.example for additional configuration options and future provider support (AWS, Azure).

Configuration File

Create a config file with lm-cloud-sync config init:

logicmonitor:
  company: "your-company"

gcp:
  enabled: true
  filters:
    exclude_patterns: ["sys-*", "test-*"]
  regions:
    - us-central1
    - us-east1
  services:
    - COMPUTEENGINE
    - CLOUDSQL

sync:
  dry_run: false
  delete_orphans: false
  custom_properties:
    "lm.cloud.managed_by": "lm-cloud-sync"

Terraform

See terraform/ for Terraform modules.

module "gcp_integration" {
  source = "github.com/ryanmat/lm-cloud-sync//terraform/modules/gcp"

  lm_company    = "your-company"
  lm_bearer_token = var.lm_bearer_token
  gcp_project_id  = "my-project"
  gcp_sa_key_path = "/path/to/key.json"
}

Development

# Clone the repository
git clone https://github.com/ryanmat/lm-cloud-sync.git
cd lm-cloud-sync

# Install dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Run linting
uv run ruff check src/

# Run the CLI
uv run lm-cloud-sync --help

Roadmap

  • v2.0.0: GCP support (current release)
  • v2.1.0: AWS support with Organizations discovery
  • v2.2.0: Azure support with Management API discovery
  • v3.0.0: Multi-cloud sync (lm-cloud-sync all)

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lm_cloud_sync-2.0.4.tar.gz (149.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lm_cloud_sync-2.0.4-py3-none-any.whl (50.0 kB view details)

Uploaded Python 3

File details

Details for the file lm_cloud_sync-2.0.4.tar.gz.

File metadata

  • Download URL: lm_cloud_sync-2.0.4.tar.gz
  • Upload date:
  • Size: 149.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lm_cloud_sync-2.0.4.tar.gz
Algorithm Hash digest
SHA256 ee0c2f75786a501b36aa5a50dc8d4f7f2625e032f9dadfeb56ca670b9f105c16
MD5 0e114d79aa6f622008af81e6f9098e83
BLAKE2b-256 b1c23a2c02ea6f18ebd346b5d5c6c96fe036c36c3b5db868aee08b32492fdc03

See more details on using hashes here.

File details

Details for the file lm_cloud_sync-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: lm_cloud_sync-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 50.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lm_cloud_sync-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c14255e3dda38dc3e603f9b910f47a53c949045dfaad41ca9eb4101c227fdba0
MD5 ccd3fb109ec535bd470e2bfe2084c122
BLAKE2b-256 8aecc7d3e8b23f0a4350b01e964ab1e4691b6b2b5ece57a75167a06da0abbbc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page