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/ ...
随机推荐
- Java NIO系列教程(八)JDK AIO编程
目录: Reactor(反应堆)和Proactor(前摄器) <I/O模型之三:两种高性能 I/O 设计模式 Reactor 和 Proactor> <[转]第8章 前摄器(Proa ...
- 设计模式---对象性能模式之享元模式(Flyweight)
一:概念 通过与其他类似对象共享数据来减少内存占用 如果一个应用程序使用了太多的对象, 就会造成很大的存储开销. 特别是对于大量轻量级 (细粒度)的对象,比如在文档编辑器的设计过程中,我们如果为每个字 ...
- 跳到IE9的一个坑里了(枚举 JavaScript 属性)
有一段Json如下 [{"SaleName_ID":"0","SaleName":"","28":& ...
- PhotoshopCC2018安装流程以及破解
2018版增加了不少功能,也对优化PS软件进行了不少的优化,界面更加简洁美观 这里以64位为主. 1.首先下载好PhotoshopCC安装包和破解包,分别解压 2.解压完毕后,在安装包里面双击Setu ...
- 061、flannel的连通与隔离(2019-04-01 周一)
参考https://www.cnblogs.com/CloudMan6/p/7447716.html flannel网络连通性测试 不同host上的容器可以通过flannel网络进行通信,需要借助 ...
- 编辑距离算法以及它的C#实现
原文:https://www.cnblogs.com/shihuajie/p/5772173.html 注意,原文中有以下表述不当的地方 “扫描两字符串(n*m级的),如果:str1 == str2[ ...
- Ext.net获取选中行数据
两种方法 1.直接返回对象列表 <DirectEvents> <Click> <ExtraParams> <ext:Prameter Name="V ...
- json中带有\r\n处理
后台代码把换行符\r\n替换为\\r\\n,前台代码js收到的字符就是\r\n
- DevExpress Winform 常用控件
Ø 前言 DevExpress 控件的功能比较强大,是全球知名控件开发公司,对于开发 B/S 或 C/S 都非常出色,可以实现很炫且功能强大的效果. DevExpress Winform 常用控件是 ...
- GCC编译器原理(一)03------GCC 工具:gprof、ld、libbfd、libiberty 和libopcodes
1.3.7 gprof:性能分析工具 参考文档:https://www.cnblogs.com/andashu/p/6378000.html gprof是GNU profile工具,可以运行于linu ...