Probes are the heart of the monitoring requests. Probes are arrays of request objects defined in the config file
monika.json like so.
Monika goes through each probe object, sends it out, and determines whether an alert or notification need to be sent out.
An actual probe request may be something like below.
Details of the field are give in the table below.
|method||Http method such as GET, POST, PUT, DELETE|
|url||This is the url endpoint to dispatch the request to|
|timeout||Request timeout, after which time, |
|headers||Your http header|
|body||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 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.|
|recoveryThreshold (optional)||Number of times an alert should return false before Monika sends notifications. For example, when recoveryThreshold is 3, Monika will only send notifications when the probed URL returns status 2xx 3 times in a row. After sending the notifications, Monika will not send notifications anymore until the alert status changes. Default value is 5.|
|alerts||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.|
|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 files size small as some responses can be sizeable. The setting is for each probe request.|
|alerts (optional)||See alerts section for detailed information|
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.
In a configuration with multiple probes,
Monika will perform the requests in sequence in the order that they are entered, one after another. When the
--id flag is used, the sequence of IDs are executed as entered.
Monika will sleep until the next interval to start again. At the top of the
monika.json file there is an
interval setting. The execution will be restarted after every
interval. If interval is shorter than the amount of time to dispatch all the requests, then
Monika will immediately repeat after the last probe response and any notification alerts sent. When the
--repeat flag is set with a value, Monika will not run indefinitely, instead, it will stop after executing the probes as many times as specified.
To run monika using a Postman JSON file, use --postman 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 © 2021 Hyperjump Tech. All Rights Reserved.