Quantcast
Channel: LANDESK User Community : Document List - All Communities
Viewing all articles
Browse latest Browse all 6338

Removing leading zeros from IP addresses imported from LDMS

$
0
0

Problem

When importing an IP address from LDMS the value has leading zeros, for example 010.000.009.015 instead of the more standard 10.0.9.15.  This can cause problems when using this value with Desktop Manager integration to launch external applications or hyperlinks.

 

Solution

Use the following steps to create a new attribute that automatically copies the IP address and puts it into the right format:

 

1. On the Configuration Item object create a new String attribute called IP Address From LDMS.

2. Update your data imports to map the IP address into the IP Address From LDMS attribute.

3. In the properties of the IP Address attribute on the Configuration Item object set the Calculation Type to Before Save.  This will launch the calculation editor.

4. Enter the following calculation formula:

 

import System
static def GetAttributeValue(ConfigItem):    Value = ConfigItem._IPAddressFromLDMS    try:          StringArray = Value.Split( char('.') )          Numbers = []          for s in StringArray:               Numbers.Add( int.Parse(s) )          return Numbers.Join('.')    except e:          return Value

 

5. In the Dependencies panel add _IPAddressFromLDMS.

6. Save the calculation and save the object.

7. Run the data import.

 

The calculation will update the value whenever the IP Address From LDMS attribute gets set or updated.  You don't need to put this on any windows unless you want to be able to update the value manually.


Viewing all articles
Browse latest Browse all 6338

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>