diff --git a/gatherer/cpu_information.sh b/gatherer/cpu_information.sh index 2c1bb5e..86373c8 100644 --- a/gatherer/cpu_information.sh +++ b/gatherer/cpu_information.sh @@ -3,6 +3,7 @@ gather_cpu_info() { has_class "GNU" && { export NCPUS=$(${NPROC}) + set_class ${NCPUS}cpus } has_class "Linux" && { @@ -18,9 +19,14 @@ gather_cpu_info() { } /CPU(s):/ { print "export NCPUS=" $2 ";" } /Virtualization/ { print "export CPU_VIRT=\"" $2 "\";" }') + + set_class ${NCPUS}cpus ${CPU_VIRT} ${BYTE_ORDER} ${OP_MODES} } - set_class ${NCPUS}cpus ${CPU_VIRT} ${BYTE_ORDER} ${OP_MODES} + has_class "FreeBSD" && { + export NCPUS=$(${SYSCTL} kern.smp.cpus | cut -d\ -f2) + set_class ${NCPUS}cpus + } } # vim: set ts=4 sw=4: diff --git a/gatherer/misc_information.sh b/gatherer/misc_information.sh index ba9f3f6..32b532f 100644 --- a/gatherer/misc_information.sh +++ b/gatherer/misc_information.sh @@ -6,28 +6,37 @@ gather_uptime_info() { export LOAD_5="" export LOAD_15="" - has_class "Linux" && { - eval $(${AWK} -v ncpus=${NCPUS} '{ - print "LOAD_1=\"" $1 "\";LOAD_5=\"" $2 "\";LOAD_15=\"" $3 "\";"; - for(i=1; i<4; i++) { - if($i<=0.0) { - load="LOW" + local CALC_LOAD_AWK='{ + print "LOAD_1=\"" $1 "\";LOAD_5=\"" $2 "\";LOAD_15=\"" $3 "\";"; + for(i=1; i<4; i++) { + if($i<=0.0) { + load="LOW" + } else { + inv_load=ncpus/$i; + if (inv_load > (ncpus/2)) { + load="LOW"; } else { - inv_load=ncpus/$i; - if (inv_load > (ncpus/2)) { - load="LOW"; - } else { - load="MODERATE"; - } - if (inv_load <= 0) load="HIGH"; + load="MODERATE"; } - - if(i==1) { classes=classes "LOAD_1_" load " " } - if(i==2) { classes=classes "LOAD_5_" load " " } - if(i==3) { classes=classes "LOAD_15_" load " "; } + if (inv_load <= 0) load="HIGH"; } - print "set_class " classes ";"; - }'