Use case: get configurations

<< Click to Display Table of Contents >>

Raynet One > 1.1 > User Guide > Technical overview > Custom inventory scripting > CSM inventory scripting 

Use case: get configurations

Proper device operation depends on the valid configuration of your IT landscape devices. Unlike the Windows Registry, Unix devices usually store their main configuration inside of local files. Configuration files are known to have common file extensions. Collect and evaluate device configuration files to gain further IT visibility over your device services. Mitigate security risks caused by improper configuration.

 

In this use-case, the inventory device is searched for any file with the .conf extension. This set of files is put into custom ConfigFile class inventory objects.

Program content

<CustomScriptSet Name="GetConfigurations">
    <CustomScript Name="GetConfigurations1">
        <Command Name="lines" OnError="fail">find / | grep '\.conf$'</Command>
        <ForeachLine Values="$(lines)" Name="line">
            <Command Name="content" OnError="fail">cat '$(line)' | head -c 20000</Command>
            <Item Name="$(line)" Class="ConfigFile" ItemName="$(line)">
                <Property Name="Content" Value="$(content)" />
            </Item>
        </ForeachLine>
    </CustomScript>
</CustomScriptSet>

Remarks

This program is the CSM form of executing commands based on many lines. The initial command obtains a list of all paths on the Unix file graph ending with the character sequence .conf. Each path is put onto its own line. Then, the cat command is used on each line to obtain file contents. Finally, for each file content, a new inventory object of class ConfigFile is created having the configuration content in its parameter.

Screenshots

clip0130