CFEngine 3 Tip: Find out what classes are being defined

CFEngine defines a classes for decision making during runs. Many of these hard classes you can see by running cf-promises -v. That wont show you all the other classes that are raised during a policy run.

You could run something like this to see what classes are raised during execution.

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

But that isn’t really a clear picture under normal operation. You can use the allclassesreport in body agent control to write out a list of classes defined during execution in /var/cfengine/state/allclasses.txt. It can be handy to have. I was recently wanting to do something when policy was executed by cf-execd but not when executed manually. Based on all the other automatic classes defined I had a suspicion there was an automatic class for that, and I had no need to manually add a class to exec_command in body executor control. I turned on the allclassesreport and sure enough, I found from_cfexecd was being raised.

Of course all of this information is readily available for remote agents in the dashboard of the enterprise version. And with the 25free program to get started, you should definitely 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