Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danilochilene/Pyora
Python script to monitor Oracle Databases
https://github.com/danilochilene/Pyora
database monitoring oracle oracle-database python sql zabbix
Last synced: 3 months ago
JSON representation
Python script to monitor Oracle Databases
- Host: GitHub
- URL: https://github.com/danilochilene/Pyora
- Owner: danilochilene
- Created: 2013-05-29T21:20:58.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-12-03T14:29:28.000Z (about 1 year ago)
- Last Synced: 2024-05-21T13:47:14.111Z (7 months ago)
- Topics: database, monitoring, oracle, oracle-database, python, sql, zabbix
- Language: Python
- Homepage: https://bicofino.io/post/monitoring-oracle-with-zabbix/
- Size: 60.5 KB
- Stars: 118
- Watchers: 20
- Forks: 81
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-oracledb - Pyora - Python script to monitor Oracle Databases. (Monitoring/Statistics/Perfomance / Zabbix)
README
Pyora
=====Python script to monitor oracle
Requirements
=====
cx-Oracle==8.2.1python-argparse
Note:Try installing python-argparse: `easy_install argparse` or `yum install python-argarse` on RHEL/Centos.
Tested with python 3.8, should work with any 3.x version. For Python2 version check python2 branch.
Create Oracle user for Pyora usage
=====
CREATE USER ZABBIX IDENTIFIED BY DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
GRANT UNLIMITED TABLESPACE TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
GRANT SELECT ON V_$SESSION TO ZABBIX;
GRANT SELECT ON V_$SYSTEM_EVENT TO ZABBIX;
GRANT SELECT ON V_$EVENT_NAME TO ZABBIX;
GRANT SELECT ON V_$RECOVERY_FILE_DEST TO ZABBIX;Usage
=====
» python3 pyora.py
usage: pyora.py [-h] [--username USERNAME] [--password PASSWORD]
[--address ADDRESS] [--database DATABASE]
{activeusercount,bufbusywaits,check_active,check_archive,commits,db_close,db_connect,dbfilesize,dbprllwrite,dbscattread,dbseqread,dbsize,dbsnglwrite,deadlocks,directread,directwrite,dsksortratio,enqueue,freebufwaits,hparsratio,indexffs,lastapplarclog,lastarclog,latchfree,logfilesync,logonscurrent,logprllwrite,logswcompletion,netresv,netroundtrips,netsent,query_lock,query_redologs,query_rollbacks,query_sessions,query_temp,rcachehit,redowrites,rollbacks,show_tablespaces,tablespace,tblrowsscans,tblscans,uptime,version}
...
pyora.py: error: too few arguments# Check Oracle version
0: python3 pyora.py --username pyora --password secret --address 127.0.0.1 --database DATABASE version
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi# Check Oracle active user count
0: python3 pyora.py --username pyora --password secret --address 127.0.0.1 --database DATABASE activeusercount
68# Show the tablespaces names in a JSON format
0: python3 pyora.py show_tablespaces
{
"data":[
{ "{#TABLESPACE}":"ORASDPM"},
{ "{#TABLESPACE}":"MDS"},
{ "{#TABLESPACE}":"SOADEV_MDS"},
{ "{#TABLESPACE}":"ORABAM"},
{ "{#TABLESPACE}":"SOAINF"},
{ "{#TABLESPACE}":"DATA"},
{ "{#TABLESPACE}":"MGMT_AD4J_TS"},
{ "{#TABLESPACE}":"MGMT_ECM_DEPOT_TS"},
{ "{#TABLESPACE}":"MGMT_TABLESPACE"},
{ "{#TABLESPACE}":"RECOVER"},
{ "{#TABLESPACE}":"RMAN_CAT"},
{ "{#TABLESPACE}":"SYSAUX"},
{ "{#TABLESPACE}":"SYSTEM"},
{ "{#TABLESPACE}":"TEMP"},
{ "{#TABLESPACE}":"UNDOTBS"},
{ "{#TABLESPACE}":"VIRTUALCENTER"},
]
}# Show a particular tablespace usage in %
0: python3 pyora.py --username pyora --password secret --address 127.0.0.1 --database DATABASE tablespace SYSTEM
92.45