Monitoring Free Disk Space on Oracle E-Business Suite Instances in Oracle Cloud Infrastructure (OCI)

1. August 2023

Johannes Michler PROMATIS Horus Oracle


Executive Vice President – Head of Platforms & Development

Screenshot showing Disk Usage Metrics

Oracle E-Business Suite (EBS) is a critical application that requires careful monitoring to ensure optimal performance and prevent potential disruptions. One crucial aspect of monitoring EBS instances is keeping track of free disk space. In this guide, we will explore how to effectively monitor the free disk space on Oracle E-Business Suite instances running on Oracle Cloud Infrastructure (OCI). We'll use the "df" command to fetch disk space information and send it to OCI Monitoring as a custom metric, enabling you to proactively manage disk space and maintain a reliable EBS environment.

Unfortunately, while OCI Monitoring services allow out of the box monitoring of many aspects of the environment, there is no pre-built functionality to monitor the free space per local mount point / file system. Such monitoring is especially necessary when the E-Business Suite application server is a single node and not stored on File Storage Service (FSS). Fortunately, it is not necessary to setup a separate monitoring tool such as nagios or check_mk to fix that; it is possible to ingest arbitrary monitoring data into OCI as follows.

Step 1: Setup OCI CLI

To implement a custom metric and ingest it into the OCI Monitoring service, first of all you need to install and configure the OCI CLI as follows:

sudo yum install python36-oci-cli
oci setup config

Step 2: Gather free space in proper format

Use a script storage_json.sh as the following one to get the available space in proper JSON format:

COMPID=ocid1.compartment.oc1..xxxxxxxxxxx
srvname=`hostname`
my_namespace="ebs_promatis"
cur_date=`date -u +"%FT%T.000Z"`
df -m | grep -e "^/dev/" | tr -d '%' | gawk '
BEGIN { ORS = ""; print " [ "}
{ printf "%s{\"compartmentId\": \"'$COMPID'\",\"datapoints\": [{\"count\": 1,\"timestamp\": \"'$cur_date'\",\"value\": %s}],\"dimensions\": {\"server\": \"'$srvname'\",\"mountpoint\": \"%s\"},\"name\": \"diskusage\",\"namespace\": \"'$my_namespace'\"}",
separator, $5, $6
separator = ", "
}
END { print " ] " }'

You should replace COMPID in line 1 with the compartment ID of the instance monitored. As the namespace, you can use whatever is convenient.

Executing this script produces a json as follows:

Sample JSON output of the script based on df

Step 3: Upload the free space info to OCI

While the above storage_json.sh best resides on the server to be monitored, I prefer to have a central server that calls those scripts, has the OCI CLI installed and sends the metric data to the OCI Monitoring service. In an E-Business Suite context, it makes a lot of sense to do so on the E-Business Suite Cloud Manager VM.

Create a script monitor.sh as follows:

MONITOR_DATA=$(ssh ebsapp01.intern.promatis.de "sh storage_json.sh")
oci monitoring metric-data post --endpoint https://telemetry-ingestion.eu-frankfurt-1.oraclecloud.com --metric-data "$MONITOR_DATA"

Make the shell script executable using the following command:

chmod +x monitor.sh

Step 4: Schedule the Script as a Cron Job

To continuously monitor the disk space, you can schedule the shell script as a cron job to run at regular intervals (e.g., every 5 minutes):

crontab -e

Add the following line to the crontab file:

0,15,30,45 * * * * /home/oracle/oci_monitor/monitor.sh

This will run the script every 15 minutes and update the disk space metric in OCI Monitoring accordingly.

Step 5: Check the recorded data

After some time, enough data should be gathered and uploaded, so it is now time to have a look at the data using OCI Metrics Explorer:

Available File Storage in OCI Metrics Explorer

Step 6: Set Up Alarms

To be alerted when the free disk space falls below the defined thresholds, set up alarms in OCI Monitoring.

  1. Navigate to the OCI Monitoring service in the Oracle Cloud Console.
  2. Create new alarm rules based on your custom metric for free disk space.
  3. Define the thresholds for warning and critical levels as per your requirements.
  4. Configure notification channels to receive alerts (e.g., email, Slack, PagerDuty).

Summary

By using the "df" command and a custom shell script, you can directly fetch the available disk space information from your Oracle E-Business Suite instance and send it to OCI Monitoring as a custom metric. This approach simplifies the process while still allowing you to monitor free disk space effectively. With OCI Monitoring and custom metrics in place, you can proactively manage disk space and ensure the smooth operation of your EBS environment on Oracle Cloud Infrastructure. Happy monitoring!