#!/bin/bash if [[ -f /usr/bin/lsb_release ]]; then OS=$(/usr/bin/lsb_release -a |grep Description |awk -F : '{print $2}' |sed 's/^[ \t]*//g') else OS=$(cat /etc/issue |sed -n '1p') fi OS_version=$(uname -m) kernel_version=$(uname -r) CPU=$(grep 'model name' /proc/cpuinfo |uniq |awk -F : '{print $2}' |sed 's/^[ \t]*//g' |sed 's/ \+/ /g') Counts=$(grep 'physical id' /proc/cpuinfo |sort |uniq |wc -l) Cores=$(grep 'cpu cores' /proc/cpuinfo |uniq |awk -F : '{print $2}' |sed 's/^[ \t]*//g') PROCESSOR=$(grep 'processor' /proc/cpuinfo |sort |uniq |wc -l) Mode=$(getconf LONG_BIT) Numbers=$(grep 'lm' /proc/cpuinfo |wc -l) if (( ${Numbers} > 0)); then lm=64 else lm=32 fi Total=$(cat /proc/meminfo |grep 'MemTotal' |awk -F : '{print $2}' |sed 's/^[ \t]*//g') Number=$(dmidecode | grep -A16 "Memory Device$" |grep Size|sort |sed 's/^[ \t]*//g') SwapTotal=$(cat /proc/meminfo |grep 'SwapTotal' |awk -F : '{print $2}' |sed 's/^[ \t]*//g') Buffers=$(cat /proc/meminfo |grep 'Buffers' |awk -F : '{print $2}' |sed 's/^[ \t]*//g') Cached=$(cat /proc/meminfo |grep '\<Cached\>' |awk -F : '{print $2}' |sed 's/^[ \t]*//g') Available=$(free -m |grep - |awk -F : '{print $2}' |awk '{print $2}') Max_Capacity=$(dmidecode -t memory -q |grep 'Maximum Capacity' |awk -F : '{print $2}' |sed 's/^[ \t]*//g') Disk=$(fdisk -l |grep 'Disk' |awk -F , '{print $1}') Partion=$(df -hlP |sed -n '2,$p') Line='===========' echo -e "${Line}\nOS:\n${OS}\n${Line}" echo -e "OS_version:\n${OS_version}\n${Line}" echo -e "Kernel_version:\n${kernel_version}\n${Line}" echo -e "CPU model:\n${CPU}\n${Line}" echo -e "Total of physical CPU:\n${Counts}\n${Line}" echo -e "Number of CPU cores\n${Cores}\n${Line}" echo -e "Number of logical CPUs:\n${PROCESSOR}\n${Line}" echo -e "Present Mode Of CPU:\n${Mode}\n${Line}" echo -e "Support Mode Of CPU:\n${lm}\n${Line}" echo -e "Total Memory:\n${Total}\n${Line}" echo -e "Total Swap:\n${SwapTotal}\n${Line}" echo -e "Buffers:\n${Buffers}\n${Line}" echo -e "Cached:\n${Cached}\n${Line}" echo -e "Available Memory:\n${Available} MB\n${Line}" echo -e "Maxinum Memory Capacity:\n${Max_Capacity}\n${Line}" echo -e "Number of Physical Memory:\n${Number}\n${Line}" echo -e "Amount Of Disks:\n${Disk}\n${Line}" echo -e "Usage Of partions:\n${Partion}\n${Line}"
快速查看服务器的系统信息脚本
原创juanmaoking 博主文章分类:shell脚本 ©著作权
©著作权归作者所有:来自51CTO博客作者juanmaoking的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:腾讯开放平台告警短信设置
下一篇:监控网卡的实时流量信息
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
shell脚本批量自动查询服务器系统硬件信息
使用shell脚本批量自动查询服务器系统硬件信息并写入数据库
shell linux 自动化 -
抓取服务器硬件信息脚本
说明:本例hard.py文件是抓取本地配置的脚本。
硬件 服务器 脚本 -
获取服务器硬件信息脚本
获取服务器硬件信息脚本
获取 服务器 硬件信息