• 0
pperreault

MSP deploying collector host servers

Question

We are an MSP migrating an existing client base to LM for network and voice infrastructure health monitoring. For ease of deployment, when we do not manage their server infrastructure, we are thinking of providing clients with an ova to deploy within their network. Once the VM is deployed the collector will be installed. Any words of wisdom or lessons learned from your experiences doing something similar would be appreciated.

  • Upvote 1

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 1

Hi @pperreault,

We don't have an OVA for collector deployment, however, you could use a script to make API calls and automate the installation into a couple of clicks... here's an example in PowerShell:

<# LogicMonitor REST API Collector Documentation: https://www.logicmonitor.com/support/rest-api-developers-guide/collectors/ #>

<# LogicMonitor Account Information - Requires Administrator Role Permissions #>
$accessId = 'CHANGE_TO_LOGICMONITOR_ACCESS_ID'
$accessKey = 'CHANGE_TO_LOGICMONITOR_ACCESS_KEY'
$company = 'LOGICMONITOR_ACCOUNT_NAME'

#--------------- API CALL #1 - Add Collector to LogicMonitor Account -------------------#

<# API and URL request details #>
$httpVerb = 'POST'
$resourcePath = '/setting/collectors'
$url = 'https://' + $company + '.logicmonitor.com/santaba/rest' + $resourcePath

<# Get current time in milliseconds #>
$epoch = [Math]::Round((New-TimeSpan -start (Get-Date -Date "1/1/1970") -end (Get-Date).ToUniversalTime()).TotalMilliseconds)

<# Parent Group hashtable definition #>
$parentHash = @{ description = "$env:COMPUTERNAME" }

<# Convert Parent Hashtable to JSON #>
$parentGroup = $parentHash | ConvertTo-Json

<# Concatenate General Request Details #>
$requestVars_00 = $httpVerb + $epoch + $parentGroup + $resourcePath

<# Construct Signature #>
$hmac = New-Object System.Security.Cryptography.HMACSHA256
$hmac.Key = [Text.Encoding]::UTF8.GetBytes($accessKey)
$signatureBytes = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes($requestVars_00))
$signatureHex = [System.BitConverter]::ToString($signatureBytes) -replace '-'
$signature = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($signatureHex.ToLower()))

<# Construct Headers #>
$auth = 'LMv1 ' + $accessId + ':' + $signature + ':' + $epoch
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization",$auth)
$headers.Add("Content-Type",'application/json')

<# Make Request to add collector#>
$response = Invoke-RestMethod -Uri $url -Method $httpVerb -Body $parentGroup -Header $headers 

<# Capture ID number of newly added collector #>
$collectorID = $response.data.id

#--------------- API CALL #2 - Download Collector to local temp directory -------------------#

<# Collector request details #>
$platform = 'Win64'

<# API request details #>
$httpVerb_01 = 'GET'
$resourcePath_01 = '/setting/collectors/' + $collectorID + '/installers/' + $platform

<# Construct URL #>
$url_01 = 'https://' + $company + '.logicmonitor.com/santaba/rest' + $resourcePath_01

<# Get current time in milliseconds #>
$epoch_01 = [Math]::Round((New-TimeSpan -start (Get-Date -Date "1/1/1970") -end (Get-Date).ToUniversalTime()).TotalMilliseconds)

<# Concatenate Request Details #>
$requestVars_01 = $httpVerb_01 + $epoch_01 + $resourcePath_01

<# Construct Signature #>
$hmac_01 = New-Object System.Security.Cryptography.HMACSHA256
$hmac_01.Key = [Text.Encoding]::UTF8.GetBytes($accessKey)
$signatureBytes_01 = $hmac_01.ComputeHash([Text.Encoding]::UTF8.GetBytes($requestVars_01))
$signatureHex_01 = [System.BitConverter]::ToString($signatureBytes_01) -replace '-'
$signature_01 = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($signatureHex_01.ToLower()))

<# Construct Headers #>
$auth_01 = 'LMv1 ' + $accessId + ':' + $signature_01 + ':' + $epoch_01
$headers_01 = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers_01.Add("Authorization",$auth_01)
$headers_01.Add("Content-Type",'application/json')

<# See if we have a place to keep our download #>
if(!(Test-Path -Path c:\temp )){
    New-Item -ItemType directory -Path c:\temp
}

<# Make Request and Download Executable #>
Invoke-RestMethod -Uri $url_01 -Method Get -Header $headers_01 -OutFile c:\temp\LogicMonitorSetup.exe

#--------------- Install Collector -------------------#

c:\temp\LogicMonitorSetup.exe /q

<# LogicMonitor Collector command line parameters:

/q: Quiet
/d:""(Optional) This is the path to install the collector into. It defaults to /Program Files/LogicMonitor/Collector /
/a:(Optional) This is the account the windows service will run as. Defaults to LocalSystem.
/p: (Required if /a is given) This is the password to use that corresponds to the user account specified.

Note:
If you do not specify the collector to run as a privileged user it will install and run as local system.
Local system may not have sufficient permissions to monitor other windows hosts remotely.

#>

 

Edited by Kerry DeVilbiss
clean up code

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.