mardi 28 janvier 2020

Inspec command not printing the memory of a server

By executing from inspec.backend.run_command. It's only printing CPU and not memory if i use awk in $memory.

Here is my code:

control 'nodes_certs' do
impact 0.7
title 'nodes_certs'
desc 'An optional description...'

nodecert=inspec.backend.run_command("name() { local cpu=$(nproc); local mem=$(free -g | awk \'/Mem/ {print $2}\'); echo $cpu; echo $mem ; }; name\'").stdout

print nodecert

end

Here is output:

16

Profile: tests from mem.rb (tests from mem.rb) Version: (not specified) Target: local://

 No tests executed.

Aucun commentaire:

Enregistrer un commentaire