zoukankan      html  css  js  c++  java
  • 使用ipmitool 命令添加IPMI 界面的SMTP邮件服务器地址

    目前要通过ipmitool工具在IPMI的界面上添加邮件服务器地址,该脚本如下

    SMTP.sh

    #!/bin/bash
    ipmitool raw 0x32 0x78 0x01 0x01 0x00 0x00 0x14 0x00 0x02 0x10
    ipmitool raw 0x32 0x78 0x01 0x00 0x00 0x00 0x01
    ipmitool raw 0x32 0x78 0x01 0x02 0x00 0x00 
    ipmitool raw 0x32 0x78 0x1  0x8  0x0  0x0  0x67  0x69  0x6f  0x30  0x31  0x37  0x40  0x62  0x6d  0x63  0x2e  0x63 0x6f 0x6d
    # g i o 0 1 7 @ b m c . c o m
    ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x02 ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x03 ipmitool raw 0x32 0x78 0x01 0x09 0x00 0x00 0x67 0x69 0x6f 0x30 0x31 0x37
    # g i o 0 1 7
    ipmitool raw 0x32 0x78 0x01 0x09 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x09 0x00 0x02 ipmitool raw 0x32 0x78 0x01 0x09 0x00 0x03 ipmitool raw 0x32 0x78 0x01 0x0b 0x00 0x00 0x00 ipmitool raw 0x32 0x78 0x01 0x0a 0x00 0x00 0x19 0x00 ipmitool raw 0x32 0x78 0x01 0x0e 0x00 0x00 0x00 0x00 0x00 0x00 ipmitool raw 0x32 0x78 0x01 0x0f 0x00 0x00 0x00 ipmitool raw 0x32 0x78 0x1 0x11 0x0 0x0 0x67 0x69 0x6f 0x30 0x31 0x37 0x40 0x62 0x6d 0x63 0x2e 0x63 0x6f 0x6d ipmitool raw 0x32 0x78 0x01 0x11 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x11 0x00 0x02 ipmitool raw 0x32 0x78 0x01 0x11 0x00 0x03 ipmitool raw 0x32 0x78 0x01 0x12 0x00 0x00 0x67 0x69 0x6f 0x30 0x31 0x37 ipmitool raw 0x32 0x78 0x01 0x12 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x12 0x00 0x02 ipmitool raw 0x32 0x78 0x01 0x12 0x00 0x03 ipmitool raw 0x32 0x78 0x01 0x14 0x00 0x00 0x00 ipmitool raw 0x32 0x78 0x01 0x13 0x00 0x00 0x19 0x00

    现在要自动获取每个io节点hostname,并将节点hostname自动转换为十六进制数替换上面脚本的红色部分。

    SMTP1.1.sh

    #!/bin/bash
    hostname=`hostname`
    #echo $hostname
    
    if [ $# -ne 3 ];then
       echo "Usage: number1 number2 number3"
       exit 1
    fi
    
    #a= echo $hostname | cut -c 4
    x=`printf "0x%.2x" "'$1'"`  #将字符ASCII自动转换为16进制数  0x30
    echo $x #b= echo $hostname | cut -c 5 y=`printf "0x%.2x" "'$2'"` echo $y #c= echo $hostname | cut -c 6 z=`printf "0x%.2x" "'$3'"` echo $z ipmitool raw 0x32 0x78 0x01 0x01 0x00 0x00 0x14 0x00 0x02 0x10 ipmitool raw 0x32 0x78 0x01 0x00 0x00 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x02 0x00 0x00 ipmitool raw 0x32 0x78 0x1 0x8 0x0 0x0 0x62 0x69 0x6f $x $y $z 0x40 0x62 0x6d 0x63 0x2e 0x63 0x6f 0x6d ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x01 ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x02 ipmitool raw 0x32 0x78 0x01 0x08 0x00 0x03 ipmitool raw 0x32 0x78 0x01 0x09 0x00 0x00 0x62 0x69 0x6f $x $y $z

    SMTP1.2.sh

    #!/bin/bash
    host=`hostname`
    
    a=`echo $host | cut -c 4`
    b=`echo $host | cut -c 5`
    c=`echo $host | cut -c 6`
    #echo a:$a
    #echo b:$b
    #echo c:$c
    
    
    
    sh SMTP-test.sh $a $b $c
    ~                         

    自动获取节点hostname,并将节点hostname自动转换为16进制数,替换执行。执行成功后IP MI的界面会自动添加本地目的邮件的地址。

  • 相关阅读:
    使用log4cplus时遇到的链接错误:无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,
    linux中free命令内存分析
    ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
    error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2
    创建预编译头 Debug 正常 Release Link Error:预编译头已存在,使用第一个 PCH
    C++定义字符数组
    客户端数据持久化解决方案: localStorage
    转:JavaScript函数式编程(三)
    转: JavaScript函数式编程(二)
    转:JavaScript函数式编程(一)
  • 原文地址:https://www.cnblogs.com/wangtao1993/p/6385114.html
Copyright © 2011-2022 走看看