Custom inventory scripting

<< Click to Display Table of Contents >>

Raynet One > 1.1 > User Guide > Technical overview 

Custom inventory scripting

The IT world is moving at a rapid pace. New technology emerges day by day, posing a big challenge to the people managing those evolving IT systems. In order to capture device configuration not yet covered by Raynet One's scanning technology you can create and register self-made, custom device inventory scripts. Collect the device data most valuable to you in the way and representation you truly want.

 

The idea of custom inventory scripts is to map device data to well-defined inventory objects for device inventory purposes. The script execution environment is kept minimal and thus robust. Device commands are executed using the access level of the provided credentials in the web interface. The execution time is partitioned between runner and inventory machine.

 

Two inventory script languages are supported: CSM and Python. CSM is a basic computation language making heavy use of the XML notation. It is meant to allow direct conversion of device command output to inventory objects. Python is an advanced computation language. Other than CSM, it allows you to logically transform data and supports fine-grained object mutation (for example integers, single characters of strings, boolean arithmetic). We consider CSM support as legacy, adopting the technology from our Scan Engine product.

 

The use-cases for each inventory script language are designed to show-case language features and device inventory interaction methods. Read the description in each sub-chapter to learn more about them. Collect all the ideas to use them for your very own scripts.

Designing a custom device inventory process

Due to the minimalist nature of the custom inventory scripts, the partitioning of your custom inventory process into multiple components is a good idea.

clip0127

The execution time of the inventory scripts is divided/partitioned between the inventory machine (first node from the left) and the runner (second node from the left). All data is ultimately collected and merged by the runner. The final data representation is pushed to the device inventory database using inventory object importing.

Device inventory script assignments

Inventory scripts can be assigned in relation to multiple scopes: single inventory run, device-local or global. The selection priority of the assignments is in the same order as listed. The entire set of assignments of a higher scope overrides all assignments of a lower scope for individual inventory runs.

 

clip0128

The inventory script assignment scopes illustrated by proximity to the device inventory task. The closer the scope is, the higher is the selection priority.

Processing of device command output

The command output returned by the PythonConnector.run function is a list of lines. This representation is a list of strings separated by the \n or the \r\n character sequences (interpreted and transformed as part of a C-style string, of course). On Unix-like platforms, the output excludes any occurence of the \r character.

 

Due to the ambiguity of the newline character sequence it is not possible to transform back to the exact command output. Using string concatenation you can obtain a single string. There is an established reasoning behind this design choice. Linux commands are known to split their standard output into multiple lines because they feel like it. The conversion into a line list representation is meant to closely match this platform habit, aiding common workflows. The join method of the Python str type is a recommended tool.

Disclaimer

The information processing in the following use-cases is kept very simple for illustration purposes. The compatibility and future-stability is not of importance. More advanced technology is used in Raynet One itself. Try these use-cases yourself and maintain them at your own volition. The ideas displayed in them are valuable.