Skip to content

Instalation and Setup

Installation

You can install the Logic.Monitor PowerShell module directly from the PowerShell Gallery:

Terminal window
Install-Module -Name "Logic.Monitor"

To ensure you have the latest version, you can run:

Terminal window
Update-Module -Name "Logic.Monitor"

Authentication

Before using any module commands, you need to connect to your LogicMonitor portal. You have two options for authentication:

Direct Connection (LMv1|BearerToken)

Terminal window
Connect-LMAccount -AccessId "your_access_id" -AccessKey "your_access_key" -AccountName "your_portal"
Connect-LMAccount -BearerToken "your_bearer_token" -AccountName "your_portal"

Using Cached Credentials

The Logic.Monitor module includes built-in credential caching to simplify managing multiple portal connections. Using Microsoft’s SecretManagement module, you can securely store and access your LogicMonitor credentials without repeatedly entering them.

How It Works

When you first use the credential caching feature, you’ll be prompted to set up a secure local vault by creating a password. This vault safely stores your LogicMonitor portal credentials, allowing quick and secure access across multiple sessions.

  1. First, cache your credentials:
Terminal window
New-LMCachedAccount -AccessId "your_access_id" -AccessKey "your_access_key" -AccountName "your_portal"
  1. Then connect using cached credentials:
Terminal window
Connect-LMAccount -UseCachedCredential
# Select from multiple cached portals
Enter the number for the cached credential you wish to use:
0) production-portal
1) staging-portal

This approach:

  • Securely stores multiple portal credentials
  • Eliminates the need to handle sensitive information in scripts
  • Provides a simple selection interface for multiple portals
  • Leverages industry-standard encryption via SecretManagement

Basic Usage

Here are some common commands to get you started:

List Available Commands

Terminal window
Get-Command -Module "Logic.Monitor"

Working with Devices

Terminal window
# Get all devices
Get-LMDevice
# Get a specific device by name
Get-LMDevice -Name "device.example.com"
# Get devices matching a pattern
Get-LMDevice -DisplayName "corp*"

Working with Alerts

Terminal window
# Get active alerts
Get-LMAlert
# Get alerts with specific filters (2=warning, 3=error, 4=critical)
Get-LMAlert -Filter "severity -eq '2'"

Next Steps