CFEngine 3 Tip: Find out what classes are being defined

CFEngine defines a classes for decision mak­ing dur­ing runs. Many of these hard classes you can see by run­ning cf-promises –v. That wont show you all the other classes that are raised dur­ing a pol­icy run.

You could run some­thing like this to see what classes are raised dur­ing execution.

cf-agent -KIv | grep "cf3>\s*+" | grep -v :

But that isn’t really a clear pic­ture under nor­mal oper­a­tion. You can use the all­class­es­re­port in body agent con­trol to write out a list of classes defined dur­ing exe­cu­tion in /var/cfengine/state/allclasses.txt. It can be handy to have. I was recently want­ing to do some­thing when pol­icy was exe­cuted by cf-execd but not when exe­cuted man­u­ally. Based on all the other auto­matic classes defined I had a sus­pi­cion there was an auto­matic class for that, and I had no need to man­u­ally add a class to exec_command in body execu­tor con­trol. I turned on the all­class­es­re­port and sure enough, I found from_cfexecd was being raised.

Of course all of this infor­ma­tion is read­ily avail­able for remote agents in the dash­board of the enter­prise ver­sion. And with the 25free pro­gram to get started, you should def­i­nitely take a look.

No Comments

Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha