-
Notifications
You must be signed in to change notification settings - Fork 4
Setting Up And Using the Elastic APM on Alfresco
Elastic APM provides an open source tool to quickly and easily visualize the health of our Alfresco installations. To use, you must first install:
- ElasticSearch
- Kibana
- APM Server
Once that is complete, you must download the proper version of the java agent from Maven Central. You won't be adding this jar as a dependency, but instead placing it on the Alfresco server and referencing it in your java options. Add the below to your Alfresco's java options (removing the brackets).
-javaagent:<path_to_java_agent_jar>
-
-Delastic.apm.service_name=<desired_service_name>
- for example your server name or "edge2", "release2", etc. -Delastic.apm.application_packages=com.tsgrp
-
-Delastic.apm.server_urls=<url_of_apm_server>
- for example, http://localhost:8200 locally
Now when Alfresco is started it will send data to the APM Server for all REST Controllers in com.tsgrp packages. View this by going to your Kibana installation and clicking on the APM tab.
If left alone, the APM indices will continue to grow until the server runs out of space (new indices are created every day). To combat this, use the built-in Index Lifecycle Management API to automatically delete indices when they reach a certain size or age. This example shows deleting APM-related indices after 30 days.
- Navigate to the "Dev Tools" tab
- Create a lifecycle policy
PUT _ilm/policy/apm_policy { "policy": { "phases": { "delete": { "min_age": "30d", "actions": { "delete": {} } } } } }
- Show existing index templates. Ensure the response includes a template that starts with "apm-".
GET _cat/templates
- Apply policy created to indices that start with "apm-"
PUT _template/apm_template { "index_patterns": ["apm-*"], "settings": { "number_of_shards": 1, "number_of_replicas": 1, "index.lifecycle.name": "apm_policy", "index.lifecycle.rollover_alias": "apm" } }
- All new APM indices created will now have the lifecycle applied.
If several APM indices have already been created before the policy was applied to the APM template, the existing indices will not be managed by the lifecycle automatically. To add them:
- Check the lifecycle status of the existing indices. Any that with the status
"managed" : false
are not currently managed.GET apm-*/_ilm/explain
- Set indices to non-read-only
PUT apm-*/_settings { "index.blocks.read_only_allow_delete": "false" }
- Set the lifecycle policy
PUT apm-*/_settings { "index.lifecycle.name": "apm_policy" }
- Set indices back to read-only
PUT apm-*/_settings { "index.blocks.read_only_allow_delete": "true" }
- Run the explain API again to ensure indices are now managed.
OpenContent (OC) © 2016 Technology Services Group