When working on the implementation of monitoring via Oracle Enterprise Manager, it is sometimes necessary to perform several tests with different thresholds in order to refine alerting, or simply to verify that the monitoring is working properly.
The main problem is that you have to wait until the collection is done to see the result. Since most metrics have a “Collection Schedule” of more than 5 minutes, this can quickly become a waste of time.
To avoid this wait, it is possible to force the collection of a particular metric for a target directly from the EM agent.
Command line
The first way, and the one I prefer because it can be used even when you don’t know the password of the Linux account that owns the agent or the root account is the command line.
First, we connect to the server where the agent is located, and we retrieve the list of activated collections for each targets:
# cd /u01/app/oracle/product/emagent/agent_13.4.0.0.0/bin
# ./emctl status agent scheduler
[...]
2021-10-30 07:58:00.258 : oracle_listener:LISTENER_oralab01:Response
2021-10-30 08:01:35.613 : host:oralab01:FilesystemsLinux
[...]
The command will return a list of all planned metrics collections in this format:
“Schedule Time” : “Target type”:”Target name”:”Metric name”
The name of the metric is not always clear, but most are understandable, or can be understood by deduction. In my example, it is the “Reponse Time” for the listener and “Filesystem Usage” for the server.
Once you have this information, you can run the collection manually using the “control agent runCollection” command. Care must be taken with the positioning of the arguments. With this command, they must be given in the format “Target name”:”Target type” “Metric name”:
# ./emctl control agent runCollection oralab01:host NetworkLinux
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
EMD runCollection completed successfully
# ./emctl control agent runCollection LISTENER_oralab01:oracle_listener Response
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
EMD runCollection completed successfully
Web interface
This feature is not well known, but the EM agents have a web interface. It is quite simplistic but it allows for example to force the collection of a metric.
First, you need to get the “Agent URL” of your agent. This information is visible from the OEM console, or with the “emctl status agent” command:
# ./emctl status agent
[...]
Agent URL : https://oralab01:3872/emd/main/
---------------------------------------------------------------
Agent is Running and Ready
To access the web interface from your web browser, just add “/browser” before “/main” in the URL. In my case: https://oralab01:3872/emd/browser/main/
Once on the page, you need to enter the login information: “root” account or EM agent owner account:
A page is displayed with the list of all monitored targets:
To force the collection of a metric, simply click on the “CollectionItems” link for the desired target:
And click on the metric for which you want to force the collection:
The column “collection status” must be equal to “successful collection”.
That’s all 🙂