- The added line is THIS COLOR.
- The deleted line is THIS COLOR.
#author("2023-06-03T00:40:14+09:00","default:kaw","kaw")
#author("2023-06-03T08:03:39+09:00","default:kaw","kaw")
*System Activity Grapher - インストール手順 [#q17f4773]
(編集中)
**rootでの作業 [#ec23c073]
最初に、ルート権限でSAGの実効に要なソフトと、SAG用のアカウントの作成を行います。
***gitのインストール [#m4f51c2e]
gitは、SAGをGitHubから取得するために要です。
# pkg_add git
quirks-6.121 signed 2023-06-01 07:54:26
quirks-6.121: ok
:
:
git-2.40.0: ok
The following new rcscripts were installed: /etc/rc.d/gitdaemon
See rcctl(8) for details.
New and changed readme(s):
/usr/local/share/doc/pkg-readmes/git
#
***gnuplotのインストール [#e3d77dd1]
# pkg_add git
SAGは、グラフの描画をgnuplotを使って行っているため、gnuplotをインストールします。~
インストールを開始すると、どのパッケージを使うか訊かれるので「1: gnuplot-5.2.7p1」を選択します。
# pkg_add gnuplot
quirks-6.121 signed 2023-06-01 07:54:26
Ambiguous: choose package for gnuplot
a 0: <None>
1: gnuplot-5.2.7p1
2: gnuplot-5.2.7p1-no_x11
Your choice: 1
gnuplot-5.2.7p1:readline-7.0p0: ok
:
:
gnuplot-5.2.7p1: ok
Running tags: ok
New and changed readme(s):
/usr/local/share/doc/pkg-readmes/glib2
***sagユーザの作成 [#jb9b1131]
SAGを実行するユーザ「sag」を作成します。
# adduser
:
:
Enter username []: sag
Enter full name []: System Activity Grapher
Enter shell csh git-shell ksh nologin sh [ksh]:
Uid [1000]:
Login group sag [sag]:
Login group is ``sag''. Invite sag into other groups: guest no
[no]:
Login class authpf bgpd daemon default pbuild staff unbound vmd xenodm
[default]:
Enter password []:
Enter password again []:
Name: sag
Password: ****
Fullname: System Activity Grapher
Uid: 1000
Gid: 1000 (sag)
Groups: sag
Login Class: default
HOME: /home/sag
Shell: /bin/ksh
OK? (y/n) [y]: y
Added user ``sag''
Copy files from /etc/skel to /home/sag
Add another user? (y/n) [y]: n
Goodbye!
#
**sagユーザでの作業 [#xe5ac3b1]
以降の作業はsagアカウントにて行います。
# su - sag
$
***SAGの取得と配置
GitHubより最新バージョンのSAGを取得します。
$ git clone https://github.com/ykaw/sag
Cloning into 'sag'...
remote: Enumerating objects: 515, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (48/48), done.
remote:nTotale515:(delta(40),5reused 66 (delta 33), pack-reused 423
Receiving objects: 100% (515/515), 368.37 KiB | 784.00 KiB/s, done.
Resolving deltas: 100% (229/229), done.
$ mv sag/.git sag/* $HOME
$ mv sag/.git sag/* ~
$ rmdir sag
***各種ファイルの編集 [#vadf7e23]
gnuplotのシンボリックリンクを作成
$ ln -s `which gnuplot` ~/bin
設定ファイルの編集
$ cd ~/conf
$ cp examples/dfplot.gp examples/netcmd.sh examples/postgproc.sh examples/shconf.sh .
dfplot.gpの編集
$ vi dfplot.gp
編集内容
# definitions of disk partitions
#
# $Id: dfplot.gp,v 1.2 2017/01/07 06:10:54 kaw Exp $
#
# This file will included from $SAGHOME/plot/gen0100df.gp
# Reconfigure following to fit to the disk layout.
plot "sumtmp-0100df" using 1:3 title "RDROOT", \ <--+ この部分を
"sumtmp-0100df" using 1:4 title "LIVEMEDIA", \ | 実際のパーティション
"sumtmp-0100df" using 1:5 title "SYSTEM", \ | 構成に合うように
"sumtmp-0100df" using 1:6 title "WRITABLE" <--+ 編集
netcmd.shの編集
$ vi netcmd.sh
編集内容
# a command line to get i/f name, send/receive bytes
# then print them out
#
# this command will eval-ed by $SAGHOME/bin/t0001
#
# $Id: netcmd.sh,v 1.3 2021/10/05 02:29:26 kaw Exp $
netcmd='set $(netstat -I bce0 -b -n -i); echo $7 ${11} ${12}'
~~~~ここを実際のインターフェース名に変更
postgproc.shの編集
$ vi postgproc.sh
編集容
#!/bin/sh
# processes after generating graphs
# This script will be called by $SAGHOME/bin/t0100
#
# $Id: postgproc.sh,v 1.3 2021/10/04 15:26:38 kaw Exp $
# To enable this,
# # Make next line commented.
# exit 0 <--この行をコメント化する
# and follwing lines uncommented
#
# sample of post process
sleep 60 <--この行以降をアンコメントする
cp $SAGHOME/var/*.png /var/www/htdocs/sag/.
shconf.shの編集
$ vi shconf.sh
編集内容
# shconf.sh - shell variable configuration for SAG
#
# $Id: shconf.sh,v 1.3 2021/10/04 15:22:35 kaw Exp $
# categories to process data
#
targets='0001la 0001net 0005mem 0100df 0100time 0005timeofs'
# days to store data
#
rotate_max=64 <--ファイルに保存する日数
# days to display graph <--グラフに描画する日数
#
span_la=8
span_net=8
span_mem=8
span_df=32
span_time=32
span_timeofs=8
グラフ描画関連のセットアップ
$ cd ~/plot
$ cp examples/common.gp examples/gen* .
$ vi common.gp
ファイル置場の作成
$ mkdir ~/var
**rootでの作業 [#n20828a3]
$ exit
# cd ~sag/conf/examples/
# crontab -l > crontab.orig
# cat crontab.orig crontab-root | crontab
# cat crontab.orig crontab-root | crontab -
/etc/rc.localの編集
# cat rc.local >> /etc/rc.local
# vi /etc/rc.local
編集内容
# for System Activity Grapher
# Add this to /etc/rc.local
#
# $Id: rc.local,v 1.2 2017/01/07 06:10:54 kaw Exp $
su -l sag -c 'PATH-TO-CMD/bin/addgap' # Rewrite to the real location.
~~~~~~~~~~~実際のパスに書換え
# setups for ntp monitoring
#
touch /tmp/ntpctl.out
chown sag:sag /tmp/ntpctl.out
chmod 0640 /tmp/ntpctl.out
sagユーザのcrontabを設定
sagユーザのcrontabを有効化
# crontab -u sag ~sag/conf/examples/crontab
***ウェブサーバ関連の設定 [#i8d73277]
以下は、SAGが生成したグラフをウェブブラウザで閲覧するための設定です。~
グラフの画像ファイルを画像ビューアで直接見る場合は要ありません。
postgproc.shの編集~
sagユーザ権限で行います
# su - sag
$ vi ~/conf/postgproc.sh
編集容
#!/bin/sh
# processes after generating graphs
# This script will be called by $SAGHOME/bin/t0100
#
# $Id: postgproc.sh,v 1.3 2021/10/04 15:26:38 kaw Exp $
# To enable this,
# # Make next line commented.
# exit 0 <--この行をコメント化する
# and follwing lines uncommented
#
# sample of post process
sleep 60 <--この行以降をアンコメントする
cp $SAGHOME/var/*.png /var/www/htdocs/sag/.
$ exit
#
関連ファイルのセットアップ
# mkdir /var/www/htdocs/sag
# cp index.html /var/www/htdocs/sag
# chown -R sag:sag /var/www/htdocs/sag
# vi /etc/httpd.conf
編集容
server "example.com" {
listen on * port 80
}
ウェブサーバの起動
# rcctl enable httpd
# rcctl start httpd
----
| ←[[SAG/概要]] | ↑[[SAG TOP>SAG]] | [[SAG/運用]]→ |