NAGIOS_ Custom Macro variables hide sensitive information for sending mail accounts

Source: Internet
Author: User

Demand:

Nagios uses SendEmail to send messages when the message is alerted.

The default Web management interface is under configuration---Object type:commands--

Notify-host-by-email Notify-service-by-email will display the login password of the sending email account


By: Nagios macro variable to hide the displayed password (custom macro variable)

Vi/usr/local/nagios/etc/resource.cfg

Plus

[Email protected] $USER 3$=123456a


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

Modify the $user2$ and $user3$ sections:

#  ' Notify-host-by-email '  command definitiondefine command{         command_name    notify-host-by-email#        command_line    /usr/bin/printf  "%b"   "***** nagios *****\n \nnotification type:  $NOTIFICATIONTYPE $\nhost:  $HOSTNAME $\nstate:  $HOSTSTATE $\naddress:   $HOSTADDRESS $\ninfo:  $HOSTOUTPUT $\n\ndate/time:  $LONGDATETIME $\n " | /bin/mail - s  "**  $NOTIFICATIONTYPE $ host alert:  $HOSTNAME $ is  $HOSTSTATE $ **"   $CONTACTEMAIL $        command_line    /usr/ bin/printf  "%b"   "***** nagios *****\n\nnotification type:  $NOTIFICATIONTYPE $\ nhost:  $HOSTNAME $\nstate:  $HOSTSTATE $\naddress:  $HOSTADDRESS $\ninfo:  $HOSTOUTPUT $\n\ndate/ time:  $LONGDATETIME $\n " | /usr/bin/sendEmail -f [email protected] -t  "[email protected],[ email protected],[email protected],[email protected],[email protected],[email  Protected],[email protected],[email protected] " -s smtp.163.com -u " ** $ notificationtype$ host alert:  $HOSTNAME $ is  $HOSTSTATE $ ** " -xu  $USER 2 $ -xp  $USER 3$        }

# ' notify-service-by-email ' command definition

define command{        command_name     notify-service-by-email        command_line    / usr/bin/printf  "%b"   "***** nagios *****\n\nnotification type:  $NOTIFICATIONTYPE $ \n\nservice:  $SERVICEDESC $\nhost:  $HOSTALIAS $\naddress:  $HOSTADDRESS $\nstate: $ servicestate$\n\ndate/time:  $LONGDATETIME $\n\nadditional info:\n\n$serviceoutput$ " | /usr/ bin/sendemail -f [email protected] -t  "[email protected],[email protected], [email protected],[email protected],[email protected],[email protected],[email  Protected],[email protected] " -s smtp.163.com -u  " **  $NOTIFICATIONTYPE $  Service Alert:  $HOSTALIAS $/$SERVICEDESC $ is  $SERVICESTATE $ ** " -xu $ user2$ -xp  $USER 3$#       command_line    /usr/bin/printf  "%b"   "* * * * * *  Nagios *****\n\nNotification Type:  $NOTIFICATIONTYPE $\n\nservice:  $SERVICEDESC $\ nhost:  $HOSTALIAS $\naddress:  $HOSTADDRESS $\nstate:  $SERVICESTATE $\n\ndate/time: $ longdatetime$\n\nadditional info:\n\n$serviceoutput$ " | /bin/mail -s " ** $ notificationtype$ service alert:  $HOSTALIAS $/$SERVICEDESC $is  $SERVICESTATE $ ** "  $CONTACTEMAI

l$

}


The effect is as follows: The red Arrow Black section shows the account number and password of the sending email account, which can now be used to hide sensitive information through Nagios's custom macro variables.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/75/B2/wKiom1ZAcIjAykwyAAI5uYmMuRI911.png "title=" QQ picture 20151109180748.png "alt=" Wkiom1zacijaykwyaai5uymmuri911.png "/>

This article from "Rusty Old Gun _ Technology blog" blog, reproduced please contact the author!

NAGIOS_ Custom Macro variables hide sensitive information for sending mail accounts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.