I'll just additionally mention that this is easily done in Nova using measurements promises since I'm doing exactly this and several other things (total memory, cpu speed, etc.):
measurements: linux:: "/proc/cpuinfo" handle => "linux_cpu_count", stream_type => "file", data_type => "counter", history_type => "scalar", units => "CPUs", match_value => extract_line_value("processor.*", "processor\s+:\s+(\d+)"); solaris:: "/usr/sbin/psrinfo -v" handle => "sunos_cpu_count", stream_type => "pipe", data_type => "counter", history_type => "scalar", units => "CPUs", match_value => extract_line_value("Status.*", "processor\s+(\d+).*"); Justin -----Original Message----- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of fo...@cfengine.com Sent: Tuesday, May 04, 2010 2:24 AM To: help-cfengine@cfengine.org Subject: Cfengine Help: Re: sys.ncpu or something? Forum: Cfengine Help Subject: Re: sys.ncpu or something? Author: Seva Gluschenko Link to topic: https://cfengine.com/forum/read.php?3,17088,17090#msg-17090 Nakarin, Of course, I can make it even shorter and safer: vars: linux:: "ncpu" string => execresult("/bin/grep -c ^processor /proc/cpuinfo", "noshell"); freebsd:: "ncpu" string => execresult("/sbin/sysctl -n hw.ncpu", "noshell"); It just seems to be a good coin to have right inside in the Cfengine and omit external commands. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine This electronic communication and any attachments may contain confidential and proprietary information of DigitalGlobe, Inc. If you are not the intended recipient, or an agent or employee responsible for delivering this communication to the intended recipient, or if you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this communication in error, and delete the copy you received. DigitalGlobe reserves the right to monitor any electronic communication sent or received by its employees, agents or representatives. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine