#!/bin/bash source './so-variables' # Helper functions filter_unused_nics() { # Set the main NIC as the default grep search string local grep_string="$MNIC" # If we call this function and NICs have already been assigned to the bond interface then add them to the grep search string if [[ $BNICS ]]; then for BONDNIC in "${BNICS[@]}"; do grep_string="$grep_string\|$BONDNIC" done fi # Finally, set filtered_nics to any NICs we aren't using (and ignore interfaces that aren't of use) filtered_nics=$(ip link | grep -vwe "$grep_string" | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2}') export filtered_nics } calculate_useable_cores() { # Calculate reasonable core usage local cores_for_bro=$(( CPUCORES/2 - 1 )) local lb_procs_round lb_procs_round=$(printf "%.0f\n" $cores_for_bro) if [ "$lb_procs_round" -lt 1 ]; then lb_procs=1; else lb_procs=$lb_procs_round; fi export lb_procs } set_defaul_log_size() { case $INSTALLTYPE in EVAL | HEAVYNODE) PERCENTAGE=50 ;; *) PERCENTAGE=80 ;; esac local disk_dir="/" if [ -d /nsm ]; then disk_dir="/nsm" fi local disk_size_kb disk_size_kb=$(df $disk_dir |grep -v "^Filesystem" | awk '{print $2}') local percentage=85 local disk_size disk_size=$(( disk_size_kb * 1000 )) local percentage_disk_space percentage_disk_space=$(( disk_size * (percentage / 100) )) export log_size_limit=$(( percentage_disk_space / 1000000000 )) }