Electricity Bill Calculator

Electricity Bill Calculator

Electricity Bill Cost Calculator. Electricity Usage Consumption Calculator.

Select Country:  
Typical Appliance:
Power Consumption:
Hours Of Use Per Day: Hrs/Day
One Unit Cost (1 kWh ):
 
Electricity Cost Per Day:  
Electricity Cost Per Month:  
Electricity Cost Per Year:  

Note:- 1 Unit = 1 kwh (Kilo Watt Hour)

HTML tutorial

Social Message

Social Message
Social Message Useful Health Tips

Saturday, January 14, 2017

Setup External SMTP Server to Send Nagios Notifcation Alerts on CentOS/Linux

Setup External SMTP Server to Send Nagios Notifcation Alerts on Linux


Setup up Nagios to use an external SMTP server.


1. Download the SendEmail setup tar file from below link.

Click Here to Download

[or ]   Directly use wget command on Linux command prompt.

root#wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

2. Extract, and copy sendEmail to /usr/local/bin

root#tar -xvzf sendEmail-v1.56.tar.gz
root#cp sendEmail-v1.56/sendEmail /usr/local/bin

3. SendEmail requires the Net::SSLeay and IO::Socket::SSL perl modules be installed to function, so install these if they're not already:

root#yum install perl-Net-SSLeay
root#yum install perl-IO-Socket-SSL

For Testing run below command on Linux command prompt. You will get Test Mail. If receiving Test mail. Your external mail server installed successfully.

root#/usr/local/bin/sendEmail -f mohan@mohansundaram.com -t mohan@mohansundaram.com -u TestMail -m TestMail -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes

mohan@mohansundaram.com -> From Address
smtp.mail.com -> SMTP Outgoing Server 
587 -> SMTP Server port with TLS
alert@mohansundaram.com -> Mail Server Username
help@123 -> Password


4. Now modify the notify-host-by-email and notify-service-by-email commands in Nagios' commands.cfg file as follows:

root#/usr/local/nagios/etc/objects/commands.cfg

define 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" | /usr/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -t $CONTACTEMAIL$
}

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/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -t $CONTACTEMAIL$
}


5.Update below entry on contacts.cfg file.

root#vi /usr/local/nagios/etc/objects/contacts.cfg

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           ITHELPDESK@mohansundaram.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS *****

service_notification_period             24x7
host_notification_period        24x7
        service_notification_options            w,u,c,r,f,s
        service_notification_commands           notify-service-by-email
        host_notification_period                24x7
        host_notification_options               d,u,r,f,s
        host_notification_commands              notify-host-by-email
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }


6. Restart your Nagios service.

root# /etc/init.d/nagios restart
Your done. Nagios will now send alert notifcations via your external SMTP server.


No comments:

Post a Comment