In the past I used Zabora to monitor Oracle, but for large environments was a pain to admin and let’s not talk about monitor tons of tablespaces. I tried to use other things like Orabbix but since is Java I preferred stay away.

Today Zabbix have some nice improvements like macros and Discovery, so we can set the database settings(user,password,database and such) on the host using macros and not hard code it on a script that you have to access a server to change it. Also if Zabbix already discovery disks and network interfaces why not Oracle tablespaces? Then Pyora was born:

Pyora is a clean python script that uses cx_Oracle library to fetch data from the database. To use Pyora you need Oracle client and the cx_Oracle. I’m assuming that you have both installed on your system, if you don’t have it you check this page and install it.

? git clone
Cloning into 'Pyora'...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 17 (delta 2), reused 16 (delta 1)
Unpacking objects: 100% (17/17), done.
» python                                                                                                    
usage: [-h] [--username USERNAME] [--password PASSWORD]
                [--address ADDRESS] [--database DATABASE]

                ... error: too few arguments

# Check Oracle version
0: python --username pyora --password secret --address --database DATABASE version
Oracle Database 10g Enterprise Edition Release - 64bi

# Check Oracle active user count
0: python --username pyora --password secret --address --database DATABASE activeusercount

# Show the tablespaces names in a JSON format
0: python show_tablespaces
    { "{#TABLESPACE}":"MDS"},
    { "{#TABLESPACE}":"ORABAM"},
    { "{#TABLESPACE}":"SOAINF"},
    { "{#TABLESPACE}":"DATA"},
    { "{#TABLESPACE}":"MGMT_AD4J_TS"},
    { "{#TABLESPACE}":"RMAN_CAT"},
    { "{#TABLESPACE}":"SYSAUX"},
    { "{#TABLESPACE}":"SYSTEM"},
    { "{#TABLESPACE}":"TEMP"},

# Show a particular tablespace usage in %
0: python --username pyora --password secret --address --database DATABASE tablespace SYSTEM

I have installed Pyora on Zabbix Server, so I have a centralized script to monitor all my Oracle databases.

Add the line below to the file /etc/zabbix_agentd.conf

UserParameter=pyora[*],/home/zabbix/scripts/ --username $1 --password $2 --address $3 --database $4 $5 $6 $7 $8

Create a new host for the database that you want to monitor:

{% img %}

Import the template zabbix-template/Pyora.xml to your new host.

Lets add a new host and configure the required macros HIGH is used to alarm tablespace usage in %

{$USERNAME} zabbix 
{$PASSWORD} zabbix 
{$HIGH}	90

Now you just have to wait and check later the information:

Remember that the tablespace discovery take one hour to complete.

The template still need some stuff but for now it works, if you have any question or want to contributed feel free to comment or send a pull over github. :)