zoukankan      html  css  js  c++  java
  • 远程批量获取Linux和Windos操作系统版本(内核)

    在不登录远程主机的情况下,可以查看远程主机的服务器操作系统版本(内核)。

    脚本执行前提:

    1.拷贝check_snmp到脚本执行的主机中或在此主机中安装nagios;

    2.保持list.txt中只有一个IP列

     1 #!/bin/bash
     2 #echo "">list_os.txt
     3 cp list.txt list_1.txt
     4 awk {'print $1'} list.txt |while read line
     5 do
     6 echo $line
     7 info=`/usr/local/nagios/libexec/check_snmp -H  $line  -C jd -o sysDescr.0`
     8 centos63=`echo $info | grep 2.6.32-279`
     9 centos62=`echo $info | grep 2.6.32-220`
    10 centos56=`echo $info | grep 2.6.18-238`
    11 if [ -n "$centos63" ];then
    12 echo "centos63"
    13 sed -i "s/^$line$/$line CentOS6.3/g" list_1.txt
    14 fi
    15 if [ -n "$centos62" ];then
    16 echo "centos62"
    17 sed -i "s/^$line$/$line CentOS6.2/g" list_1.txt
    18 fi
    19 if [ -n "$centos56" ];then
    20 echo "centos56"
    21 sed -i "s/^$line$/$line CentOS5.6/g" list_1.txt
    22 fi
    23 
    24 echo "---------"

    25 done 

     nagios脚本下载地址:http://download.csdn.net/detail/drew27/7456955

  • 相关阅读:
    “学霸系统”app——NABC
    Scrum Meeting NO.1
    团队成员角色
    团队作业 #2
    团队作业 #1
    Qt, 我回来了。。。
    boost: tcp client sample
    makefile 中定义宏位置需要注意一下
    libpcap报文解析: ipv4、ipv6 @ 2014.7.2
    编程网站收集
  • 原文地址:https://www.cnblogs.com/zhuhongbao/p/3820430.html
Copyright © 2011-2022 走看看