By installing an agent (Servwatch agent) on the monitored server, Servwatch enables process and resource monitoring.

This section describes how to install the agent.

On this page:

Installing node.js

The Servwatch agent requires node.js 10.15 ~.

Also install the pm2 process manager to make the agent resident.

Follow the installation procedure for each OS distribution to install.

yum remove git
yum install -y https://repo.ius.io/ius-release-el6.rpm
yum install perl-TermReadKey
yum install pcre2
yum install perl-Digest-SHA
yum install git --enablerepo=ius --disablerepo=base,epel,extras,updates
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
source ~/.bashrc
nvm install v10.15.2
nvm alias default v10.15.2
npm install -g pm2

yum install git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
source ~/.bashrc
nvm install v10.15.2
nvm alias default v10.15.2
npm install -g pm2
apt update
apt-get install git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
source ~/.bashrc
nvm install v10.15.2
nvm alias default v10.15.2
npm install -g pm2
apt update
apt-get install git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
source ~/.bashrc
nvm install v10.15.2
nvm alias default v10.15.2
npm install -g pm2
apt update
apt-get install git
source ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
nvm install v10.15.2
nvm alias default v10.15.2
npm install -g pm2

Deploy an agent

To deploy the Servwatch agent, execute the following script directly on the monitored server.

  1. Go to the console, move to "Server->" New Server Registration "and deploy the agent to the monitored server by following the steps from Step 2 of" Automatic Registration (usually select this) ".

  2. Execute the script 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. To setting the host name automatically (normally select this)

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

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

  3. If you return to the “Manage servers” page and the agent status is "N/A" and the metrics is "NO_MAP", it is registered normally.

Deploy an agent to docker container

To deploying the agent to the docker container, set the container start option as follows.

(example:Launch centos7 image with privileged mode)

docker run -it -d --privileged --name centos7 centos:centos7 /sbin/init


Uninstalling an agent

Uninstalling a Servwatch agent

pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent

To uninstall the pm2 daemon, follow the procedure below only when a nodejs program other than servwatch-agent is not running.

If a program other than servwatch-agent is running, please uninstall it at your own discretion.

Uninstalling a pm2 daemon

pm2 status
┌─────┬────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name               │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ servwatch_agent    │ default     │ N/A     │ fork    │ 0        │ 0      │ 0    │ stopped   │ 0%       │ 0b       │ root     │ disabled │
└─────┴────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
service pm2-root stop
chkconfig pm2-root off
pm2 unstartup

Uninstalling a Servwatch agent

pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent

To uninstall the pm2 daemon, follow the procedure below only when a nodejs program other than servwatch-agent is not running.

If a program other than servwatch-agent is running, please uninstall it at your own discretion.

Uninstall a pm2 daemon

pm2 status
┌─────┬────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name               │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ servwatch_agent    │ default     │ N/A     │ fork    │ 0        │ 0      │ 0    │ stopped   │ 0%       │ 0b       │ root     │ disabled │
└─────┴────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
systemctl stop pm2-root
systemctl disable pm2-root
pm2 unstartup