shell 巡检F5 v1.2.1

首页 / 🍁F5 / 正文

📝 描述:该脚本用于自动化巡检F5,适用于BIG-IP 12版本以上。有问题可随时留言与我联系

1. 更新内容
📋 调整后台输出报告信息。


2. 创建脚本
🚀 选择复制下列选项卡全部内容,命令行登录设备,使用以下命令创建脚本。示例如下:


vim /var/tmp/xj.sh


复制以下脚本内容至xj.sh中。

#!/bin/bash

# Author : Hongbao Wang
# Date : 2022/04/28
# Url : www.whbblog.cn
# Description : This script is used to detect F5 status information.


#define variable
hostname=`uname -a |cut -d ' ' -f2`
date=`date +"%y%m%d"`


# begin_function
function begin_execute(){
  echo -e "\033[32m\nBegin to execute shell script,Please Wait for a few minutes.\033[0m"
  echo "------------------------------------------------------------"
}

# output base_info
function base_info(){

  echo -e "\033[33m1. Basic equipment information\033[0m"

  #output hostname
  echo -e "\t 1). Hostname :\t\t\t\t $hostname"

  #output model
  model=`tmsh  show sys hardware|grep -A 1 "Platform"|grep ^"  Name"|awk -F "Name  " '{print $2}'`
  echo -e "\t 2). BIG-IP Model : \t\t\t $model"

  #output Serial Number
  sn=` tmsh show sys hardware | grep -E "Chassis Serial|Appliance Serial"|awk '{print $3}'`
  echo -e "\t 3). Serial Number : \t\t\t $sn"

  #output ManagementIP
  ManagementIP=`tmsh list sys management-ip |awk '{print $3}'`
  echo -e "\t 4). Management_IP : \t\t\t $ManagementIP"

  #output Version
  F5version=`tmsh show sys version|grep 'Version '|awk '{print $2}'`
  echo -e "\t 5). BIG-IP Version : \t\t\t $F5version \n"
}


# output cluster_info
function cluster_info(){

  echo -e "\033[33m2. Cluster status information\033[0m"

  #output Failover-status
  failoverstatus=`tmsh  show cm failover-status  | grep ^"Status" | awk '{print $2}'`
  echo -e "\t 1). Failover Status : \t\t\t $failoverstatus"

  #output Sync-status
  syncstatus=`tmsh  show cm sync-status  | grep ^"Status" | awk '{print $2,$3}' `
  echo -e "\t 2). Sync Status : \t\t\t $syncstatus \n"
}



function stastistic(){

  echo -e "\033[33m3. Business status information\033[0m"

  #output CPU Utilization
  cpu=`tmsh show sys cpu|grep "Utilization"|awk '{print $3}'`
  echo -e "\t 1). CPU Utilization :\t\t\t $cpu%"

  #output Memory Utilization
  mem=`tmsh show sys memory|grep "TMM Memory Used"|awk '{print $5}' `
  echo -e "\t 2). Memory Utilization :\t\t $mem%"

  #output Number of New Connnections
  new_conn=`tmsh show sys performance connections| grep "Client Connections"|awk '{print $3}'`
  echo -e "\t 3). New Connections : \t\t\t $new_conn"

  #output Number of Total Connections
  active_conn=`tmsh show sys performance connections| grep ^"Connections"|awk '{print $3}'`
  echo -e "\t 4). Total Connections : \t\t $active_conn"

  #output Throughout
  throughput=`tmsh show sys performance throughput | grep "Service"|head -1|awk '{print $2}'`
  echo -e "\t 5). Throughput : \t\t\t $throughput \n"

  #output virtual Status
  echo -e "\033[33m4. Virtual Server Health Information\033[0m"
  virtual_name=`tmsh list ltm virtual| grep "ltm virtual "|awk '{print $3}'`
  available_=0
  unknown_=0
  offline_=0

  for virtual_ in $virtual_name
  do
    vs_status=`tmsh show ltm virtual $virtual_ | grep Availability|awk '{print $3}'`
    if [[ $vs_status = "available" ]] ;then
        available_=$[$available_+1]
    elif [[ $vs_status = "unknown" ]] ;then
      unknown_=$[$unknown_+1]
    elif [[ $vs_status = "offline" ]] ;then
      offline_=$[$offline_+1]
    fi
  done
  echo -e "\t 1). Virtial Available : \t\t $available_"
  echo -e "\t 2). Virtial unknown : \t\t\t $unknown_"
  echo -e "\t 3). Virtial offline : \t\t\t $offline_ \n"
}


function log_status(){

  #output Nummber of System Warning Log
  echo -e "\033[33m5. Log Warning Information\033[0m"

  sys_log=`cat /var/log/messages|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 1). System Warning Log : \t\t $sys_log"

  #output Number of Ltm Warning Log
  ltm_log=`cat /var/log/ltm|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 2). LTM Warning Log : \t\t\t $ltm_log"

  #output Number of GTM Warning Log
  gtm_log=`cat /var/log/gtm|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 3). GTM Warning Log : \t\t\t $gtm_log"

  #LCD log
  lcd_log=`tmsh show sys alert|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 4). LCD Warning Log : \t\t\t $lcd_log \n"
}


function device_hardware(){

  echo -e "\033[33m6. Device Hardware Information\033[0m"

  #fanstatus
  echo -e "\t 1). Device Fans Status :"
  fan_number=`tmsh show sys hardware field-fmt | grep "chassis-fan-status-index"|awk '{print $4}'`
  for fan_n in $fan_number
  do
    fan_sta=`tmsh show sys hardware field-fmt | sed -n '/chassis-fan-status-index $fan_n {/,/}/p' | grep "status "|awk '{print $2}'`
    if [ $fan_sta=="up" ]
    then
      echo -e "\t\tFans $fan_n Status : \t\t Success"
    else
      echo -e "\t\t\033[31mFans $fan_n Status: \t\t Failed\033[0m"
    fi
  done

  #output Temperature status
  echo -e "\t 2). Temperature $temp_n Status :"
  temp_number=`tmsh show sys hardware field-fmt | grep "chassis-temperature-status-index"|awk '{print $4}'`
  for temp_n in $temp_number
  do
    cur_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "temperature "|awk '{print $2}'`
    lo_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "lo-limit"|awk '{print $2}'`
    high_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "hi-limit"|awk '{print $2}'`
  if [ $cur_temp -le $high_temp ] && [ $cur_temp -ge $lo_temp ];then
    echo -e "\t\tTemp $temp_n Status : \t\t Success"
  else
    echo -e "\t\t\033[31mTemp $temp_n Status : \t\t Failed\033[0m"
  fi
  done

  #powerstatus
  echo -e "\t 3). Device Power status :"
  power_number=`tmsh show sys hardware field-fmt | grep "chassis-power-supply-status-index"|awk '{print $4}'`

  for power_name in $power_number
  do
    power_status=`tmsh show sys hardware field-fmt | grep -A4 "chassis-power-supply-status-index 1"| grep "status up"|awk '{print $2}'`
    if [ $power_status == "up" ];then
      echo -e "\t\tPower $power_name status: \t\t Success"
    else
      #echo -e "\t 3). Power Supply $power_name : \t\t\t Failed"
      echo -e "\t\t\033[31mPower $power_name status: \t\t Failed\033[0m"
    fi
  done

  #Trunk Used Interface Status
  echo -e "\033[33m\n7. Device Interface Information\033[0m"

  trunk_name=`tmsh list net vlan one-line | grep "interfaces"| awk -F "interfaces { " '{print $2}'|awk -F " {" '{print $1}'|sort -u|grep -v ^"[0-9]"`
  for trunk_ in $trunk_name
  do
  trunk_interface=`tmsh list net trunk $trunk_ interfaces | awk '{print $1}'|grep ^[0-9]`
  for interface_ in $trunk_interface
    do
      isun=`tmsh show net interface $interface_ field-fmt | grep "status up"|wc -l`
      if [[ $isun == "1" ]];then
        echo -e "\t Trunk : $trunk_ Interface $interface_ Status : \t Success"
      else

    echo -e "\t\033[31m Trunk : $trunk_ Interface $interface_ Status : \t Failed\033[0m"
      fi
    done
  done

  #Vlan Used Interface Status
  interface_name=`tmsh list net vlan one-line | grep "interfaces"| awk -F "interfaces { " '{print $2}'|awk -F " {" '{print $1}'|sort -u|grep ^[0-9]
`
  for inte_name in $interface_name
  do
    interface_sta=`tmsh show net interface $inte_name field-fmt | grep "status up"|wc -l`
    if [[ $interface_sta == "1" ]];then
        echo -e "\t Interface $inte_name Status : \t\t Success"
      else
        echo -e "\t\033[31m Interface $inte_name Status : \t\t Failed\033[0m"
      fi
    done
}


function backup_config(){

  #backup config
  echo -e "\n\033[33m8. Backup configuration\033[0m"

  dir="/var/local/ucs/"

  tmsh save sys ucs $date$hostname.ucs  >/dev/null 2>&1

  backup=`find $dir -name $date$hostname.ucs`
  if [[ $backup =~ ".ucs" ]]
  then
    echo -e "\tUCS Backup :  \t\t\t\t Success"
  else
    echo -e "\t\033[31m UCS Backup :  \t\t\t\t Failed\033[0m"
  fi
}

# finish_execute
function finish_execute(){

  echo -e "\n------------------------------------------------------------"
  echo -e "\033[32mDevice Check Finish .\n\033[0m"
}

begin_execute
base_info
cluster_info
stastistic
log_status
device_hardware
backup_config
finish_execute

#!/bin/bash

# Author : Hongbao Wang
# Date : 2022/04/28
# Url : www.whbblog.cn
# Description : This script is used to detect F5 status information.


#define variable
hostname=`uname -a |cut -d ' ' -f2`
date=`date +"%y%m%d"`


# begin_function
function begin_execute(){
  echo -e "\033[32m\nBegin to execute shell script,Please Wait for a few minutes.\033[0m"
  echo "------------------------------------------------------------"
  echo "$hostname Check Information" > /var/tmp/$date$hostname.txt
  echo "------------------------------------------------------------" >> /var/tmp/$date$hostname.txt
}

# output base_info
function base_info(){

  echo -e "\033[33m1. Basic equipment information\033[0m"
  echo -e "1. Basic equipment information" >> /var/tmp/$date$hostname.txt

  #output hostname
  echo -e "\t 1). Hostname :\t\t\t\t $hostname"
  echo -e "\t 1). Hostname      :\t\t\t $hostname" >> /var/tmp/$date$hostname.txt

  #output model
  model=`tmsh  show sys hardware|grep -A 1 "Platform"|grep ^"  Name"|awk -F "Name  " '{print $2}'`
  echo -e "\t 2). BIG-IP Model  : \t\t\t $model"
  echo -e "\t 2). BIG-IP Model  : \t\t\t $model" >> /var/tmp/$date$hostname.txt

  #output Serial Number
  sn=` tmsh show sys hardware | grep -E "Chassis Serial|Appliance Serial"|awk '{print $3}'`
  echo -e "\t 3). Serial Number : \t\t\t $sn"
  echo -e "\t 3). Serial Number : \t\t\t $sn" >> /var/tmp/$date$hostname.txt

  #output ManagementIP
  ManagementIP=`tmsh list sys management-ip |awk '{print $3}'`
  echo -e "\t 4). Management_IP : \t\t\t $ManagementIP"
  echo -e "\t 4). Management_IP : \t\t\t $ManagementIP" >> /var/tmp/$date$hostname.txt

  #output Version
  F5version=`tmsh show sys version|grep 'Version '|awk '{print $2}'`
  echo -e "\t 5). BIG-IP Version : \t\t\t $F5version \n"
  echo -e "\t 5). BIGIP Version : \t\t\t $F5version \n" >> /var/tmp/$date$hostname.txt
}


# output cluster_info
function cluster_info(){

  echo -e "\033[33m2. Cluster status information\033[0m"
  echo -e "2. Cluster status information" >> /var/tmp/$date$hostname.txt

  #output Failover-status
  failoverstatus=`tmsh  show cm failover-status  | grep ^"Status" | awk '{print $2}'`
  echo -e "\t 1). Failover Status : \t\t\t $failoverstatus"
  echo -e "\t 1). Failover Status : \t\t\t $failoverstatus" >> /var/tmp/$date$hostname.txt

  #output Sync-status
  syncstatus=`tmsh  show cm sync-status  | grep ^"Status" | awk '{print $2,$3}' `
  echo -e "\t 2). Sync Status : \t\t\t $syncstatus \n"
  echo -e "\t 2). Sync Status     : \t\t\t $syncstatus \n" >> /var/tmp/$date$hostname.txt
}



function stastistic(){

  echo -e "\033[33m3. Business status information\033[0m"
  echo -e "3. Business status information" >> /var/tmp/$date$hostname.txt

  #output CPU Utilization
  cpu=`tmsh show sys cpu|grep "Utilization"|awk '{print $3}'`
  echo -e "\t 1). CPU Utilization :\t\t\t $cpu%"
  echo -e "\t 1). CPU Utilization    : \t\t $cpu%" >> /var/tmp/$date$hostname.txt

  #output Memory Utilization
  mem=`tmsh show sys memory|grep "TMM Memory Used"|awk '{print $5}' `
  echo -e "\t 2). Memory Utilization :\t\t $mem%"
  echo -e "\t 2). Memory Utilization : \t\t $mem%" >> /var/tmp/$date$hostname.txt

  #output Number of New Connnections
  new_conn=`tmsh show sys performance connections| grep "Client Connections"|awk '{print $3}'`
  echo -e "\t 3). New Connections : \t\t\t $new_conn"
  echo -e "\t 3). New Connections    : \t\t $new_conn" >> /var/tmp/$date$hostname.txt

  #output Number of Total Connections
  active_conn=`tmsh show sys performance connections| grep ^"Connections"|awk '{print $3}'`
  echo -e "\t 4). Total Connections  :\t\t $active_conn"
  echo -e "\t 4). Total Connections  : \t\t $active_conn" >> /var/tmp/$date$hostname.txt

  #output Throughout
  throughput=`tmsh show sys performance throughput | grep "Service"|head -1|awk '{print $2}'`
  echo -e "\t 5). Throughput : \t\t\t $throughput \n"
  echo -e "\t 5). Throughput         : \t\t $throughput \n" >> /var/tmp/$date$hostname.txt


  #output virtual Status
  echo -e "\033[33m4. Virtual Server Health Information\033[0m"
  echo -e "\n4. Virtual Server Health Information" >> /var/tmp/$date$hostname.txt
  virtual_name=`tmsh list ltm virtual| grep "ltm virtual "|awk '{print $3}'`
  available_=0
  unknown_=0
  offline_=0

  for virtual_ in $virtual_name
  do
    vs_status=`tmsh show ltm virtual $virtual_ | grep Availability|awk '{print $3}'`
    if [[ $vs_status = "available" ]] ;then
        available_=$[$available_+1]
    elif [[ $vs_status = "unknown" ]] ;then
      unknown_=$[$unknown_+1]
    elif [[ $vs_status = "offline" ]] ;then
      offline_=$[$offline_+1]
    fi
  done
  echo -e "\t 1). Virtial Available : \t\t $available_"
  echo -e "\t 2). Virtial unknown : \t\t\t $unknown_"
  echo -e "\t 3). Virtial offline : \t\t\t $offline_ \n"
  echo -e "\t 1). Virtial Available : \t\t $available_" >> /var/tmp/$date$hostname.txt
  echo -e "\t 2). Virtial unknown   : \t\t $unknown_" >> /var/tmp/$date$hostname.txt
  echo -e "\t 3). Virtial offline   : \t\t $offline_ \n" >> /var/tmp/$date$hostname.txt
}


function log_status(){

  #output Nummber of System Warning Log
  echo -e "\033[33m5. Log Warning Information\033[0m"
  echo -e "5. Log Warning Information" >> /var/tmp/$date$hostname.txt

  sys_log=`cat /var/log/messages|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 1). System Warning Log : \t\t $sys_log"
  echo -e "\t 1). System Warning Log : \t\t $sys_log" >> /var/tmp/$date$hostname.txt
  cat /var/log/messages|grep -E 'warning|err|emerg|crit|alert'|tail  >> /var/tmp/$date$hostname.txt

  #output Number of Ltm Warning Log
  ltm_log=`cat /var/log/ltm|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 2). LTM Warning Log : \t\t\t $ltm_log"
  echo -e "\t 2). LTM Warning Log    : \t\t $ltm_log" >> /var/tmp/$date$hostname.txt
  cat /var/log/ltm|grep -E 'warning|err|emerg|crit|alert'|tail  >> /var/tmp/$date$hostname.txt

  #output Number of GTM Warning Log
  gtm_log=`cat /var/log/gtm|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 3). GTM Warning Log : \t\t\t $gtm_log"
  echo -e "\t 3). GTM Warning Log    : \t\t $gtm_log" >> /var/tmp/$date$hostname.txt
  cat /var/log/gtm|grep -E 'warning|err|emerg|crit|alert'|tail  >> /var/tmp/$date$hostname.txt

  #LCD log
  lcd_log=`tmsh show sys alert|grep -E 'warning|err|emerg|crit|alert'|wc -l`
  echo -e "\t 4). LCD Warning Log    : \t\t $lcd_log \n"
  echo -e "\t 4). LCD Warning Log    : \t\t $lcd_log" >> /var/tmp/$date$hostname.txt
  tmsh show sys alert|grep -E 'warning|err|emerg|crit|alert'|tail  >> /var/tmp/$date$hostname.txt
}


function device_hardware(){

  echo -e "\033[33m6. Device Hardware Information\033[0m"
  echo -e "\n6. Device Hardware Information" >> /var/tmp/$date$hostname.txt

  #fanstatus
  echo -e "\t 1). Device Fans Status :"
  echo -e "\n\t1) Device Fan Status Information:"  >> /var/tmp/$date$hostname.txt
  fan_number=`tmsh show sys hardware field-fmt | grep "chassis-fan-status-index"|awk '{print $4}'`
  for fan_n in $fan_number
  do
    fan_sta=`tmsh show sys hardware field-fmt | sed -n '/chassis-fan-status-index $fan_n {/,/}/p' | grep "status "|awk '{print $2}'`
    if [ $fan_sta=="up" ]
    then
      echo -e "\t\tFans $fan_n Status : \t\t Success"
      echo -e "\t\tFan $fan_n : Up " >> /var/tmp/$date$hostname.txt
    else
      echo -e "\t\t\033[31mFans $fan_n Status: \t\t Failed\033[0m"
      echo -e "\t\tFan $fan_n : Failed" >> /var/tmp/$date$hostname.txt
    fi
  done

  #output Temperature status
  echo -e "\t 2). Temperature $temp_n Status :"
  echo -e "\n\t2) Device Temperature Information:"  >> /var/tmp/$date$hostname.txt
  echo -e "\t\tTemp_point\tlow\tcur\thi" >> /var/tmp/$date$hostname.txt
  temp_number=`tmsh show sys hardware field-fmt | grep "chassis-temperature-status-index"|awk '{print $4}'`
  for temp_n in $temp_number
  do
    cur_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "temperature "|awk '{print $2}'`
    lo_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "lo-limit"|awk '{print $2}'`
    high_temp=`tmsh show sys hardware field-fmt | grep -A7 "chassis-temperature-status-index $temp_n"| grep "hi-limit"|awk '{print $2}'`
  if [ $cur_temp -le $high_temp ] && [ $cur_temp -ge $lo_temp ];then
    echo -e "\t\tTemp $temp_n Status : \t\t Success"
  else
    echo -e "\t\t\033[31mTemp $temp_n Status : \t\t Failed\033[0m"
  fi
  echo -e "\t\tTemp_$temp_n    \t$lo_temp\t$cur_temp\t$high_temp" >> /var/tmp/$date$hostname.txt
  done

  #powerstatus
  echo -e "\t 3). Device Power status :"
  echo -e "\n\t3) Device Power Information :" >> /var/tmp/$date$hostname.txt
  power_number=`tmsh show sys hardware field-fmt | grep "chassis-power-supply-status-index"|awk '{print $4}'`

  for power_name in $power_number
  do
    power_status=`tmsh show sys hardware field-fmt | grep -A4 "chassis-power-supply-status-index 1"| grep "status up"|awk '{print $2}'`
    if [ $power_status == "up" ];then
      echo -e "\t\tPower $power_name status: \t\t Success"
    else
      #echo -e "\t 3). Power Supply $power_name : \t\t\t Failed"
      echo -e "\t\t\033[31mPower $power_name status: \t\t Failed\033[0m"
    fi
    echo -e "\t\tPower $power_name status : $power_status" >> /var/tmp/$date$hostname.txt
  done



  #Trunk Used Interface Status
  echo -e "\033[33m\n7. Device Interface Information\033[0m"
  echo -e "\n7. Device Interface Information :" >> /var/tmp/$date$hostname.txt

  trunk_name=`tmsh list net vlan one-line | grep "interfaces"| awk -F "interfaces { " '{print $2}'|awk -F " {" '{print $1}'|sort -u|grep -v ^"[0-9]"`
  for trunk_ in $trunk_name
  do
  trunk_interface=`tmsh list net trunk $trunk_ interfaces | awk '{print $1}'|grep ^[0-9]`
  for interface_ in $trunk_interface
    do
      isun=`tmsh show net interface $interface_ field-fmt | grep "status up"|wc -l`
      if [[ $isun == "1" ]];then
        echo -e "\t Trunk : $trunk_ Interface $interface_ Status : \t Success"
        echo -e "\t Trunk : $trunk_ Interface $interface_ Status : \t Success" >> /var/tmp/$date$hostname.txt
      else

        echo -e "\t\033[31m Trunk : $trunk_ Interface $interface_ Status : \t Failed\033[0m"
        echo -e "\t Trunk : $trunk_ Interface $interface_ Status : \t failed" >> /var/tmp/$date$hostname.txt
      fi
    done
  done

  #Vlan Used Interface Status
  interface_name=`tmsh list net vlan one-line | grep "interfaces"| awk -F "interfaces { " '{print $2}'|awk -F " {" '{print $1}'|sort -u|grep ^[0-9]
`
    for inte_name in $interface_name
    do
      interface_sta=`tmsh show net interface $inte_name field-fmt | grep "status up"|wc -l`
    if [[ $interface_sta == "1" ]];then
        echo -e "\t Interface $inte_name Status : \t\t Success"
        echo -e "\t Interface $inte_name Status : \t\t Success">> /var/tmp/$date$hostname.txt
      else
          echo -e "\t\033[31m Interface $inte_name Status : \t\t Failed\033[0m"
          echo -e "\t Interface $inte_name Status : \t\t failed">> /var/tmp/$date$hostname.txt
      fi
    done
}


function backup_config(){

  #backup config
  echo -e "\n\033[33m8. Backup configuration\033[0m"
  echo -e "\n8. Backup configuration :">> /var/tmp/$date$hostname.txt

  dir="/var/local/ucs/"

  tmsh save sys ucs $date$hostname.ucs  >/dev/null 2>&1

  backup=`find $dir -name $date$hostname.ucs`
  if [[ $backup =~ ".ucs" ]]
  then
    echo -e "\tUCS Backup :  \t\t\t\t Success"
    echo -e "\tUCS Backup :  \t\t\t\t Success">> /var/tmp/$date$hostname.txt
  else
      echo -e "\t\033[31m UCS Backup :  \t\t\t\t Failed\033[0m"
    echo -e "\tUCS Backup :  \t\t\t\t failed">> /var/tmp/$date$hostname.txt
  fi
}

# finish_execute
function finish_execute(){

  echo -e "\n------------------------------------------------------------"
  echo -e "\033[32mDevice Check Finish , Report in /var/tmp/$date$hostname.txt\n\033[0m"
  echo -e "\n------------------------------------------------------------">> /var/tmp/$date$hostname.txt
  echo -e "Device Check Finish .\n">> /var/tmp/$date$hostname.txt

}

begin_execute
base_info
cluster_info
stastistic
log_status
device_hardware
backup_config
finish_execute


3. 执行方式
🚁 命令行输入以下命令执行脚本。


bash /var/tmp/xj.sh


4. 输出结果
🚝 输出结果如下所示:

image-20220428145924276

打赏