LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.

Learn More

Downloading a Collector Installer

Last updated on 11 September, 2023

Introduction

You can use LogicMonitor’s REST API to download a Collector Installer.  This should result in a binary for Linux Collectors or an executable for Windows Collectors, which you can then run to install the Collector.

Note: For security reasons, the downloaded installer file will expire after two hours.

HTTP Method: GET

Note: Basic Authentication is not supported for this resource currently. Token authentication is supported. See authentication requirements for more details.

Resource URI: /setting/collectors/{id}/installers/{platform+architecture}
(where id is the Collector Id, which can be found via a GET call to the Collectors resource, and platform + architecture is one of Linux64, Linux32, Win64 or Win32; note that for a Linux installer, you should output to a .bin file and for a Windows installer, you should output to a .exe file)

Request Parameters: You can optionally include the following query parameters in your request.

Property Description Type Example
collectorVersionThe version of the installer you’d like to download. This defaults to the latest GD Collector, unless useEA is true.String/setting/collectors/12/installers/Linux64?collectorVersion=22142
collectorSizeThe size of the Collector you’d like to install. Options are nano, small (requires 2GB memory), medium (requires 4GB memory), large (requires 8GB memory). Requires collector version 22.180 or higher. Defaults to small.String/setting/collectors/12/installers/Linux64?collectorSize=nano
useEAIf true, the latest EA Collector version will be used. Defaults to falseBoolean/setting/collectors/12/installers/Linux64?useEA=true

Note: Because they are encoded and concatenated separately, the resource path and query parameter cannot be combined when used in scripts. For example, the correct resource path is /setting/collectors/31/installers/Win64, NOT /setting/collectors/31/installers/Win64?collectorSize=nano. See the scripting example in the following section for correct formatting within scripts.

Scripting Example

Next is an example of performing the HTTP Get within a script (Python). This script illustrates downloading a 64 bit Linux installer, version 22.142, for Collector 221.

#!/bin/env python

import requests
import json
import hashlib
import base64
import time
import hmac

#Account Info
AccessId ='48v2wRzfK94y53sq5EuF'
AccessKey ='H_D9i(f5~B^U36^K6i42=^nS~e75gy382Bf6{)P+'
Company = 'api'

#Request Info
httpVerb ='GET'
collectorId='6'
collectorVersion='30001'
resourcePath = '/setting/collectors/' + collectorId + '/installers/Linux64'
queryParams = '?collectorVersion=' + collectorVersion
data = ''

#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath + queryParams

#Get current time in milliseconds
epoch = str(int(time.time() * 1000))

#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath

# Construct signature
hmac1 = hmac.new(AccessKey.encode(),msg=requestVars.encode(),digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(hmac1.encode())

# Construct headers
auth = 'LMv1 ' + AccessId + ':' + signature.decode() + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth}

#Make request
response = requests.get(url, data=data, headers=headers)

# Print Response status
print('Response Status:',response.status_code)

# Print response body if status code is not 200
if(response.status_code != 200):
    print('Response Body:',response.content)

else:
    file_ = open('LogicMonitorSetup.bin', 'wb')
    file_.write(response.content)
    file_.close()
    print('Collector installer has been downloaded successfully')
Python 3

Installation

The last step in adding a collector is running the install file on the selected server.  The device where the collector resides will need to be a Windows or Linux (physical or virtual) server with an outgoing SSL connection over port 443 to the LogicMonitor servers.

Windows

Run:

LogicMonitorSetup123.exe /q /d:"" /a: /p:

/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. The installer requires a Domain\User format. Ex: /a:’Domain\User’
/p: (Required if /a is given) This is the password to use that corresponds to the user account specified.  Ex: /p:’p@$$w0rd’
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.
/PROXYHOST: (Optional) Proxy server address Ex: /PROXYHOST:”proxy.net”
/PROXYPORT: (Optional) Proxy server port
/PROXYUSER: (Optional) Username to authenticate to proxy server if any
/PROXYPASS: (Optional) Password to authenticate to proxy server if required

Be sure there is no space following any colon if parameters are being specified. 
For example, /p:’Ex@ml!eP@5Sw0rd’ will work,  /p: ‘Ex@ml!eP@5Sw0rd’ will not work. 

Linux

Run:

chmod +x logicmonitorsetup123.bin

and then:

./logicmonitorsetup123.bin [-h] [-n] [-y] [-p user] [-p proxyHost:port] [-U proxyUser] [-P proxyPass]

-h: (optional) display a list of flags, their defaults, and their options
-n: (optional) display Collector version number

-y: (optional) install silently (don’t ask questions); defaults to false

-u user: (optional) user or root; defaults to “logicmonitor”

-p proxyAddr:port: (optional) proxy server in form of address:port (e.g. 10.0.0.1:8080)

-U proxyUser: (optional) username to authenticate to proxy server if any

-P proxyPass: (optional) password to authenticate to proxy server if required

In This Article