Sending VMware vCenter Alerts to Telegram/Discord – Part 1

vCenter alerts sent to Discord

vCenter has built-in alarms for various occasions and you can use emails to send alarms. This part has been quite useful for monitoring purposes. But what if you would like to send the alerts to instant messaging services like Telegram or Discord instead? vCenter does not have built-in support for this, so we need to find a workaround to achieve this.

To send messages/alerts/notifications to either Telegram or Discord could be done simply using the curl command following their respective api examples. Now the next question is how could we make it work through emails? Most mail servers have the option to forward email to a script and luckily vCenter has Sendmail running on top of it. As such we can make use of email aliases and forward email sent by vCenter to a script. Details are shown below.

In the screenshots below, 172.16.18.201 is the ip address of the vCenter Server Appliance.

n vCenter, select Configure -> General -> Mail to check the Mail setting and edit this part if needed.

Edit Mail settings to fit your needs.

You can go to Configure -> More -> Alarm Definitions to see existing Alarm Definitions.

Existing Alarm Definitions.

This shows the Alarm Definition for Virtual machine memory usage.

Alarm Rule 1. It’s basically in the format of “If… then…” As we want to send email alerts, make sire you have enabled Send email notifications or we cannot forward email to a script to achieve our goal.

The lower half of Alarm Rule 1. Make sure this part is configured correctly.

Don’t forget to save the Alarm Definition if you have made any changes.

Continued on Part 2

Loading

Leave a Comment

Your email address will not be published. Required fields are marked *