Notifications

Star (0)

Notification Types

Monika will send notifications to you whenever alerts are triggered, e.g., when the response status of a probed URL is not 2xx success code (status-not-2xx).

At this moment, Monika support these channel of notifications (You can use just one or more):

  1. SMTP
  2. Mailgun
  3. SendGrid
  4. Webhook
  5. Slack
  6. Telegram
  7. WhatsApp Business
  8. Microsoft Teams
  9. Discord
  10. Monika Whatsapp Notifier
  11. Facebook Workplace
  12. Desktop Notifications
  13. Lark Suite

Configurations

To use one or more notifications, you need to define the settings in the monika.yml file as shown below.

notifications: [
- id: unique-id-mailgun
type: mailgun
data:
recipients: [RECIPIENT_EMAIL_ADDRESS]
apiKey: YOUR_API_KEY
domain: YOUR_DOMAIN
- id: unique-id-sendgrid
type: sendgrid
data:
sender: YOUR_VERIFIED_EMAIL_BY_SENDGRID
recipients: [RECIPIENT_EMAIL_ADDRESS]
apiKey: YOUR_API_KEY
- id: unique-id-smtp
type: smtp
data:
recipients: [RECIPIENT_EMAIL_ADDRESS]
hostname: SMTP_HOSTNAME
port: 587
username: SMTP_USERNAME
password: SMTP_PASSWORD
- id: unique-id-webhook
type: webhook
data:
method: POST
url: https://WEBHOOK_URL
]

Note that every triggered alert will be sent to you through all the notifications you defined in the configuration file, e.g., if you added webhook and smtp settings, you will receive the alert messages through both.

SMTP

SMTP (Simple Mail Transfer Protocol) is a way to send email using the TCP/IP protocol. This is the easiest way to get notified when alerts are triggered. Use the following configuration to set up SMTP notification.

- id: unique-id-smtp
type: smtp
data:
recipients: [RECIPIENT_EMAIL_ADDRESS]
hostname: smtp.mail.com
port: 587
username: SMTP_USERNAME
password: SMTP_PASSWORD
KeyDescriptionExample
IDNotification identity numberSmtp12345
TypeNotification typessmtp
RecipientsAn array of email addresses that will receive the e-mail from Monika["monika@testmail.com", "symon@testmail.com"]
HostnameThe smtp host that you will be using for sending the emailsmtp.gmail.com
PortThe port allowed to be used for sending mail in your host587
UsernameRegistered username on your smtp serveryourusername@gmail.com
PasswordThe password set for your usernamethepasswordforyourusername

Example using Gmail SMTP

To use Gmail SMTP with Monika,

  1. You need to have a Gmail account.
  2. Use smtp.gmail.com for hostname.
  3. Use 587 for port.
  4. Use your Gmail address for username.
  5. Use your Gmail password for password.
    1. If you have activated 2-Factor-Authentication (2FA), you need to create an App Password from your Account Settings. Then use the app password for password.

Mailgun

Mailgun is an email notification delivery provided by Mailgun email service. To use mailgun for your notification,

  1. You would need a mailgun account.
  2. Get your API key by referring to this documentation.
  3. For your domain
    • • If you are on the free plan, add authorized recipients as instructed here.
    • • If you want to use your own domain, refer here to add it.
  4. After that, put them in monika.yml configuration as follows:
- id: unique-id-mailgun
type: mailgun
data:
recipients: [RECIPIENT_EMAIL_ADDRESS]
apiKey: YOUR_API_KEY
domain: YOUR_DOMAIN
KeyDescriptionExample
IDNotification identity numberMailgun12345
TypeNotification typesmailgun
RecipientsAn array of email addresses that will receive the e-mail from Monika["monika@testmail.com", "symon@testmail.com"]
Api KeyMailgun account api key, mailgun registered key to identify your accountMAILGUN_API_KEY
DomainThe domain to set in Mailgunsandboxmail.mailgun.com

Sendgrid

Similar to mailgun, sendgrid is also an email delivery service. Make sure you have a sendgrid account. To obtain your API key, refer to sendgrid documentation. Then put the API key in Monika's configuration as follows:

- id: unique-id-sendgrid
type: sendgrid
data:
sender: YOUR_VERIFIED_EMAIL_BY_SENDGRID
recipients: [RECIPIENT_EMAIL_ADDRESS]
apiKey: YOUR_API_KEY
KeyDescriptionExample
IDNotification identity numberSendgrid12345
TypeNotification typessendgrid
senderAn string of email addresses that has been verified in your sendgrid accountyour@email.com
RecipientsAn array of email addresses that will receive the e-mail from Monika["monika@testmail.com", "symon@testmail.com"]
Api KeySendgrid account api key, sendgrid registered key to identify your account70e34aba-0ea908325

Webhook

Monika supports Webhook. To enable notification via Webhook.

- id: unique-id-webhook
type: webhook
data:
url: https://YOUR_WEBHOOK_URL
KeyDescriptionExample
IDNotification identity numberWebhook12345
TypeNotification typeswebhook
UrlThe URL of the server that will receive the webhook notificationhttps://yourwebsite.com/webhook

Using the webhook type configuration, Monika will send a request with the following body:

body: {
url: string
time: string
alert: string
}

Slack Incoming Webhook

Monika supports Slack Incoming Webhook. To enable notification via Slack, you must have a Slack's Incoming Webhook URL. Please consult to Sending messages using Incoming Webhooks documentation.

id: unique-id-slack
type: slack
data:
url: https://YOUR_SLACK_INCOMING_WEBHOOK_URL
KeyDescriptionExample
IDNotification identity numberSlack12345
TypeNotification typesslack
UrlThe URL of your slack incoming webhookhttps://slackwebhook.com/channel

Telegram

Monika supports Telegram. To enable notification via Telegram, you must have a Telegram bot. Please consult to Bots: An introduction for developers.

- id: unique-id-telegram
type: telegram
data:
group_id: YOUR_GROUP_ID
bot_token: YOUR_BOT_TOKEN
KeyDescriptionExample
IDNotification identity numberTelegram12345
TypeNotification typestelegram
Group IDThe ID of group where the bot should send the messages-123456
Bot TokenThe Token of your telegram botabcdefg:hijklmnopqrstuvwxyz

Whatsapp

Monika supports Whatsapp notification. To enable notification via whatsapp, you must have a registered user in whatsapp business api server. Please refer to WhatsApp Business API documentation.

- id: unique-id-whatsapp,
type: whatsapp,
data:
recipients: [628123456789],
url: https://yourwhatsappapiserver.com,
username: whatsappusername,
password: whatsapppassword
KeyDescriptionExample
IDNotification identity numberwhatsapp12345
TypeNotification typeswhatsapp
RecipientsAn array phone number registered for whatsapp, should start with your country code number["628123456790", "629745834093"]
UrlThe URL of your whatsapp api serverhttps://yourwhatsappapiserver.com
UsernameYour whatsapp api user nameusername
UserpasswordYour whatsapp api user passworduserpassword

Microsoft Teams

Monika supports sending notifications via Microsoft Teams. In order to be able to send notifications via Microsoft Teams, you may need to add Connectors and webhooks to your channel. Please refer to Microsoft Teams Documentation to enable connectors and webhooks.

id: unique-id-teams
type: teams
data:
url: https://YOUR_TEAMS_WEBHOOK_URL
KeyDescriptionExample
IDNotification identity numberWebhook12345
TypeNotification typeswebhook
UrlThe URL of your Microsoft Teams Webhookhttps://<company>.webhook.office.com/

Discord

Monika supports Discord. To enable notification via Discord, you must create a discord webhook first. More info at Discord webhook documentation

id: unique-id-webhook,
type: discord,
data:
url: https://YOUR_DISCORD_URL
KeyDescriptionExample
IDNotification identity numberDiscord12345
TypeNotification typesdiscord
UrlThe URL of the Discord Webhook that will receive notificationhttps://discord.com/api/webhook/<webhook.id>/<webhook.token>

Facebook Workplace

Monika supports Facebook Workplace. To enable notification via Workplace, you must create custom integration first. More info at Facebook Workplace Custom Integrations

{
'id': 'unique-workplace-id',
'type': 'workplace',
'data':
{
'thread_id': '12345678910',
'access_token': 'your_custom_integration_access_token',
},
}
KeyDescriptionExample
IDNotification identity numberWorkplace12345
TypeNotification typesworkplace
ThreadIDIt's located at thread url, in the last segment6367478493277649
AccessTokenWorkplace access token for custom integrationDQVJzYWtsdHRJRWIxUk9uOG5VV...

Monika Whatsapp Notifier

You can get a notification from Monika to your Whatsapp number without having a Whatsapp Business account. First, you must create a Monika Whatsapp Notifier account.

id: unique-id-monika-notif
type: monika-notif
data:
url: https://YOUR_MONIKA_NOTIF_URL
KeyDescriptionExample
IDNotification identity numberMonikaNotif12345
TypeNotification typesmonika-notif
UrlThe URL of the Monika Notif Webhook linkhttps://whatsapp.hyperjump.tech/api/notify?token=<webhook.token>

Desktop Notifications

Monika supports desktop notifications. Here are the prerequisites for enabling the desktop notifications:

  • macOS: Uses OSAScript (Apple Open Scripting Architecture). AppleScript 2.0 or later and macOS version 10.5 or later required.
  • Linux: Uses notify-send command. notify-osd or libnotify-bin required (Ubuntu should have this by default).
  • Windows: Uses Powershell. Refer to Microsoft Official Documentation for System Requirements.
id: unique-id-monika-notif,
type: desktop

Larksuite Notifications

If you use Larksuite, you can get Monika to send notifications to the Larksuite bots. You can create a webhook url, and then use it in the monika configuration.

You can find more information on creating webhooks here.

The Yaml config setup may look something like this:

notifications:
- id: lark-group-message
type: lark
data:
url: https://open.larksuite.com/open-apis/bot/v2/hook/your-webhook-key-here

Keep watch on these pages, new notification methods are being developed.

← PrevProbes
Was this page helpful?
Next →Alerts

PT Artha Rajamas Mandiri (Hyperjump) is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of its modern DevOps practices.

Copyright © 2021 Hyperjump Tech. All Rights Reserved.