aix安装nmon
aix5310以上都系统自带了nmon,其他低版本需要手动安装
软件包下载地址https://www.ibm.com/developerworks/community/wikis/home?lang=en#/wiki/Power%20Systems/page/nmon
安装脚本如下
import os
from subprocess import Popen, PIPE, STDOUT
import sys
import platform
import shutil def run_cmd(cmd, cwd=None, env=None, run_as=None):
if not sys.platform.startswith('win') and run_as and run_as != 'root':
cmd = 'su - {} -c "{}"'.format(run_as, cmd)
p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, stdin=PIPE, cwd=cwd, env=env)
stdout, _ = p.communicate()
return p.returncode, stdout.strip() if 'aix' not in platform.platform().lower():
print '只支持aix系统的安装,该机器不是aix系统'
sys.exit(1) cmd = 'oslevel -r'
version_list={'5':5309,'6':6102,'7':7000}
code, res = run_cmd(cmd)
if not code and res:
key=res[0].strip()
value=res.split('-')[1].strip()
if version_list.get(key) and int(key+res[1].strip()+value)>=version_list.get(key):
print '当前版本是',res
else:
print '当前版本是',res,'该操作只支持5309+,6102+,7100+的版本'
sys.exit(1)
else:
print '获取版本失败'
sys.exit(1) cmd = 'ps -ef |grep nmon|grep -v grep'
code, res = run_cmd(cmd)
if res:
print '已有nmon在运行'
sys.exit(1) cmd = 'which nmon'
code, res = run_cmd(cmd)
if code:
print '该系统未安装nmon'
sys.exit(1) if not os.path.exists(data_path):
os.makedirs(data_path) def is_empty(path):
for root, dirs, files in os.walk(path):
if len(files) != 0:
return False
return True cronfile = '/var/spool/cron/crontabs/root'
run_cmd('cp {0} /tmp/crontab_root.`date +%F_%T`'.format(cronfile)) content = '0 0 * * * nmon -fT -m {0} -s {1} -c {2}\n' \
'0 0 * * * find {1} -mtime +{3} -name "*.nmon" -exec rm -rf {{}} \;\n'.format(data_path, save_day, count,gap_time) has_content=False
if not os.path.exists(cronfile):
with open(cronfile, 'w') as f:
f.writelines(['### for nmon install ###\n',content,'### for nmon install ###\n'])
else:
real_content=[]
with open(cronfile, 'r') as f:
raw_content = f.readlines() flag=0
for i in raw_content:
flag = flag % 2
if '### for nmon install ###' in i.strip():
flag += 1
if flag==0:
real_content.append(i) with open(cronfile, 'w') as f:
f.writelines(real_content)
with open(cronfile, 'a') as f:
f.writelines(['### for nmon install ###\n',content,'### for nmon install ###\n']) print '安装并配置成功'
aix安装nmon的更多相关文章
- AIX安装恢复oracle问题-内存不足
AIX安装恢复oracle问题-----------------------2013/10/19 oracle 安装后后,进行rman恢复数据库时,启动不了dummy实例,报内存不足 RMAN&g ...
- 手把手教你安装nmon
一.nmon简介 nmon是由IBM 提供.免费监控 AIX 系统与 Linux 系统资源的工具.该工具可帮助在一个屏幕上显示服务器系统资源耗用情况,并动态地对其进行更新.此外,他还可以利用 exce ...
- 现场故障案例:AIX安装Oracle10G runInstaller弹出错误一例
AIX安装Oracle10G runInstallert弹出错误一例 环境: 系统:AIX5300-08 数据库:Oracle 10g(64bit) AIX客户机卸载oracle软件后,又一次安装or ...
- HDLM for AIX安装
HDLM for AIX安装 1) 安装ODM补丁包 补丁包在软件介质光盘的\HDLM_AIX\AIX_ODM\HTC_ODM下面:HTCODM3.tar 解压:#tar -xvf HCODM3 ...
- centos7下安装nmon后,无法运行,提示 cannot execute binary file或/lib64/ld64.so.1不存在
在centos 7.1上安装nmon后,从管网(http://nmon.sourceforge.net/pmwiki.php?n=Site.Download)下载tar包解压后,两台机器一台提示 ca ...
- AIX安装单实例11gR2 GRID+DB
AIX安装单实例11gR2 GRID+DB 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以 ...
- CentOS6.4 安装nmon
安装 mkdir /usr/local/nmon cd /usr/local/nmon wget http://sourceforge.net/projects/nmon/files/nmon_lin ...
- 分享一下 aix安装python提示C编译器问题的办法
今天在AIX上面安装Python-2.7.2时失败,报下面的错误 checking for --enable-universalsdk... no checking for --with-univer ...
- aix 安装redis
下载最新rpm安装包 http://www.perzl.org/aix/index.php?n=Main.Redis # uname -aAIX rhjf 1 6 00C5CC964C00# pwd/ ...
随机推荐
- Kafka技术内幕 读书笔记之(五) 协调者——消费者加入消费组
消费者客户端轮询的3个步骤:发送拉取请求,客户端轮询,获取拉取结果 . 消费者在发送拉取请求之前,必须首先满足下面的两个条件.- 确保消费者已经连接协调者, 即找到服务端中管理这个消费者的协调者节点 ...
- linux chmod命令使用
chmod:更改文件9个属性 Linux文件属性有两种设置方法,一种是数字,一种是符号. Linux文件的基本权限就有九个,分别是owner/group/others三种身份各有自己的read/wri ...
- OPCServer:使用Matrikon OPC Server Simulation
实验用模拟OPCServer 旧版(50M):Matrikon OPC Server Simulation(v1.5.0.0),百度网盘,密码: mcur 新版(157M):Matrikon OPC ...
- windows平台在tomcat中启动cas报错解决
windows平台在tomcat中启动cas报错: Caused by: java.lang.UnsatisfiedLinkError: Could not load library. Reasons ...
- tcp_listen函数
#include <netdb.h> #include <unistd.h> #include <stddef.h> #include <strings.h& ...
- HTTP访问控制(CORS)
当一个资源从与该资源本身所在的服务器不同的域或端口请求一个资源时,资源会发起一个跨域 HTTP 请求. 比如,站点 http://domain-a.com 的某 HTML 页面通过 <img ...
- cygwin 安装包管理器 apt-cyg
https://github.com/transcode-open/apt-cyg apt-cyg is a simple script. To install: lynx -source https ...
- 《第一行代码-李兴华》-10.3 System类
10.3 System类 视频地址:System类 /** * * 统计某项操作执行时间 * */ long start = System.currentTimeMillis();//返回以毫秒为单位 ...
- Mybatis-利用resultMap 输出复杂pojo
个:复杂的sql语句查询的数据集的字段和 pojo的字段不相同,需要用到resultMap做一个对应. ---------------- mybatis中使用resultMap完成高级输出结果映射. ...
- 对象转换为json格式,类似中间层API
<一头扎进SpringMvc视频教程\<一头扎进SpringMvc>第四讲 源码\> 对象自动转换为json格式要在 spring-mvc.xml添加一个东西 ,和对应的命名空 ...