Process monitoring is available now in Stack Monitoring .You can monitor a process running or not and its CPU,Memory(Physical,Virtual) utilisation as well.
Recently UI has been added to create the process set as well .
If you are using cli make sure you are using oci cli ≥ 3.37.5 and follow the steps.
- Create a process set using oci cli
2. Create a discovery job using oci cli
Lets see an example to monitor python3 process running as any user.
Create a file named pythonprocess.json in /tmp directory.
label → Any meaningful name for the specific process
processCommand → should match with the process name in this case python3
processLineRegexpattern → Regex pattern to match process args/command line
processUser → User who is running the process (Did not specify this to monitor any user running python3)
{
"compartmentId": "<Compartment_OCID>",
"displayName": "python3processes",
"specification": {
"items": [
{
"label": "openmetrics",
"processCommand": "python3",
"processLineRegexPattern": "openmetrics."
},
{
"label": "nfsclient",
"processCommand": "python3",
"processLineRegexPattern": "nfsclient."
}
]
}
}
oci stack-monitoring process-set create -c <Compartment_OCID> — from-json file:///tmp/pythonprocess.json
NOTE : There are two hyphens before from-json in the above command
Run the above command to create a process set.Note down the process set ocid in the cli output which will be needed in the next step.
“id”: “ocid1.stackmonitoringprocessset.oc1……..
We also need the host resource OCID and agent OCID for the discovery job.
You can get these details when you click on the host which is monitored by Stack monitoring . Navigate to Stack monitoring homepage → All Resources and apply the filter Type to Host
Click on the host where the process is running to find the details. Below is an example
Click on Related Resources to know the agent monitoring the host
{
"discoveryType": "ADD",
"discoveryClient": "APPMGMT",
"compartmentId": "<Compartment_OCID>",
"discoveryDetails": {
"agentId": "<Agent_OCID>",
"resourceType": "CUSTOM_RESOURCE",
"resourceName": "nginx processes",
"properties": {
"propertiesMap": {
"host_ocid": "<Host_OCID>",
"process_set_id": "<ProcessSet_OCID>"
}
},
"license": "ENTERPRISE_EDITION"
},
"freeformTags": {},
"definedTags": {}
}
Create a file named discovery.json with required details like agent ocid,host OCID and compartment OCID .
oci stack-monitoring discovery-job create -c <Compartment_OCID> — from-json file:///tmp/discovery.json
You should see a discovery job getting executed and it should succeed.
Click on the custom resource which was discovered successfully. You will get the details about the process monitored.
Reference Doc: Process Set
You can create an alarm when the process is down or the CPU,Memory utlization is more . For all the metrics available for Process-based Custom Resource refer this doc.
Choose oracle_appmgmt metric_namespace and custom_resource resource group to see the related metrics in metrics explorer.