Import Lansweeper assets into the CMDB
Connect Lansweeper Cloud to Servicely, test an import of one asset class and schedule it.
Import devices discovered by Lansweeper Cloud into the CMDB, one CI class at a time. This page is for administrators who set up the integration, ideally on a non-production instance first.
Before you begin
- You need the
administratorrole. - You need a Lansweeper Cloud account that can create an integration app. The integration works with the Cloud edition of Lansweeper. For an on-premises Lansweeper, contact Servicely Support.
- If you have already built your own Lansweeper integration, contact Servicely Support before you activate this one.
- Choose the Lansweeper asset types to test with and the CMDB table they belong in. Lansweeper groups many devices by operating system, so a Servicely class such as servers often needs a filter across several asset types.
- Import each attribute from one system only. Lansweeper also collects data from other sources, so do not import the same attribute from both.
Steps
-
Activate the Lansweeper integration application [UNVERIFIED].
-
In Lansweeper, create an integration app by following the Lansweeper quickstart. Set its callback URL to
https://<instance-name>.servicely.ai/sso/oauth_callback. Keep the client ID, client secret and authorization URL in Lansweeper until you enter them in the next step. -
In Servicely, go to Administration → Integration → System OAuth providers and create a provider with the values in the table below.
Field Value Authentication method Request body Authorization URL https://app.lansweeper.com/authorize-app/<client_id>Token URL https://api.lansweeper.com/api/integrations/oauth/tokenRedirect URL https://<instance-name>.servicely.ai/sso/oauth_callback -
Go to Administration → Integration → System API outbound tokens and create an OAuth2 token for that provider. Set OAuth Prompt to consent and Scopes to
offline_access. -
On the token, select Get authorization token and sign in with a Lansweeper account.
-
Create an import table for the class. Any name works. A pattern such as
<prefix>Lansweeper<Class>Importkeeps them easy to find. You do not need to generate the temporary table before the first import. -
Open the
LansweeperIntegrationproperty set and fill in the global properties and the properties for your class. Keep the class’s transform property, for exampleLansweeperIntSwitchEnableTransform, set tofalseand set the page limits low, for example 5, so the first run is quick to check. The Lansweeper integration properties reference lists each one. -
Run the import once from a server script. The first argument is the class name used in your property names. The second is the page to start at. Keep it at 1.
LansweeperIntUtil.lansweeperIntegrationEntryPoint("Switch", 1); -
Check the rows in your import table. If the fields or the filter are wrong, change the class properties and run the import again. Errors appear in the system log.
-
When the data is right, delete the rows from the import table and create a transform map from it to the CMDB table. Use the Lansweeper
keyas the primary key. Set the class’s transform map property, for exampleLansweeperIntSwitchTransformMap, set its transform property totrueand raise the page limits so a run loads every record. -
Set up a system table cleanup record for the import table.
-
Go to Jobs and activate the job for your class. The integration ships a sample job for switches, (Lansweeper) Load Switches, which runs daily.
Result
The job imports the class from Lansweeper’s GraphQL assetResources query on its schedule and transforms the rows into the CMDB. If a run reaches the page limit, it stops reading pages and does not transform. Repeat the steps from the import table onwards for each further class.