diskusi.tech (beta) Community

Cover image for How Monika Saved Me from Unnoticed Server Errors

How Monika Saved Me from Unnoticed Server Errors

dennypradipta profile image Denny Pradipta ・5 min read

This post is originally posted on Medium, which you can read the original article here.

Cover image by by David Pupaza on Unsplash

It was a peaceful Friday evening. I ordered some food for dinner with my wife. I remembered we were going to eat some delicious Arabian chicken mandi I found on a food delivery application. Food was ready, it’s time to eat, and suddenly something on my e-mail popped up:

Target https://www.client.com/health is not healthy. The response time has been greater than 1000 3 times in a row

“Hmm, maybe the internet is a little bit slow today”

That’s what I said to myself, still being optimistic. We continued eating our dinner until we finished our plates. And then, a follow-up e-mail popped up:

Target https://www.client.com/health is not healthy. It has not been returning status code 2xx 3 times in a row.


I jumped out of my chair, rushed to my laptop, and opened up my client website. It loaded up very slowly, not even rendering the first landing page. I kept refreshing the page, but still no luck. I contacted my team to tell them that our client website may be down. They opened their laptops and confirmed that our client website is indeed down.

After some minutes of troubleshooting, we found out that our website has been visited by so many people that day for an event sign-up, causing our servers’ capability to reach its high point. Luckily, it’s just a short span of visits spikes. Everything went back to normal after a while, and I got an e-mail saying:

Target https://www.client.com/health is back to healthy.

We took notes and immediately planned to mitigate the problems of what happened. My team and I closed our laptops and continued with our lives.

However, the main point of the story is not how panicked I was while I fixed the system outage, or how my Arabian Chicken mandi tasted like (it tasted wonderful, by the way). What I am about to tell you is, “Who e-mailed me about the server outages?”

Of course, it’s not my boss. If it had been my boss, I would have been stressed out for the rest of the night. It was Monika.

What is Monika?

GitHub logo hyperjumptech / monika

Monika is a command line application to monitor every part of your web app using a simple JSON configuration file. Get alert not only when your site is down but also when it's slow.

Monika is an open source and free synthetic monitoring command line application. The name Monika stands for “Monitoring Berkala”, which means “periodic monitoring” in the Indonesian language.

With Monika, you can add as many websites as you want to monitor. You can monitor several conditions such as service outages or slow services. Also, you can configure Monika to send notifications of the incidents on your services through your favorite communication tools like SMTP mail, Telegram, WhatsApp (It’s free!), etc.

How does Monika do the job?

Monika uses a single file configuration to set up which websites you want to monitor and the triggers for the alerts, such as trigger alerts when the designated URL status code is not 200 (OK) or when the designated URL response time is longer than 3 seconds. You can also specify the intervals between each request. For example, “I only want to monitor this URL every 15 seconds”.

For every trigger you specify, Monika will send you notifications for the incident or recovery of the triggered URL. You can configure many notification channels in one configuration file. For example, “When there are alerts triggered, I want to receive notifications on my WhatsApp, my workplace Slack channel, and my Microsoft Teams channel.”

You can also specify the incident and recovery threshold. Let’s say that your API fails 3 times each 15 minutes. The default value for Monika incident/recovery threshold is 3 times, so every 15 minutes you will receive a notification saying that your API fails. Maybe you would think that 3 times is just a false alarm, so you want to increase the threshold to 5 times. Monika got you covered.

Sounds promising, I want to use it!

I’m glad you’re interested with Monika! You can install Monika everywhere in your computer using NPM:

npm install -g @hyperjumptech/monika

After you install Monika, create a file called config.json in your working directory. I’ll give you my configuration as an example:

  "notifications": [
      "id": "desktop",
      "type": "desktop"
  "probes": [
      "id": "1",
      "name": "My Home Page",
      "description": "My Home Page",
      "interval": 10,
      "requests": [
          "url": "https://www.dennypradipta.com",
          "body": {},
          "timeout": 10000,
          "headers": {},
          "method": "GET"
      "incidentThreshold": 3,
      "recoveryThreshold": 3,
      "alerts": ["status-not-2xx", "response-time-greater-than-1-s"]
Enter fullscreen mode Exit fullscreen mode

I will explain the configuration above:

  • In the notifications object, I define that I will be using desktop notification. There are many notification channels available, more on that later.
  • In the probes object, I define the probe name as “My Home Page” with a description of “My Home Page”. The probe will be running at 10 seconds interval
  • My probe will hit my website https://www.dennypradipta.com with method GET, empty headers, empty body, and maximum timeout of 10 seconds
  • My probe will send a notification when there are 3 times alerts triggered (incidents or recoveries). So when my website fails 3 times, my probe will be marked as down. And when my website recovers 3 times after it has been marked as down, my probe will be marked as up and healthy.
  • I will be alerted when my website response status code is not 2xx (200, 201, 203, 204) and when my website response time is larger than 1 second.
  • I know some people are not comfortable with typing configuration manually, so Monika got you covered with Monika Config Generator which is a GUI tool for generating Monika configuration

Save your configuration file to monika.json, and run Monika in your machine by running monika in your terminal.

Monika on the action

Bear in mind I use desktop notifications. Monika has a lot of notifications channels available:

  • SMTP
  • Mailgun
  • SendGrid
  • Webhook
  • Slack
  • Telegram
  • WhatsApp Business
  • Microsoft Teams
  • Discord
  • Monika Whatsapp Notifier (It’s free!)
  • Facebook Workplace
  • Desktop Notifications

All of the channels above are available in our documentation page.


What I explained earlier is just a drop of water, while Monika is an ocean. There are many features such as simulating HTML form submission, multiple requests in one probe, and use the previous request body for the next request parameters using requests chaining.

We would love to hear some feedback, so make sure you visit our Github page to submit some issues you’re having, request some features, or probably contribute to our repository.

Thank you for reading my story. Now, I could sleep well knowing that my server is working as it should be.


Editor guide
itsannazzle profile image

I thought Monika was your co-worker haha, nice article btw sir!