Getting Started
Start server monitoring simply with Servwatch!
This section describes the procedure for adding a monitored server to Servwatch, viewing metric values, and receiving alert notifications.
Glossary
Servwatch uses the following terms:
Device: Represents a monitored server. Servwatch recognizes the server host name as the device ID.Agent: An agent program that runs on the monitored server. Communicates with the Servwatch cloud using the MQTT protocol.Channel: A data store (metric store) that stores metric values (such as CPU load and service status) sent from the server via the agent. Channels must be created manually and tied to the device.Event: A function that sets a threshold for metrics and notifies alerts. You can set an event for all the metric values that Servwatch collects.
1.Loggin in Console
Log in to the management console with the account information provided in your email when you sign up online.
Free plan: You can monitor up to 3 devices (servers)
Pro plan: You can monitor up to 40 devices (servers)
2. Create a new device(server)
Servwatch manages the server as a "device".
From the console, click "Server"-> "Register New Server" to go to the creation page.
Follow the steps in "Automatic registration (usually select this)" to deploy the agent.
Check your server must support systemctl before installing the agent. Follow the agent procedure for details. Please refer:Server Agent
Execute the script string with root privileges on the terminal of the monitored server. The host name is set automatically, but if you want to set it manually, change the red part and execute.
When setting the host name automatically (normally select this)
sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICETOKEN='****' shWhen manually setting the host name
sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICEID='<SET_YOUR_HOSTNAME>' SERVWATCH_DEVICETOKEN='****' sh
You can check if the agent is installed correctly with the following command:
journalctl -u servwatch -fFinally, return to the server management page and wait for a minute, the agent status is
N/Aand metrics isNO_MAP, it is registered normally.Agent successfully installedProceed to the next step (creating a new channel).
Do not include symbols such as. * ~ / In the host name.
3. Create a new channel
Create a new channel to store the metric values sent by the agent.
From the console, click "Channel"-> "New Registration" to go to the creation page.
After setting the
channel IDto an integer value of 0 or more and theNameto the server name, click the "Create" button to complete the creation.Create a new channelClick "Channel" from the left navigation and confirm that the channel has been created.
4. Map a channel to device
Map the channel created in step 3 to the device.
From the console, click "Server"-> the device name registered in step 1 to go to the device edit page.
Set the following:
Description: Enter the name and role of the server in a descriptive name.Disabled: The device automatically registered by the agent is false in the initial state, so enable it as true.Metrics: Assign the channels created in step 3 to the device.Click the "Save" button to complete the device settings.
After about 3 minute, the metric values (server resource monitoring values and process monitoring values) will be accumulated in the mapped channel.
5. Check metrics
Click "Metrics" from the console to go to the metrics page, you can check the metrics.
The types of metrics are as follows:
CPU Load(%)
Memory (used/total bytes)
Disk usage(used%)
Network I/O(tx/rx bytes per sec)
Metrics: Select the channel you want to check.Range: Specify any time.Reset: Resets the display range. (1hour / 6hour / 12hour / 1day)
6. Add an event(alert)
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
Set the following:
Configuration
Description: Set the name of the event (eg sshd is down !!). This setting is embedded in the body of the email notification.Metric: Specify the metric channel you want to monitor.Enabled: Set to true. If the event is disabled, the notification operation will not be performed.
Condition
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 metricsmem:*Memory related metricsdisk:*Disk related metricsnetwork:*Network related metricsservice:*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. Optionally, you can add additional address inAlert notification destination 2Set the notification destination Slack’s incoming webhook URL in
Slack webhook URL.For configuration slack webhook, refer this document: https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/
Click "Save" to complete the settings.
Sample slack notification are below:
Sample event notification
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 “Others”-> “Agent settings” →
Dead Notificationto 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".
Agent monitoring notifications will be sent to email and Slack (if configured).
Follow these steps to test the dead notification:
In target server, type
systemctl stop servwatchto stop agent.To start agent, type
systemctl start servwatchCheck notify.(eg. Slack)
Sample dead notification
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.
cd /opt/servwatch-agent/config
Edit configuration file
vim default.json
Add the service name (example: httpd) you want to monitor in the following places.
{ "device_id":"hostname", "user_id":"U000***", "device_token":"************************", "watch_service": "httpd" // List the services you want to monitor, separated by commas. }
Restarting the agent
systemctl restart servwatch
2. 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 operational and NG for critical state.
Click "Event->" New Registration "from the console to go to the event creation page.
Click the "Create" button when the settings are complete.Below is an example of adding a httpd service monitor as
service:httpd.Description: The name of the event. This will be noticeable in the Slack notification, so be thoughtful.Metrics: Specify the service name you configured in the previous step. In this case,set asservice:httpdIF: Specify the conditions under which the alert will fire. Specify NG when the process is down, and OK when it is up.THEN: Specify the notification destination for the alert.email: Sent to your email
slack: Sent to Slack
both: Sent to email and Slack
Sample slack alert is below:
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.
Please refer to the following for specific usage.
© 2014-2022 SENSINICS,LLC