Forum: Cfengine Help Subject: Validation: Error reading assumed real value Author: berntjernberg Link to topic: https://cfengine.com/forum/read.php?3,21333,21333#msg-21333
Hi, Once a day I check memory usage of cf-execd. It's restarted if the usage is above a fixed limit. The code works and restarts the process if you lower the cfexecd_max_mem value. I get this mailed to me at 01 AM. I saw this in an earlier post. Validation: Error reading assumed real value 7112 1520 (anomalous remainder 1520) Validation: Error reading assumed real value 7112 1520 (anomalous remainder 1520) Validation: Error reading assumed real value 7112 1520 (anomalous remainder 1520) The rss column value of cf-execd is 7112. Here is the code I use. I had problem with process parsing in Solaris so I went with ps/pkill/pgrep until this feature is fixed. bundle common g { vars: solaris:: "workdir" string => "/var/cfengine"; "cfexecd" string => "$(g.workdir)/bin/cf-execd"; "nawk" string => "/usr/bin/nawk"; "pgrep" string => "/usr/bin/pgrep"; "pkill" string => "/usr/bin/pkill"; "ps" string => "/usr/bin/ps"; "zonename" string => "/usr/bin/zonename"; "zone_name" string => execresult("$(g.zonename)","noshell"); "cfexecd_max_mem" string => "8000"; "cfserverd_max_mem" string => "7000"; } # # Schedule-options for cf-execd. # body executor control { any:: splaytime => "5"; mailto => "m...@mydom.com"; mailfrom => "cfengine@$(sys.host)"; smtpserver => "localhost"; mailmaxlines => "100"; executorfacility => "LOG_DAEMON"; # How often will the agent run. schedule => { "Min05", "Min20", "Min35", "Min50" }; # The full path and command to the executable run by default (overriding builtin). exec_command => "/var/cfengine/bin/cf-twin -f /var/cfengine/inputs/failsafe.cf && \ /var/cfengine/bin/cf-agent"; } # # Process options for cf-execd. # bundle agent executor { vars: !pid_checked.solaris:: "cfexecd_pid" string => execresult("$(g.pgrep) -z $(g.zone_name) -f \"$(g.cfexecd)\"","noshell"); "pid_is_checked" string => "yes"; !mem_checked.Hr01_Q1.solaris:: "cfexecd_mem_usage" string => execresult("$(g.ps) -z $(g.zone_name) -fo rss,args 2>&1 | $(g.nawk) '$NF ~ /cf-execd/ { print $1 }'","useshell"); "mem_is_checked" string => "yes"; classes: "cfexecd_started" not => regcmp("$(cfexecd_pid)",""); "pid_checked" expression => regcmp("$(pid_is_checked)","yes"); "mem_checked" expression => regcmp("$(mem_is_checked)","yes"); "memory_leak" expression => isgreaterthan("$(cfexecd_mem_usage)","$(g.cfexecd_max_mem)"); commands: cfexecd_started.memory_leak.solaris:: "$(g.pkill)" args => "-z $(g.zone_name) -f \"$(g.cfexecd)\"", classes => if_repaired("start_cfexecd"); !start_cfexecd.memory_leak.solaris:: "$(g.pkill)" args => "-9 -z $(g.zone_name) -f \"$(g.cfexecd)\"", classes => if_repaired("start_cfexecd"); start_cfexecd|!cfexecd_started:: "$(g.cfexecd)", classes => if_repaired("cfexecd_started"); } Do you see any errors in my code or have I hit a feature? I use community version 3.1.4. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine