By installing an agent (Servwatch agent) on the monitored server, Servwatch enables process and resource monitoring.
This section describes how to install the agent.
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.
CentOS6.x
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
CentOS7.x
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
Debian10(buster)
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
Ubuntu20
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
Amazon Linux2
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.
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) ".
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.
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
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
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
CentOS6.x
Uninstalling a Servwatch agent
pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent
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
CentOS7/Debian/Ubuntu/Amazon Linux2
Uninstalling a Servwatch agent
pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent
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