Collecting and reporting on custom inventory

February 2, 2015

Sometimes you need to collect some small amount of data from your hosts and aggregate it to a central location for reporting. For example, you could have a command that returns the status of a hardware check that you run regularly to detect hardware faults. Or you could want a report of all the hosts’ DNS configuration. In either case, you can use the CFEngine Enterprise inventory collection and reporting mechanism. This is based on a variable or class from the CFEngine language, but with a specific meta tag attached to it. For example, to get the System UUID from your hosts you could integrate the following to your policy: vars: "system_uuid" string => execresult("/usr/sbin/dmidecode/dmidecode -s system-uuid", "useshell"), meta => { "inventory", "attribute_name=System UUID" }; After 15 minutes you can see this as a new inventory attribute in the CFEngine Enterprise Mission Portal UI, under Reports -> Inventory: The inventory reporting interface is very easy to use, so anyone can be allowed to generate reports - saving the system administrator from requests to make “special reports”. You can learn more about creating custom inventory in the learn section.