...
...
Installing node.
...
js
The Servwatch agentはnodeagent requires node.js 10.15〜を必要とします。
エージェントを常駐するためのpm2プロセスマネージャーもあわせてインストールします。
各OSディストリビューションごとのインストール手順に従いインストールします。15 ~.
Also install the pm2 process manager to make the agent resident.
Follow the installation procedure for each OS distribution to install.
Expand |
---|
|
Code Block |
---|
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 |
|
...
Expand |
---|
|
Code Block |
---|
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 |
|
エージェントのデプロイ
Servwatch agentのデプロイは以下スクリプトを監視対象サーバー上で直接実行します。
...
コンソールへ移動して、”サーバー→"新規サーバー登録"へ移動し"自動登録(通常はこちらを選択)"のStep2以降の手順に従いエージェントを監視対象サーバーへデプロイします。
監視対象サーバーのターミナルに、スクリプト文字列をroot権限にて実行します。ホスト名は自動設定されますが、手動設定したい場合は赤色の部分を変更して実行してください。
...
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)
Code Block |
---|
sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICETOKEN='****' sh |
ホスト名を手動設定する場合To setting the host name manually
Code Block |
---|
sudo curl -fsSL https://m.thingscale.io/agent/setup_servwatch_agent.sh | SERVWATCH_USERID='****' SERVWATCH_DEVICEID='<SET_YOUR_HOSTNAME>' SERVWATCH_DEVICETOKEN='****' sh |
サーバー管理ページに戻りエージェントの状態が”N/A”およびチャネルが”未登録”になっていれば正常に登録されています。
...
dockerコンテナへのエージェントデプロイ
dockerコンテナへエージェントをデプロイする場合は、コンテナ起動オプションを以下のようにしてください。
...
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)
Code Block |
---|
|
docker run -it -d --privileged --name centos7 centos:centos7 /sbin/init |
...
Uninstalling an agent
Expand |
---|
|
Uninstalling a Servwatch agentのアンインストールagent Code Block |
---|
pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent |
Warning |
---|
pm2 daemonのアンインストールはservwatch-agent以外のnodejsプログラムが動作していない時のみ以下手順にて実行してください。 servwatch-agent以外のプログラムが動作している場合は、お客様でご判断の上アンインストールを実行してください。 | pm2 daemonのアンインストール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 Code Block |
---|
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 |
|
Expand |
---|
title | CentOS7/Debian/Ubuntu/Amazon Linux2 |
---|
|
Uninstalling a Servwatch agentのアンインストールagent Code Block |
---|
pm2 stop servwatch_agent
rm -rf /opt/servwatch-agent |
Warning |
---|
pm2 daemonのアンインストールはservwatch-agent以外のnodejsプログラムが動作していない時のみ以下手順にて実行してください。 servwatch-agent以外のプログラムが動作している場合は、お客様でご判断の上アンインストールを実行してください。 | pm2 daemonのアンインストール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 Code Block |
---|
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 |
|
...