1.安装cx_Oracle
a.官网下载客户端组件包
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
1、下载镜像
docker pull georce/lepus
docker run -d --name=lepus -p 32800:80 -p 32799:3306 georce/lepus
docker ps
进入docker bash
sudo docker exec -it lepus /bin/bash
echo $TERM
export TERM=dumb
echo $TERM
export TERM=dumb
oracle 监控:
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
vi ~/.bash_profile
添加:
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib/:$LD_LIBRARY_PATH
source ~/.bash_profile ##生效
vi /etc/ld.so.conf.d/oracle.conf
添加:
/usr/lib/oracle/12.2/client64/lib/
执行ldconfig ##生效
vi /etc/profile.d/oracle.sh
添加:
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export PATH=$PATH:$ORACLE_HOME/bin
export PATH=$PATH:$ORACLE_HOME/lib
chmod +x /etc/profile.d/oracle.sh
/etc/profile.d/oracle.sh ##生效
ln -s /usr/include/oracle/12.2/client64 $ORACLE_HOME/include
ln -s /usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1 libclntsh.so.11.1
检查环境是否配置完成:echo $ORACLE_HOME
pip --trusted-host pypi.python.org --trusted-host pypi.tuna.tsinghua.edu.cn install xxxxx -i Simple Index
tar jxvf Python-2.7.5.tar.bz2 cd Python-2.7.5 ./configure make make install 注意: 安装python之前,最好确认一下gcc是否安装。yum install -y gcc 否则./configure 阶段就会报错 更改系统默认的python: 建立软连接,使系统默认的python指向python2.7 正常情况下即使python2.7安装成功后,系统默认指向的python仍然是2.6版本,而yum是基于python2.6才能正常工作。所以要将系统默认的python指向到2.7版本。 # /usr/local/bin/python2.7 -V # mv /usr/bin/python /usr/bin/python.bak # ln -s /usr/local/bin/python2.7 /usr/bin/python 运行一下python,或者: # python -V 修正yum报错: 如果打yum命令,你会发现报错了。提示你可能是python版本不对。所以我们要把yum依旧指向老的python2.6版本: vi /usr/bin/yum 在打开的文件里的头一行,也就是指定python环境的那行代码,修改成: #!/usr/bin/python2.6 python第三方包的安装位置: /usr/local/lib/python2.7/site-packages/ ———————————————— 版权声明:本文为CSDN博主「常城」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/chenggong2dm/article/details/9100591 |
tar -xzvf cx_Oracle-5.1.2.tar.gz
cd cx_Oracle-5.1.2
python setup.py install
[root@lepus lepus]# python
Python 2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>>
python test_driver_oracle.py
import cx_Oracle conn=cx_Oracle.connect('xx/xx@xx:1521/xx') sql="select FILE_NAME,TABLESPACE_NAME from dba_data_files" curs = conn.cursor() result = curs.execute(sql) g = lambda k:"%-8s" % k i=1 for row in result.fetchmany(2): print str(i)+'\t', for k in map(g,row): print k+'\t', print i+=1 curs.close() quit() |
1.在需要监控的linux系统下snmp服务配置 注意事项:如果第二个rpm包出现冲突,删除原有的冲突包即可! https://rpm.pbone.net/resultsb_dist_94_size_329244_name_net-snmp-5.7.2-28.el7_4.1.x86_64.rpm.html 1.1snmpd 服务安装 安装snmp服务需要的rpm包: rpm -ivh --replacefiles --force --nodeps net-snmp-libs-5.7.2-28.el7_4.1.x86_64.rpm rpm -ivh --replacefiles --force --nodeps net-snmp-utils-5.7.2-28.el7_4.1.x86_64.rpm rpm -ivh --replacefiles --force --nodeps lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64.rpm rpm -ivh --replacefiles --force --nodeps lm_sensors-devel-3.4.0-4.20160601gitf9185e5.el7.x86_64.rpm rpm -ivh --replacefiles --force --nodeps net-snmp-agent-libs-5.7.2-28.el7_4.1.x86_64.rpm rpm -ivh --replacefiles --force --nodeps net-snmp-5.7.2-28.el7_4.1.x86_64.rpm |