Skip to main content

VMware SMTP configuration - Deep dive


Notification mails are not just a part of an IT administrator’s life, it is the lightening before a thunder. If they miss these notification emails, anything could burst out in the environment! So settings SMTP for the vCenter is highly recommended, most importantly it should work :) 

For the past two weeks I had a chance to learn a lot about sendmail functionality in VCSA, so I’d like to share this with you. 


What is sendmail ?
Sendmail is a unix/linux OS based SMTP. It is a mail transfer agent (MTA) which is used to deliver or route email. VMware uses sendmail to notify the alarms as notification emails.

How to setup SMTP?
SMTP is a straight forward configuration, go to "configure" on the vCenter configuration tab, under “settings” look for "mail" and then provide the mail server name along with the mail address where it has to be sent.

What happens if it does not work?
Now once the SMTP configured, you perform a test alarm and if the mail is triggered, its well and good. you and the customer can go home happily. Will this happen all the time? mm not really.  We need to check two layers to see if the SMTP is working correctly.

1. To see if the mail is queued on the vCenter, running the #mailq command on the vCenter Server Appliance displays pending emails.

2. To see if sendmail is actually working or not. Please find the approach which i tried to find the root cause.

a. check the log file -> /var/log/messages, here look for the key work - "mailer" we can find the error messages.
   also check the log file /var/log/vmware/vmware-vpx/vpxd.log -> keyword "SMTP" these two log files are more than enough to understand the issue.

b. you can run the below echo command to test if sendemail feature actually works.
 # echo “Subject: sendmail test” | sendmail -v test.com    ( if this fails, you get an output of the mail transaction right away.)

c. It is worth checking the DNS and resolve the mail server from the vCenter, this was the issue in my case. we are unable to resolve the mailserver although the mailserver is able to telnet and ping from the vCenter, so it was an issue on the customers mail server end.

d. If all the above steps failed, then move on to modify the sendmail.cf and sendmail.mc - configuration files. you can follow the KB - https://kb.vmware.com/s/article/54375

Please be aware that the configuration file of Sendmail is sendmail.cf. This file is a product of the macro configuration file, sendmail.mc and you have to make configuration changes on the macro file and restart the services and daemon.

#systemctl daemon-reload
#systemctl restart sendmail  

Known issues -> Email alerts not working after upgrading to vCenter 6.5 U1 -> https://kb.vmware.com/s/article/49725  
                         -> Emails sent from VMware vCenter Server Appliance are rejected ->  https://kb.vmware.com/s/article/2073849

Comments

Popular posts from this blog

Error [403] The maximum number of sessions has been exceeded in the H5 client during login or logout

  Symptoms In virgo log, you see messages similar to: [2020-05-19T07:25:45.285Z] [ERROR] http-nio-5090-exec-130 72026859 142953 501051 com.vmware.vise.security.spring.DefaultAuthenticationProvider logout failed for sessionId 142953, clientId 501051 java.lang.IllegalStateException: The specified cardinality of 1..1 for osgi:reference implementing com.vmware.vcenter.apigw.api.ApiGatewaySessionManager in bundle com.vmware.h5ngc requires that exactly one OSGI service satisfies the filtering criteria but no such service was found.         at com.vmware.o6jia.context.ExternalServiceTargetSource.getTarget(ExternalServiceTargetSource.java:99)         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)         at com.sun.proxy.$Proxy159.logout(Unknown Source)   ...

Investigating virtual machine file locks on ESXi

      Details Adding an existing virtual machine disk (VMDK) to a virtual machine that is already powered on fails.                 Failed to add disk scsi0:1. Failed to power on scsi0:1   Powering on the virtual machine results in the power on task remaining at 95% indefinitely. Cannot power on the virtual machine after deploying it from a template. Powering on a virtual machine fails with an error: Unable to open Swap File Unable to access a file since it is locked Unable to access a file <filename> since it is locked Unable to access Virtual machine configuration In the /var/log/vmkernel log file, you see entries similar to: WARNING: World: VM xxxx: xxx: Failed to open swap file <path>: Lock was not free WARNING: World: VM xxxx: xxx: Failed to initialize swap file <path>   When opening a console to the virtual machine, you may receive ...

"Performance data is currently not available for this entity" viewing the performance tab

  Symptoms While accessing the performance tab and navigating to Overview, you see: No data available   The data for Real time, but fails to retrieve it for past 1 day, week, month or year.  While selecting the advance parameter in performance tab, you see: Performance data is currently not available for this entity Cause This issue is caused by the vCenter Server database (Postgress) containing a stale/future time stamp reference for the ESXi host when the data was collected. For vCenter Servers using SQL, see  "Performance data is currently not available for this entity" error after updating rollup in vSphere Resolution Backup the vCenter...