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/ ...
随机推荐
- python 函数动态参数,名称空间,global,nonlocal
##################################总结######################################动态参数 *args:位置参数动态传参,接收到的是元 ...
- Trailing slash
Trailing Slash common case It's common for URLs with a trailing slash to indicate a directory, and t ...
- C#下RSA算法的实现(适用于支付宝和易宝支付)
RSA算法代码: using System; using System.Collections.Generic; using System.Text; using System.IO; using S ...
- 【转载】C# 获取系统时间及时间格式
https://www.cnblogs.com/xjtrab/articles/1878353.html
- node 中 安装 yarn
Yarn是Facebook最近发布的一款依赖包安装工具.Yarn是一个新的快速安全可信赖的可以替代NPM的依赖管理工具 快速安装 //在NPM 中安装npm install -g yarn MacOS ...
- SQL Server进阶(六)表表达式--派生表、公用表表达式(CTE)、视图和内联表值函数
概述 表表达式是一种命名的查询表达式,代表一个有效地关系表.可以像其他表一样,在数据处理中使用表表达式. SQL Server支持四种类型的表表达式:派生表,公用表表达式,视图和内联表值函数. 为什么 ...
- Android开发最强模拟器Genymotion的安装及使用教程。附注释图详解
前沿 呵呵,笔者第一次在公开的博客网站写心得,想让自己的Android开发生涯留下点足迹,并且为自己做点笔记,如果该文章能帮到广大的Android小白朋友最好了(其实我也是一小白,(●'◡'●)) ...
- 多态(upcast)减少分支判断 以及 多态继承设计、具体类型判断。
Influenced by <java 八荣八耻>,翻了下<java编程思想> 印象中多态产生的条件:1.子类继承父类 2.父类[指针]指向子类 3.父类引用调用重写(@Ove ...
- l类与对象课后作业
java 的初始化规律 执行类成员定义时指定的默认值或类的初始化块,到底执行哪一个要看哪一个“排在前面”. 执行类的构造函数. 类的初始化块不接收任何的参数,而且只要一创建类的对象,它们就会被执行.因 ...
- JavaScript 小工具
1. 字符串格式化输出 支持形如: Orders of {1} or more {0}' {0},{1}代表第几个参数,包含了完善的异常处理.当给定参数少于格式化串中占位符个数时,未找到的直接留白. ...