Now you can add the monitored server to Servwatch and collect the metrics.
Create an event to set a threshold on the metric value and notify you of an alert.
Click "Event->" New Registration "from the console to go to the event creation page.
Click the "Create" button when the settings are complete
Choose metrics presets of you want to monitor
Set the following:
Name: Set the name of the event (eg sshd is down !!). This setting is embedded in the body of the email notification.
Channel to map: Specify the metric channel you want to monitor.
Enabled / Disabled: If the event is disabled, the notification operation will not be performed.
Webhook_url: Specify the endpoint when sending a webhook notification to an external server. Please refer: Using Event
Metrics: Enter the metrics for the monitored item. You can also select and enter from the auto-completed list.
The metrics can be specified as follows.
Example: Choose metrics of “cpu:user”
cpu:* CPU related metrics
mem:* Memory related metrics
disk:* Disk related metrics
network: Network related metrics
service: Service(Process) check metrics
IF:Specifies a conditional expression that contains a threshold for the metric.
THEN:Specify the action when the conditional expression is satisfied.
Notification email address setting
From the console, click the "Settings" navigation to go to the admin page.
Set the notification destination email address in "Alert notification destination 1 (2)".
Click "Save" to complete the settings.
This completes the event settings.
7. Enable dead notification
After completing all the steps, start the server alive monitoring by enabling the monitoring of the agent (Servwatch agent) running on the server.
Once you have enabled agent monitoring, you do not have to do it every time you add a server.
Go to the "Administrator Page" from the "Settings" navigation on the console.
Set “Agent”-> “Dead Notification” to “true”.
Click "Change settings" to complete the settings.
If the Keepalive communication between the agent and Servwatch is disconnected, the email address set in step 6 will be notified.
Keepalive is done by the MQTT protocol. Alert notifications may occur even when the server has not been restarted due to a network path problem. In that case, set "Disconnection notification" to "false".
8. Add a processs monitoring
To add a service monitor, add the monitored service to the agent settings file on the monitored server and restart the agent.
Navigate to the location of the configuration file.
Edit configuration file
Add the service name (example: httpd) you want to monitor in the following places.
"watch_service": "httpd" // List the services you want to monitor, separated by commas.
Restarting the agent
pm2 restart servwatch_agent
The metric "service: <service name>" is now available in the condition settings when creating the event.
The event threshold can be set as "OK" for normal service and "NG" for abnormal service.
9. Using the API
Servwatch uses the IoT platform "ThingScale" to collect server metrics.
By operating the REST API of "ThingScale", it is possible to set the bulk of the server and import the metric value into the original system.