Search This Blog

Friday 19 October 2012

Create a UDM in Oracle Grid Control

The Oracle Grid Control provides us very powerful functionaly to create a User-Defined Metrics (UDM) that we can use to collect any additional information from any target host and build statistics graphs based on this data. I will decribe bellow an example how to create a UDM to be able to gather memory usage on the host.
Preparing a scrip/command to get the "used" column of the Linux "free" command.
mkdir /tmp/test.sh
chmod a+x /tmp/test.sh
add the following command to the /tmp/test.sh
/usr/bin/free | grep Mem | awk '{ print $3 }' | awk 'END {print line} { line = line "em_result=" $0 }'
The script will return the value for em_result variable like this:
em_result=32830100
Create a new GC UDM for the host where you placed the script.
Metric Name Memory_Used
Command Line: /bin/ksh /tmp/test.sh
Start: Immediately after creation
Frequency: Repeat every 5 mins(for example).
The GC will be gather this data like all other metrics and it will be possible create Chart from SQL based on this data.
The SQL statement that can be used to get data to build "Chart from SQL" graphs:
select decode(column_label,'Memory_Used','Memory Used (MB)'),COLLECTION_TIMESTAMP, value
from mgmt$metric_details
where target_type = 'host'
and target_name='hostname'
and column_label = 'Memory_Used' and METRIC_TYPE=0
AND COLLECTION_TIMESTAMP >= ??EMIP_BIND_START_DATE??
AND COLLECTION_TIMESTAMP <= ??EMIP_BIND_END_DATE??
order by COLLECTION_TIMESTAMP

No comments:

Post a Comment