Probes are the heart of the monitoring requests. Probes are made out of an array of "requests" and some controls. The control parameters determine how the probes are performed, such as repetition intervals, probe name, identification and text descriptions. Requests are either Ping, TCP or HTTP(S) requests to some location.
Monika goes through each probe object in the
monika.yml config file, sends it out, and determines whether an alert or notification needs to be sent out.
Basically probes are arranged as arrays of request objects.
Details of the field are given in the table below.
|method (optional)||Http method such as GET, POST, PUT, DELETE.|
|url (required)||This is the url endpoint to dispatch the request to.|
|timeout (optional)||Request timeout in milliseconds, Default value is 10000 which corresponds to 10 seconds. If the request takes longer than |
|headers (optional)||Http headers you might need for your request.|
|body (optional)||Any http body if your method requires it.|
|interval (optional)||Number of probe's interval (in seconds). Default value is 10 seconds.|
|incidentThreshold (optional)||Number of times an alert should return true before Monika sends notifications. For example, when incidentThreshold is 3, Monika will only send incident notifications when the probed URL returns non-2xx status 3 times in a row. After sending the notifications, Monika will not send notifications anymore until the alert status changes. Default value is 5. However, the actual number of retries will be the the greatest number between |
|recoveryThreshold (optional)||Number of retries before Monika sends recovery notifications. For example, when recoveryThreshold is 3 and when previously a probe is marked as incident, Monika will only send recovery notification when the probing succeeds 3 times in a row. Default value is 5. However, the actual number of retries will be the the greatest number between |
|saveBody (optional)||When set to true, the response body of the request is stored in the internal database. The default is off when not defined. This is to keep the log file size small as some responses can be sizable. The setting is for each probe request.|
|alerts (optional)||The condition which will trigger an alert, and the subsequent notification method to send out the alert. See below for further details on alerts and notifications. See alerts section for detailed information.|
|ping (optional)||(boolean), If set true then send a PING to the specified url instead.|
|allowUnauthorized (optional)||(boolean), If set to true, will make https agent to not check for ssl certificate validity|
By default, the request body will be treated as-is. If the request header's
Content-Type is set to
application/x-www-form-urlencoded, it will be serialized into URL-safe string in UTF-8 encoding. Body payloads will vary on the specific probes being requested. For HTTP requests, the body and headers are defined like this:
You can use responses from previous http requests in the body of your next request, see how requests chaining work in the sections further below. It is also possible to automatically generate data in your payload. See the fake data payload section here.
Currently, Monika only supports Content-Type value
application/json with UTF-8 encoding.
To monitor the connectivity and the health of your MariaDB database, you can use the following monika configuration:
You can also use the
mysql keyword for your Mysql database like below. The
mysql probe types are interchagnable.
You can check if your MongoDB instance is running and accessible by adding a probe with
mongo configuration as follows.
If your MongoDB configuration uses authentication settings, you can pass the
password field like below:
If you have a connection URI, you can pass it to the
uri field like below:
You can send an ICMP echo request to a specific url by specifying a
In this mode the a PING echo request is sent to the specified url.
Monika provides a way to check your postgres database's health with a 'postgres' type probe. You can define the
password like this:
Or alternatively you may provide a postgresql connection URI like below:
If uri is provided along with host, port, user and password fields, connection will be derived from the uri string and the other fields will be ignored.
Please see the postgres connection specification for details on uri formatting.
You can check if your redis instance is running and accessible by adding a probe with
redis configuration as follows.
If your redis configuration include
AUTH settings, you might get some error like
Error: NOAUTH Authentication required.
You can pass a
password field like below:
You may also add a
username property as needed. An alternative format that you can provide is a uri connection string for redis with the following specification
See the full redis client configurations here.
You can send a TCP request to a specific
data by using the
The default shape of a response when Monika has successfully fetched a request is as the following.
Details of the fields are shown in the table below.
|status||HTTP Status Code (e.g 200, 403, 500)|
|statusText||HTTP Status Code Explanation (e.g OK, Forbidden, Internal Server Error)|
|config||Request configuration (e.g URL, Method, Data, Headers, Body, etc.)|
|headers||Response headers from the fetched request (e.g SetCookie, ETag, etc.).|
|data||Response payload from the fetched request (e.g token, results, data).|
Probe response data could be used for Request Chaining.
To make it easier to troubleshoot HTTP requests, we have mapped low-level errors returned by the HTTP library to numbers between 0 and 99. These custom errors are returned as the HTTP status code and can be used to trigger alerts in the same way as regular HTTP status codes.
|0||Connection not found|
|3||Too many redirects|
|4||Bad option value|
In a configuration with multiple probes,
Monika will load the requests in the order that they are entered, one after another. However, probes may be performed out of sequence depending on their interval setting, network latency and response times. By default Monika loops through all the probe configurations in the order they are entered, but you can use the
--id or the
--repeat flags to specify or repeat a particular sequence. See the cli options here for more information.
In general, Monika will sleep until the next
interval timer to repeat a probe. If no
interval time is specified for a probe, the default value will be used. If the configured probe
interval is shorter than the amount of time to dispatch all the requests, then
Monika will immediately repeat after the last response and any notification alerts sent.
You can use fake data to pass through your URLs, request body, and request headers. Here is the list of available fake data:
|returns random string with length |
|returns random string with length |
|returns a random country code.|
|returns a random color string.|
|returns a random currency code.|
|returns a random email address.|
|returns a random full name.|
|returns a random gender. The default value for |
|returns the date of the request sending in ISO format.|
|returns a random latitude between |
|returns a random longitude between |
|returns a random integer number between |
|returns a random MongoDB ObjectID.|
|returns a random HTTP status code.|
|returns current time in a form of a UNIX timestamp.|
|returns a random UUID.|
|returns a random English word.|
To use the fake data, all you need to do is to wrap them in the double curly brackets like the example below:
If you want to use it as a request body, you can use it like this:
The same goes for the request headers, you can use it like this:
NOTE: We only support Postman collection v2.0 and v2.1 files.
To run monika using a Postman JSON file, use
--postman flag as follows:
Monika supports Insomnia collection file in version 4 format. Both
yaml files are supported.
To run Monika using an Insomnia collection file, use
--insomnia flag as follows:
HAR HTTP-Archive format was created by the Web Performance Working Group and has become the standard in browser archive request data definition. To run monika using a HAR file, use
--har flag as follows:
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 © 2023 Hyperjump Tech. All Rights Reserved.