Welcome to the Metric Check tutorial. In this guide, we will help you check your server resources with a Metric Check.
This tutorial will takeTo continue, you need to be logged in to your Netping account in order to access the Netping dashboard. If you haven't already done so, please register an account, login, and return to this tutorial. You also need to be able to upload a script to the website you want to check.
Before we begin setting up the monitoring itself, we need to create at least one recipient. A recipient is the endpoint that will receive alerts if your server resources is about to run out. Alerts can be sent to several recipients at the same time. A recipient can be a phone number (for SMS alerts), an email address, or any of the other types listed below.
Recipient type | Description |
---|---|
SMS | Alerts sent as SMS-message. |
Alerts sent as E-mail message. | |
App | Alert sent as an App-notification to the netping app on your smartphone. |
Slack | Alerts sent to your Slack.com channel. |
List | A prioritized list of recipients to create an escalating alert scheme. E.g. If person A does not respond to the alert within 10 minutes contact person B. If person B does not solve the issue within 1 hour notify person C. Etc. |
Schedule | Define a recurring weekly/monthly contact schedules, so the right person gets notified according to your organization and team. |
Webhook | Configure Netping to contact a HTTP URL if your check goes down. |
Next, we will create an email recipient (you are welcome to deviate to any of the other types of recipients listed above). To create an email recipient, click "Recipients" on the dashboard menu, then click the "New Recipient > Email Recipient" button. On the following page, type in a name and email address and then press Save. Feel free to create more than one recipient if needed.
The URL that a metric check is going to connect to, need to return JSON data. Our example script will return standard metrics like free memory, cpu and storage percentage. If you make your own script you can return any JSON data you would like (I.e. 'logged in users').
Below is an example of what a custom script could return. The returned data can later be visualized on a diagram using the netping dashboard.
{
"logged_in_users": 125,
"sales_today": 1622,
"free_memory": 32456,
"custom_message": "String values will show up as flags on a netping dashboard diagram.",
"any_custum_value": 123
}
To download the standard probe script (PHP), please click the button below and upload the script to your website on an publicly available URL.
The next step is to create and configure the monitoring itself. To begin, click "Checks" on the dashboard menu, then click the "New Check" button. Please enable the Collect Metric Data toggle.
Enter the URL to your probe script, and the other required information on the “Create Check” page and click Save. If needed, read the field descriptions below. Enable the Collect Metric Data toggle.
Standard settings | Description |
---|---|
Name | A string to name this Check by. E.g. 'Mywebsite.com' or 'My Web Site'. |
Check Interval | How often (in minutes) Netping should test the uptime of your website. If no special reason, select the lowest value available. |
Check Location | Location to test your website From (what check node to use). Select one from the list. |
URL | The URL of your website. E.g. 'http://www.mysite.com' |
Collect Metric Data | Enable this toggle, since we are collection JSON metric data from a probe script. |
Create Response Trigger | Enable this toggle to automatically create a trigger to warn you if your probe script stops responding correctly. |
Domain Expiry Trigger | Enable this toggle to automatically create a trigger to warn you if your domain name is close to expiry. |
SSL Expiry Trigger | Enable this toggle to automatically create a trigger to warn you if your SSL certificate is close to expiry. |
Advanced settings | Description |
Method (optional) |
The HTTP method to be used when netping contacts your website URL. Either select GET or POST. |
Post data (optional) |
Custom data to be sent with the HTTP request, if request method is set to POST |
Username (optional) |
If the supplied URL is protected with HTTP authentication, authenticate with this username. |
Password (optional) |
If the supplied URL is protected with HTTP authentication, authenticate with this password. |
Request headers (optional) |
Custom data to be added to the HTTP request header. |
Check for string (optional) |
This string must be returned in the response of your URL, or your service will be considered down. |
To get notified if your service resources (such as free memory) dips below a predefined threshold, you have to create an alert trigger. To create an alert trigger, click "Triggers" on the dashboard menu, then click the "New Trigger" button.
Select your Metric Check in the Check field. Then define your Metric Triggers by clicking the Metric Triggers field. The popup below will be shown. Define one or more rules using the standard variables shown (the variables our standard probe script will return).
Creating a disk_free < 10% triggerFill in all the other required fields on the Trigger page, using the below field description if needed.
Field name | Description |
---|---|
Name | Add a descriptive name of this trigger. E.g. 'Mysite.com Responsetime Trigger' |
Check | Select the Check you would like to create a trigger for (the name you choose in step 3). |
Maximum Response Time | Select after how long responsetime (in milliseconds) your service should be considered down. |
Minimum duration | Select if you would like the trigger to execute an alert as soon as the condition is met, or when the condition has persisted for some time. |
Alert Recipient | Select one or more recipients that will receive the alert of the trigger executes. |
Auto Resolve Incident | If this trigger executes, an Incident Log will be created. Select if you would like the incident to automatically be marked as Solved after x minutes of regained uptime. |
A good final step is to test the check trigger after completion. Click “Triggers” on the dashboard menu, find your check trigger in the list and select "Execute Trigger” from the “Actions” dropdown menu. This simulates an outage and triggers an alarm without the need to disrupt any of your services.
That’s all! In only a few minutes, we have learnt how to create, configure, and test the server resource monitoring for your website, using our standard probe script. Next, why don't you create a diagram on the dashboard frontpage, to visualize some of the collected data?.