nagios部署配置流程

來源:互聯網
上載者:User

標籤:output   put   安裝   /usr   ica   oca   services   添加   流程   

nagios部署配置流程

nagios服務端:
1、部署nagios服務端(參考nagios官方部署文檔)、nagios-plugin、php、apache2

2、需要在服務端添/etc/hosts中添加解析

3、設定檔說明
nagios.cfg中配置需要監控的主機目錄dir_cfg=path/to/somewhere 該路徑下的檔案均以主機名稱命名,以.cfg結尾

commands.cfg
配置接受nrpe傳過來的command需要在 commands.cfg 配置,模板如下:

# ‘check_nrpe‘ command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

#配置郵箱警示、警示
define command {
command_name sendEmail
command_line $USER1$/sendEmail/sendEmail.pl -f "[email protected]" -t $CONTACTEMAIL$ -s smtp.mxhichina.com:80 -u "** $HOSTNAME$—— $HOSTNAME$ $HOSTSTATE$ **" -xu [email protected] -xp ‘[email protected]‘ -m "***** New_NAGIOS Notification *****\n\nNotification type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHOSTNAME: $HOSTALIAS$\nIP$HOSTNAME$\nSTATUS: $SERVICESTATE$\n\nTime: $LONGDATETIME$\n\nSERVICEOUTPUT:\n\n$SERVICEOUTPUT$"}

define command {
command_name wei_baojing
command_line $USER1$/wei_baojing.py "通知類型: $NOTIFICATIONTYPE$<br><br>服務: $SERVICEDESC$<br>主機: $HOSTALIAS$<br>IP地址: $HOSTNAME$<br>狀態: $SERVICESTATE$<br><br>日期時間: $LONGDATEME$<br><br>附加資訊:<br><br>$SERVICEOUTPUT$"
}

templates.cfg 需要配置監控的模板
define service {
service_description generic-zzcbj
name generic-zzcbj
contacts zzcbj
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 3
retry_interval 1
notification_interval 5
notification_options w,u,c,r,f
first_notification_delay 0
register 0
active_checks_enabled 1
passive_checks_enabled 1
notifications_enabled 1
}

 

localhost.cfg 監控本機配置


contacts.cfg
#配置 郵件警示

define contact {
contact_name zzcbj
alias zzcbj
email [email protected],[email protected]
pager admin
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
register 1
host_notification_commands sendEmail,wei_baojing
service_notification_commands sendEmail,wei_baojing
#host_notification_commands weixin_ywts
#service_notification_commands weixin_ywts
}

設定檔配置完成後可以檢查設定檔是否有問題
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

/etc/init.d/nagios configtest

用戶端: nrpe nagios-plugins 安裝
監控指令碼放在/usr/local/nagios/libexec/
/usr/local/nagios/etc/nrpe.cfg 配置nagios服務端地址
/usr/local/nagios/etc/nrpe.cfg 檔案中配置需要監控的指令碼路徑 指令碼來源於/usr/local/nagios/libexec/

nagios部署配置流程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.