Customize notifications
You can select an event when you check a metric and set up notifications to be sent — if it is fulfilled (or conversely, not fulfilled), you will receive a notification. This can be used to identify problem areas during inspections.
Add contact
- Email or phone number
- HTTP request
-
In Control Panel, go to Monitoring → Reports and Notifications.
-
Open the Contacts tab → click Add 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 Monitoring → Reports and notifications → click Order SMS.
-
Optional: Specify the time to send notifications.
-
Press Add.
-
Create a php file in the directory with your website, for example, log.php.
-
Add the code to the script to test it:
<?php
echo "<response>";
?>Specify
<response>
— the expected response is of the form5ca8ada3938381ec79e881132b1fa3dac3
. -
In Control Panel, go to Monitoring → Reports and Notifications.
-
Open the Contacts tab.
-
Press Add Contact.
-
Select the method of receiving HTTP notifications — via HTTP requests.
-
In the HTTP field, add the absolute address of the link to the file you created in step 1, for example,
http://domain.com/log.php
. -
Press Check.
-
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.
-
Press Add.
Sample 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>
— the API access token for your bot that you received when you created the bot. -
Get the chat ID — copy the value of the
chat_id
parameter. -
Create a
log.php
file. -
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='New entry in monitoring file: <url>'");
$result=curl_exec($ch);
curl_close($ch);
}
?>Specify:
<chat-id>
— chat ID or username of the user to whom you want to send a message;<token>
— Telegram bot key (token) of the form864190220:AAGY3To77NuySjaGmupS7PfEQy952V08QOA
;<url>
— a link to a file of the formhttp://test-http-get.ru/modules/log/get.log
.
-
Create a
log
directory in the root directory of your site. -
In the directory, create a file named
get.log
where the log of GET requests will be saved. -
In the same directory, place the
log.php
file created in step 3.
Customize notification
A separate notification is configured for each metric.
- In Control Panel, go to Monitoring → Monitoring.
- Open the Metrics tab → open the metrics page → Notifications tab.
- Select the contacts to which the notification will be sent.
- Press New Notification.
- 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 Public Statistics Page link.