os_network(){
##网络信息
##主机的ip地址
##yum -y install net-tools

ip_addr=$(ifconfig ens33|awk ‘/broadcast/{print $2}’)

echo “服务器的ip地址为:${ip_addr}”

##判断主机是否可以联通外网
ping -c1 www.qq.com
if [ $? -eq 0 ];then
echo “服务器网络是ok”
else
echo “服务器网络 不ok”

fi

##统计网卡ens33的流量
##流入流量
RX=$(ifconfig ens33|grep RX|sed -n ‘1p’|awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 12: 5/1024/1024}̲') echo "网卡流入流量{RX}MB"
##流出流量

TX=$(ifconfig ens33|grep TX|head -n1|awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 12: 5/1024/1024}̲') echo "网卡流chu…{TX}MB"
}
网络信息脚本

相关文章:

  • 2022-03-05
  • 2021-08-19
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-04-23
  • 2021-08-31
猜你喜欢
  • 2021-07-15
  • 2021-10-13
  • 2021-10-21
  • 2021-12-03
  • 2022-12-23
  • 2021-08-08
相关资源
相似解决方案