<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    jojo's blog--快樂憂傷都與你同在
    為夢想而來,為自由而生。 性情若水,風起水興,風息水止,故時而激蕩,時又清平……
    posts - 11,  comments - 30,  trackbacks - 0
    nagios中文:http://nagios-cn.sourceforge.net/
    nagiso官方網站:http://www.nagios.org/

    Ununtu下Nagios信息發送方式:
    1.mail
    如果要接收Nagios的EMail警報,需要安裝(Postfix)包

    sudo apt-get install mailx

    需要編輯Nagios里的EMail通知送出命令,它位于/usr/local/nagios/etc/commands.cfg文件中,將里面的'/bin/mail'全部替換為'/usr/bin/mail'。一旦設置好需要重啟動Nagios以使配置生效。

    sudo /etc/init.d/nagios restart

    2.MSN
      用php來發送MSN信息。
      wget http://downloads.fanatic.net.nz/dev/php/sendMsg.zip
      unzip sendMsg.zip
      mv sendMsg /path/to/web/dir/msn
      可以先打開 http://server/msn/index.php 測試一下能否發送。如果沒有問題,可以寫一個腳本來執行 MSN 信息發送命令:
      /usr/local/nagios/libexec/msn_send.sh:
      #!/bin/sh
      wget -O - -q --post-data="sender=nagios@live.cn&password=password& 
      recipient=$1&message=$2" http://server/msn/index.php > /dev/null

      chmod +x /usr/local/nagios/libexec/msn_send.sh

    /usr/local/nagios/etc/objects/commands.cfg:

    define command{
            command_name    notify-host-by-msn
            command_line    /usr/local/nagios/libexec/msn_send.sh $CONTACTEMAIL$ "`/usr/bin/printf "%b" "***** Monitor *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"`"
            }

    define command{
            command_name    notify-service-by-msn
            command_line    /usr/local/nagios/libexec/msn_send.sh $CONTACTEMAIL$ "`/usr/bin/printf "%b" "***** Monitor *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"`"
            }

    /usr/local/nagios/etcobjects/contacts.cfg :

    define contact{
            contact_name                    nagios
            alias                           Nagios Msn
            use                             generic-contact
            service_notification_period     24x7
            host_notification_period        24x7
            service_notification_options    w,u,c,r
            host_notification_options       d,u,r
            service_notification_commands   notify-service-by-msn
            host_notification_commands      notify-host-by-msn
    }

    參考于:http://blog.bluedata.org/nagios-notification-type/
    3.飛信通知

    飛信官方網站:http://www.it-adv.net/
      下載:fetion20080910048-linux.tar.gz 和 library32.rar(版本不斷更新)
      tar xvfz fetion_linux_20080402.tar.gz
      cd install
      sudo cp fetion /usr/bin
      fetion -h
    如果出現如下錯誤:
      error while loading shared libraries: libACE.so.5.4.7: cannot open shared object file: No such file or directory
      說明缺少運行的庫文件。
    解決方法:
       a.sudo apt-get install libACE.so.5.4.7 libACE_SSL.so.5.4.7
         (可能你的ubuntu已經不提供安裝這兩個庫文件,采用下面的方案)
       b.unrar e library32.rar
         cd library32
         sudo cp *.* /lib/
         sudo cp *.* /usr/lib/
      重新執行 fetion -h.應該能看到所要的結果。
      如果你有飛信號,可以執行一下。
      fetion  -u 飛信號 -p pwd 來登錄。
    /usr/local/nagios/etc/objects/commands.cfg:
    # 'notify-service-by-fetion' command definition                                                                            
    define command{
            command_name notify-service-by-fetion
            command_line /usr/bin/feiton -u 13888888888  -p 123456   -t $CONTACTPAGER$ -m "$HOSTNAME$ $SERVICEDESC$ is $SERVICESTATE$ on $TIME$ result is $SERVICEOUTPUT$" $CONTACTPAGER$
            }
    /usr/local/nagios/etcobjects/contacts.cfg :
    define contact{
    contact_name                    fetion
    alias                           nagios admin
    host_notification_period        24x7
    service_notification_period     24x7
    host_notification_options       d,r,
    service_notification_options    c,w,r
    service_notification_commands   notify-service-by-email,notify-service-by-fetion
    #       service_notification_commands   notify-service-by-email                                                            
    host_notification_commands      notify-host-by-email
    pager                           158010775111
    }


    最后將定義的contact添加到contactgroup中:
    define contactgroup{
            contactgroup_name       admins
            alias                   Nagios Administrators
            members                 nagiosadmin,nagios,fetion
    }
    當你定義一個主機的時候:
    /usr/local/nagios/etc/objects/templates:
    # Linux host definition template - This is NOT a real host, just a template!                                               

    define host{
            name                            linux-server    ; The name of this host template
            use                             generic-host    ; This template inherits other values from the generic-host template
    check_period                    24x7            ; By default, Linux hosts are checked round the clock
    check_interval                  5               ; Actively check the host every 5 minutes
    retry_interval                  1               ; Schedule host check retries at 1 minute intervals
            max_check_attempts              10              ; Check each Linux host 10 times (max)
            check_command                   check-host-alive ; Default command to check Linux hosts
            notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day
                                                            ; Note that the notification_period variable is being overridden from
                                                            ; the value that is inherited from the generic-host template!
    notification_interval           120             ; Resend notifications every 2 hours
            notification_options            d,u,r           ; Only send notifications for specific host states
    contact_groups                  admins          ;使用的聯系組為admins
            register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
            }

      此處參考:http://yang2001.blog.51cto.com/25307/73164
    posted on 2009-05-28 22:01 Blog of JoJo 閱讀(375) 評論(0)  編輯  收藏 所屬分類: 每日一記

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(6)

    隨筆檔案

    文章分類

    文章檔案

    新聞分類

    新聞檔案

    相冊

    收藏夾

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 69视频在线观看免费| 中国一级毛片视频免费看| 免费看污成人午夜网站| 亚洲天堂一区二区| 精品一区二区三区免费| 伊人久久综在合线亚洲2019| 日本黄色动图免费在线观看| 亚洲视频在线观看网站| 免费成人福利视频| 亚洲婷婷第一狠人综合精品| 成人免费a级毛片| 看一级毛片免费观看视频| 又爽又黄无遮挡高清免费视频| 视频免费1区二区三区| 自拍偷自拍亚洲精品情侣| 国产一级一毛免费黄片| 亚洲性天天干天天摸| 2019中文字幕在线电影免费| 色噜噜亚洲男人的天堂| 国产精品色午夜免费视频| 免费一级毛片在线播放视频免费观看永久 | 成人毛片18岁女人毛片免费看| 亚洲av日韩专区在线观看| 亚洲国产精品尤物YW在线观看| 精品国产污污免费网站| 亚洲不卡视频在线观看| 又大又黄又粗又爽的免费视频| 成人性做爰aaa片免费看| 久久精品国产亚洲AV高清热| 在线观看无码的免费网站| 一区二区三区免费视频网站 | 日本最新免费网站| 国产精品亚洲一区二区在线观看| 亚洲欧洲国产成人综合在线观看 | 在线观看亚洲免费| 亚洲gv猛男gv无码男同短文| 99热在线精品免费全部my| 中美日韩在线网免费毛片视频| 久久亚洲AV成人无码软件| 亚洲AⅤ视频一区二区三区| 最新国产AV无码专区亚洲|