System Activity Grapher - インストール手順

(編集中)

rootでの作業

gitのインストール

# 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のインストール

# pkg_add git
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ユーザの作成

# 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ユーザでの作業

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
$ rmdir sag

各種ファイルの編集

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での作業

# cd ~sag/conf/examples/
# crontab -l > crontab.orig
# 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を設定

# crontab -u sag ~sag/conf/examples/crontab


Front page   New Page list Search Recent changes   Help   RSS of recent changes