Customize notifications
You can select an event when checking a metric and configure notifications to be sent — if it is fulfilled (or vice versa, not fulfilled), you will receive a notification. With this, you can identify problem areas during the checks.
Add a contact
Email or phone
HTTP request
-
In control panel go to Monitoring → Reports and notifications.
-
Open the tab Contacts → click Add a contact.
-
Select how you want to receive notifications:
- Email — email notifications are free of charge.
- Phone — SMS notifications. You need to purchase a paid package, to do this go to the section Monitoring → Reports and notifications → click Order SMS.
-
Optional: Specify the time to send notifications.
-
Click Add.
-
Create a php file in the directory with your site, for example, log.php.
-
Add some code to the script to test it:
<?php
echo "<response>";
?>Specify
<response>
— expected response5ca8ada39381ec79e881132b1fa3dac3
. -
In control panel go to Monitoring → Reports and notifications.
-
Open the tab Contacts.
-
Click Add a contact.
-
Select the method of receiving HTTP notifications — via HTTP requests.
-
In the field HTTP add the absolute address of the link to the file you created in step 1, for example,
http://domain.com/log.php
. -
Click Check it out.
-
The expected response that you added to the file in step 2 will appear in the dashboard.
-
Once verified, modify the php file and add a working script to it. You can use sample script.
-
Optional: Specify the time to send notifications.
-
Click Add.
Example script
This script sends a message to Telegram if a new entry appears in the monitoring message log.
-
Start a dialog with the bot from your account and get a list of updates for your bot:
https://api.telegram.org/bot<token>/getUpdates
Specify
<token>
— token to access your bot via API, which you received when you created the bot. -
Get chat ID — copy the value of the parameter
chat_id
. -
Create a file
log.php
. -
Add the following script to the file:
<?php
$file_get = $_SERVER["DOCUMENT_ROOT"] . "/modules/log/get.log";
if (!empty($_GET)) {
$fw = fopen($file_get, "a");
fwrite($fw, "GET " . var_export($_GET, true));
fclose($fw);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>&text='Новая запись в файле мониторинга: <url>'");
$result=curl_exec($ch);
curl_close($ch);
}
?>Specify:
<chat-id>
— The chat ID or username of the user you want to send a message to;<token>
— Telegram bot key (token) of the following form864190220:AAGY3To77NuySjaGmupS7PfEQy952V08QOA
;<url>
— file referencehttp://test-http-get.ru/modules/log/get.log
.
-
Create a directory in the root directory of your site
log
. -
In the directory, create a file named
get.log
where the log of GET requests will be saved. -
In the same directory, place the file
log.php
created in step 3.
Customize notification
A separate notification is configured for each metric.
- In control panel go to Monitoring → Monitoring.
- Open the tab Metrics → open the metrics page → tab Notifications.
- Select the contacts to which the notification will be sent.
- Click New notice.
- Select the event, after how many failures and at what frequency to send notifications.
View public statistics
Another way to keep track of the status of metrics is on the public stats page.
In control panel go to Monitoring → Monitoring → click on the link Public statistics page.