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. Desktop Notifications
  2. Discord
  3. Facebook Workplace
  4. Google Chat
  5. Lark Suite
  6. Mailgun
  7. Microsoft Teams
  8. Monika Whatsapp Notifier
  9. PagerDuty
  10. SendGrid
  11. Slack
  12. SMTP
  13. Telegram
  14. Webhook
  15. WhatsApp Business
  16. Dingtalk
  17. Pushover
  18. Opsgenie
  19. Pushbullet

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_ADDRESS1', 'RECIPIENT_EMAIL_ADDRESS2']
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:
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.

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.
notifications:
- id: unique-id-monika-notif
type: desktop

Discord

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

notifications:
- 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

notifications:
- id: unique-workplace-id
type: workplace
data:
thread_id: abcd-123-456
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...

Google Chat

You can send Monika notifications to your Google Chat. First you need to generate the url webhook for Monika to use. To create a webhook:

  1. Open Google Chat
  2. Go to the space to add notification
  3. Select Manage webhook from the top of the page
  4. Under Incoming webhook, click Add another if one already exists, in either case you need to provide a name.
  5. Name the new webhook and Save
  6. Copy the URL in the webhook modal
  7. You will need the URL in your monika configuration

For further information check the Google Chat documentations here

Example of Google Chat configuration may be something similar to below:

notifications:
- id: myGoogleChatNotif
type: google-chat
data:
url: https://chat.googleapis.com/v1/spaces/XXXXX/messages?key=1122334455

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.

Mailgun

Mailgun is an email notification delivery service 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:
notifications:
- 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 email 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

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.

notifications:
- id: unique-id-teams
type: teams
data:
url: https://YOUR_TEAMS_WEBHOOK_URL
KeyDescriptionExample
IDNotification identity numberMyTeamsNotif123
TypeNotification typesteams
UrlThe URL of your Microsoft Teams Webhookhttps://<company>.webhook.office.com/webhookb2/1234-abcdef

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.

notifications:
- id: unique-monika-notif-id
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>

PagerDuty

PagerDuty is a platform for agile incident management. You need the integration key to use PagerDuty. You can get the integration key by following the steps in the documentation. To give you the flexibility to choose which probe belongs to which PagerDuty service. You need to map the PagerDuty integration key with your Monika probe id in the configuration.

notifications:
- id: unique-id-pagerduty-notify
type: pagerduty
data:
key: YOUR_PAGERDUTY_INTEGRATION_KEY
probeID: ZN32nw_KsvTKtLFNu55JV
KeyDescriptionExample
idNotification identity numberpager-duty-1
typeNotification typespagerduty
data.keyPagerDuty integration key0nlar5b9ko8hnqrvsfnhtmihyopn5eri
data.probeIDMonika Probe IDZN32nw_KsvTKtLFNu55JV

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:

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

Slack Incoming Webhook

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

notifications:
- 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

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.

notifications:
- 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 email 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.

Statuspage

Statuspage is a status and incident communication tool. You need a page ID and an API key to use Statuspage. You can obtain it by following the steps in the documentation.

notifications:
- id: unique-id-statuspage
type: statuspage
data:
apiKey: YOUR_STATUSPAGE_API_KEY
pageID: YOUR_STATUSPAGE_PAGE_ID
KeyDescriptionExample
idNotification identity numberstatuspage-1
typeNotification typesstatuspage
data.apiKeyStatuspage API keyc374d669-8ac0-480d-9ec7-732d71b43e38
data.pageIDStatuspage page IDq3sl2xb8h0

Telegram

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

notifications:
- 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

Webhook

Monika supports Webhook. To enable notification via Webhook.

notifications:
- 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
}

Whatsapp Business

Monika supports notifications from Whatsapp for business accounts. To enable notifications via WhatsApp for business, you must have a registered user in the WhatsApp business API server. Please refer to WhatsApp Business API documentation.

notifications:
- id: unique-whatsapp-id
type: whatsapp
data:
recipients: ['628123456789', '3804321234']
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

Dingtalk

Monika supports Dingtalk. To enable notification via Dingtalk, you must create a robot webhook first. More info at Dingtalk robot webhook Dingtalk documentation and Alibaba cloud documentation.

notifications:
- id: unique-id-webhook
type: dingtalk
data:
access_token: YOUR_ACCESS_TOKEN
KeyDescriptionExample
Access TokenThe token of your Dingtalk accountDingtalk1234

Gotify

Monika supports Gotify. To enable notification via Gotify, you must have a Gotify Server's URL and application token. Gotify is an open source notification server with several different clients. More info at Gotify documentation.

notifications:
- id: unique-id-gotify
type: gotify
data:
url: GOTIFY_URL
token: GOTIFY_TOKEN
KeyDescriptionExample
urlGotify server URLhttps://gotify.example.com
tokenGotify application tokenOhyegh1eePahraz

Pushover

Monika supports Pushover. To enable notification via Pushover, you must create a pushover application first. More info at Pushover documentation.

notifications:
- id: unique-id-webhook
type: pushover
data:
token: PUSHOVER_TOKEN
user: PUSHOVER_USER
KeyDescriptionExample
TokenPushover application tokenpushoverApplicationToken
UserPushover user keypushoverUserKey

Opsgenie

Monika supports Opsgenie. To enable notification via Opsgenie, you must create a team, then create an integration, and finally add an API. More info at Opsgenie documentation.

notifications:
- id: unique-id-opsgenie
type: opsgenie
data:
geniekey: GENIE_KEY
KeyDescriptionExample
GeniekeyOpsgenie application tokenopsgenieApplicationToken

Pushbullet

Monika supports Pushbullet. To enable notification via Pushbullet, you must create an account and create your access token. You can create an access token at Pushbullet Settings Page.

Optionally, you can push notifications to specific devices by running the command below:

curl --header 'Access-Token: <your_access_token_here>' \
https://api.pushbullet.com/v2/devices

Then, you can put the iden value from the API response to the deviceID at the Monika configuration properties.

More info at Pushbullet Documentation.

notifications:
- id: unique-id-pushbullet
type: pushbullet
data:
token: PUSBULLET_ACCESS_TOKEN
deviceID: PUSHBULLET_DEVICE_ID
KeyDescriptionExample
tokenPushbullet Access Tokena6FJVAA0LVJKrT8k
deviceIDPushbullet Device Identifierujpah72o0sjAoRtnM0jc
← PrevAlerts
Was this page helpful?
Next →Probes

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 © 2022 Hyperjump Tech. All Rights Reserved.