Custom Smart State Analysis Profiles

Posted by Christian Jung on Tue, Oct 10, 2017

About Smart State Analysis

CloudForms and ManageIQ have a feature called “Smart State Analysis” which allows them to analyse the disk of a Virtual Machine, Instance, Template or Image and retrieve data about the installed Operating System, applications, local groups and users and more. This is implemented completely without the need of additional agents and as a consequence is independent of the VM power state.

Smart State can be also sued for Containers and Hypervisors, but the following example focuses on Virtual Machines.

Smart State Analysis Profiles

A Smart State Analysis Profile defines which information is retrieved from the Virtual Machine. By default the following information is retrieved:

  • Services: Which services are installed (Works for Windows and Linux including SysV and SystemD)

  • User Accounts: Retrieves information about local user and group accounts

  • Software: Information about installed applications (on Windows retrieved from the registry, on Linux by running a query against the RPM or dpkg database)

  • VM Configuration and System: some additional information about the VM

Administrators can create their own Analysis Profiles and define a list of additional files which should be retrieved. The Profile can either only check for the existence of the specified file, or also retrieve the content of the file.

Create a custom Smart State Analysis Profile

It is very simple to create a customized Profile. Simply copy the out of the box “sample” Profile and name the copy “default”.

  1. log into the appliance with administrator privileges

  2. navigate to Configuration by clicking on the username on the top right corner

  3. navigate to Analysis Profiles, simple

  4. click on Configuration and Copy selected analysis profile

copy analysis profile

  1. make sure the copy is called “default” and check or un-check the appropriate options

name the profile default

If the Profile is not called “default” it will not be used unless it is explicitly assigned. Read the chapter Assigning a Custom Analysis Profile to a Virtual Machine in the CloudForms Documentation for more details.

Modify the Smart State Analysis Profile

To show how this feature works, add an additional file. In the example below, the content of /etc/sysconfig/selinux is retrieved during Smart State Analysis. There is another blog post about How to create a Compliance Policy to enforce SELinux mode illustrating why this can be useful.

Edit the previously created State Analysis Profile:

  1. log into the appliance with administrator privileges

  2. navigate to Configuration by clicking on the username on the top right corner

  3. navigate to Analysis Profiles, default

  4. click on the tab file

  5. add a new line:

Name: /etc/sysconfig/selinux

Collect Contents? click (check the box)

Add selinux to Analysis Profile

Click save on the right in the same row of the table

  1. click Add to save all modifications

Note: It is important the name of the Profile is “default”. To use a different Profile name, check the chapter Assigning a Custom Analysis Profile to a Virtual Machine in the CloudForms Documentation for more information.