Re: cf-agent and memory usage
Stefan Skoglund <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
tis 2022-01-04 klockan 09:00 -0800 skrev '[email protected]' via help-cfengine: > Here are the docs for the datastate() function for reference: > https://docs.cfengine.com/docs/3.18/reference-functions-datastate.html > > I would assume that the return from datastate() is quite large due to > your policy defining many vars and classes. > > Can you give a minimal reproducer of some sort or some more > information about your policy that does something like > > ``` > "state" data => datastate(); > ``` > > From what you said I assume you have something like that and using > cf-agent --verbose or --debug you can see that it is "redone in pass > 2"? > > Could you use classesmatching to find just the classes you want and > send those to your template? > https://docs.cfengine.com/docs/3.18/reference-functions-classesmatching.html > > -Craig > > On Tuesday, January 4, 2022 at 10:32:22 AM UTC-6 [email protected] > wrote: > > tis 2022-01-04 klockan 16:54 +0100 skrev Stefan Skoglund: > > > I have a error in my policy such that cf-agent on the hub eats up > > all > > > memory (a virtual machine with 5G of RAM allocated) and when > > crashes > > > with xrealloc: > > > --- > > > notice: Q: "...ne/bin/git pull": Already up to date. > > > xreallocCRITICAL: Unable to allocate memory > > > --- > > > > > > This is enterprise 18.1. > > > > > > How to debug ? > > > > > > Do cf-agent pulls down data from the clients or is it cf-hub who > > does > > > that ? > > > > > > > answering to myself, i have a policy which load data_state() into > > an > > container in pass 1 and then it is redone in pass 2. > > > > I wanted the classes part from data_state which is then used in a > > custom template_data container. > > > > It isn't the first time i have tried this..... > > > -- > You received this message because you are subscribed to the Google > Groups "help-cfengine" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/help-cfengine/d00fbec3-42f8-4e3d-8cfd-53c48e009a6bn%40googlegroups.com > . Hmm, anyone which has used classesmatching(".*", "hardclass") to get something which can be checked for in mustache templates using '#' ie equal to: --- {{#classes.debian_11}} ..... {{/classes.debian_11}} --- I would need the classes from the environment or those defined in def.json. -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/4b950a465c75fc44054dd3de00362defb29a4517.camel%40agj.net.