Assets Discovery Pattern customization: How to add Operating system information to host objects in Assets Data Center / Cloud
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
The following information is provided as-is. Atlassian Support cannot provide further assistance with the creation of custom patterns described below.
Summary
As an administrator, you might find beneficial to include specific operating system details, such as the kernel version for Linux OS and the OS version for Windows, within the HOST objects in Assets. By default, operating system information is typically saved in the Operating System object type.
Below is an example of the outcome: The OS version is provided for Windows, while the Kernel version is brought to the HOST Object Type for Linux.
Windows OS | Linux OS |
---|---|
Environment
Assets Discovery / Assets Management Cloud/Data Center
Solution
The retrieval of Kernel information for Linux or OS version for Windows is facilitated through the Linux_OS.pat file and Windows_OS.pat file, respectively, as outlined in our documentation Commands executed by Assets Discovery.
This information is then stored under the 'Operating System' Object Type.
To incorporate this information into the HOST Object Type, there are several steps to follow:
Two new custom patterns should be developed or you can utilize the Linux_OS.pat and Windows_OS.pat files accessible in Discovery.
We recommend that you develop and test a new pattern in a non-production environment and set up a connection to the Host or Device that returns the result data you want to handle with from Discovery.
- If using Linux_OS.pat and Windows_OS.pat, the following code needs to be added to end of the files. The code introduces a new custom property to the host object.
You will find a slight variation of the same code below; for Linux, we obtain hostInfo.OS.Kernel, and for Windows, we obtain hostInfo.OS.Version. This approach can also be applied to other attributes if necessary. For more information about create a custom pattern and ExtendedInformations code, please refer to - Create custom patterns
Linux_OS.patif (hostInfo.ExtendedInformations.IsNullOrEmpty()) { hostInfo.ExtendedInformations = new List<ExtendedInformation>(); } hostInfo.ExtendedInformations.Add(new ExtendedInformation { Name = "OS version", Value = hostInfo.OS.Kernel });
Windows_OS.patif (hostInfo.ExtendedInformations.IsNullOrEmpty()) { hostInfo.ExtendedInformations = new List<ExtendedInformation>(); } hostInfo.ExtendedInformations.Add(new ExtendedInformation { Name = "OS version", Value = hostInfo.OS.Version});
- Add a new attribute to the HOST Object Type
- Go to Assets > Host Object Type > Attribute tab and create a new attribute type text
- Go to Assets > Host Object Type > Attribute tab and create a new attribute type text
- Adjust the import configuration to map the new attribute so when the import is sync, the new value is mapped.
- Go to your Import-Configuration and expand to the Object-Type Mapping
- Add the mapping between the new Attributes and the Data-Locators that are now available (Result data with Extended-Informations needs to be place in the import folder to get the Locators)
- Sync the Discovery Assets import.
Here you can find the 2 custom patterns files for reference. We recommend testing these patterns in a non-production environment before using them in your production instance.