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.

You can monitor up to 3 devices (servers) during the 15-day free trial period.

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.

Deploy server agent
  1. You need to install nodejs before installing the agent. Follow the agent procedure for details. Please refer:Server Agent

  2. 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.

    1. When setting the host name automatically (normally select this)

      1 sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICETOKEN='****' sh
    2. When manually setting the host name

      1 sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICEID='<SET_YOUR_HOSTNAME>' SERVWATCH_DEVICETOKEN='****' sh

       

  3. Finally, return to the server management page and wait for a minute, the agent status is ‘N/A’ and metrics is ‘NO_MAP’, it is registered normally.

    Agent successfully installed
  4. Proceed 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.

  1. From the console, click "Channel"-> "New Registration" to go to the creation page.

  2. After setting the channel ID to an integer value of 0 or more and the channel name to the server name, click the "Create" button to complete the creation.

  3. Click "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.

Edit device


Set the following:

  • Details: Enter the name and role of the server in a descriptive name.

  • Enabled / Disabled: The device automatically registered by the agent is "false" in the initial state, so enable it as "true".

  • Channels to map: Map (assign) the channels created in step 3 to the device.

  • Click the "Save" button to complete the device settings.

After about 1 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 in table format and graph by switching tabs.

Viewing server metrics of ‘CPU’
  • Metrics Channel: 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

Choose metrics presets of you want to monitor

Set the following:

  • Configuration

    • 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

  • 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 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.

  1. Go to the "Administrator Page" from the "Settings" navigation on the console.

  2. Set “Agent”-> “Dead Notification” to “true”.

  3. Click "Change settings" to complete the settings.

  4. 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.

1 cd /opt/servwatch-agent/config

Edit configuration file

1 vim default.json

Add the service name (example: httpd) you want to monitor in the following places.

1 2 3 4 5 6 { "device_id":"hostname", "user_id":"U000***", "device_token":"************************", "watch_service": "httpd" // List the services you want to monitor, separated by commas. }

Restarting the agent

1 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.

Please refer to the following for specific usage.

API Reference (V2.0.0)