OS Watcher (OSW) 安装、启动及开机自启动配置

OS Watcher (OSW) 安装、启动及开机自启动配置

 2020-05-15 
watch
 

根据操作系统版本分为两种,Linux 6之前、Linux 6及之后。

一、 Linux 6之前的OSW

1. 下载地址

文档 ID 301137.1(目前已不再提供下载)。可以网上搜,或者从其他安装了osw的服务器打包oswbb目录,到目标服务器解压即可。

2. 安装

解压tar包即可,无需额外操作。

1
tar -xvf oswbb.tar

3. 启动、检查及关闭

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#以下需先cd至解压目录
#后台启动(不加参数默认每30秒收集一次,数据保留48小时)
nohup ./startOSWbb.sh &

#带参数启动(后台启动,每30秒收集一次,数据保留168小时(7天))
nohup ./startOSWbb.sh 30 168 &

#带参数启动(前台启动)
./startOSWbb.sh 60 10

#指定归档目录
export OSWBB_ARCHIVE_DEST=/usr/app/archive
./startOSWbb 30 48 None /usr/app/archive

#是否启动osw
ps -ef |grep -i osw

#关闭
./stopOSWbb.sh

4. 配置开机自启动

Linux 6之前的osw不带开机自启动功能,需要自己写脚本并配置,方法如下:

编写osw启动脚本

1
2
3
4
5
6
7
vi /home/oracle/oswbb/auto_start_osw.sh
#内容如下
cd /home/oracle/oswbb
nohup ./startOSWbb.sh 30 168 &

# 加执行权限
chmod +x /home/oracle/oswbb/auto_start_osw.sh

设置服务器启动时执行该脚本

1
2
crontab -e
@reboot /home/oracle/oswbb/auto_start_osw.sh

二、 Linux 6及之后的OSW

1. 下载地址

文档 ID 301137.1,Linux 6开始报错了rpm包,有el6、el7版本

2. 安装

1
2
3
4
5
rpm -ivh oswatcher-7.3.3-2.el6.noarch.rpm

Preparing...                          ################################# [100%]
Updating / installing...
   1:oswatcher-7.3.3-2.el6            ################################# [100%]

3. 启动、检查及关闭

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#启动
/etc/init.d/oswatcher start
Starting oswatcher (via systemctl):  [  OK  ]

#检查
ps -ef |grep -i osw
root       590     1  0 03:13 ?        00:00:00 /bin/bash /sbin/OSWatcher -i 30 -m 48 -l /var/log/oswatcher/log /var/log/oswatcher
root       946 31065  0 03:14 pts/0    00:00:00 grep --color=auto -i osw

#目录结构
[root@localhost ~]# cd /var/log/oswatcher/archive/
[root@localhost archive]# ls
oswifconfig  oswmeminfo  oswnetstat  oswps        oswtop
oswiostat    oswmpstat   oswprvtnet  oswslabinfo  oswvmstat

4. 配置开机自启动

Linux 6开始osw自带开机自启动功能

查看是否开机自启动

1
2
3
chkconfig --list oswatcher
...
oswatcher       0:off   1:off   2:on    3:on    4:on    5:on    6:off

设置开机自启动

1
chkconfig oswatcher on
原文地址:https://www.cnblogs.com/yaoyangding/p/15713564.html