nagios微信報警配置


==nagios微信報警系統添加流程==
1.編寫微信報警腳本
2.編輯/usr/local/nagios/etc/objects/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
}
3.編輯/usr/local/nagios/etc/objects/contacts.cfg
添加報警選項:
define contact {
contact_name    zzcbj
alias    zzcbj
email   mail@example.com
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
}
4.編輯/usr/local/nagios/etc/objects/commands.cfg
添加報警命令:
define command {
command_name    sendEmail
command_line    $USER1$/sendEmail/sendEmail.pl -f "security@intellicredit.cn" -t $CONTACTEMAIL$ -s smtp.mxhichina.com:80 -u "** $HOSTNAME$—— $HOSTNAME$
$HOSTSTATE$ **" -xu security@intellicredit.cn -xp 'Z2h0o1g6n0z4h2i9cheng@' -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$"}

備注:command_line只有一行

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>日期時間: $LONGDATETIME$ <br><br>附加信息:<br><br>$SERVICEOUTPUT$"}

備注:command_line只有一行


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM