[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-30。"],[],[],null,["# Apache ActiveMQ\n\nThe Apache ActiveMQ integration writes logs and collects storage usage and\nmessage metrics. Storage metrics include memory and disk usage.\nMessage metrics include number of waiting messages, average wait time,\nand expired messages.\n\nFor more information about ActiveMQ, see the\n[Apache ActiveMQ documentation](https://activemq.apache.org/).\n\nPrerequisites\n-------------\n\nTo collect ActiveMQ telemetry, you must\n[install the Ops Agent](/logging/docs/agent/ops-agent/install-index):\n\n- For metrics, install version 2.11.0 or higher.\n- For logs, install version 2.15.0 or higher.\n\nThis integration supports ActiveMQ versions Classic 5.8.x through 5.16.x and Artemis 2.x.\n\nConfigure your ActiveMQ instance\n--------------------------------\n\nYou must enable JMX support in the ActiveMQ [broker\nconfiguration](https://activemq.apache.org/jmx).\n\nConfigure the Ops Agent for ActiveMQ\n------------------------------------\n\nFollowing the guide to [Configure the Ops\nAgent](/logging/docs/agent/ops-agent/configuration#file-location), add the required elements\nto collect telemetry from ActiveMQ instances, and\n[restart the agent](/logging/docs/agent/ops-agent/installation#restart).\n\n### Example configuration\n\nThe following commands create the configuration to collect and ingest telemetry\nfor ActiveMQ: \n\n # Configures Ops Agent to collect telemetry from the app. You must restart the agent for the configuration to take effect.\n\n set -e\n\n # Check if the file exists\n if [ ! -f /etc/google-cloud-ops-agent/config.yaml ]; then\n # Create the file if it doesn't exist.\n sudo mkdir -p /etc/google-cloud-ops-agent\n sudo touch /etc/google-cloud-ops-agent/config.yaml\n fi\n\n # Create a back up of the existing file so existing configurations are not lost.\n sudo cp /etc/google-cloud-ops-agent/config.yaml /etc/google-cloud-ops-agent/config.yaml.bak\n\n # Configure the Ops Agent.\n sudo tee /etc/google-cloud-ops-agent/config.yaml \u003e /dev/null \u003c\u003c EOF\n metrics:\n receivers:\n activemq:\n type: activemq\n service:\n pipelines:\n activemq:\n receivers:\n - activemq\n EOF\n\nFor these changes to take effect, you must restart the Ops Agent: \n\n### Linux\n\n1. To restart the agent, run the following command on your instance: \n\n ```\n sudo systemctl restart google-cloud-ops-agent\n ```\n2. To confirm that the agent restarted, run the following command and verify that the components \"Metrics Agent\" and \"Logging Agent\" started: \n\n ```\n sudo systemctl status \"google-cloud-ops-agent*\"\n ```\n\n### Windows\n\n1. Connect to your instance using RDP or a similar tool and login to Windows.\n2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting **Run as Administrator**\n3. To restart the agent, run the following PowerShell command: \n\n ```\n Restart-Service google-cloud-ops-agent -Force\n ```\n4. To confirm that the agent restarted, run the following command and verify that the components \"Metrics Agent\" and \"Logging Agent\" started: \n\n ```\n Get-Service google-cloud-ops-agent*\n ```\n\n### Collect logs\n\nActiveMQ writes logs to `syslog`, which is captured by the Ops Agent by default.\nNo additional user configuration is required.\n\n### Configure metrics collection\n\nTo ingest metrics from ActiveMQ, you must create a receiver for the metrics\nthat ActiveMQ produces and then create a pipeline for the new receiver.\n\nThis receiver does not\nsupport the use of multiple instances in the configuration, for example, to\nmonitor multiple endpoints. All such instances write to the same time series,\nand Cloud Monitoring has no way to distinguish among them.\n\nTo configure a receiver for your `activemq` metrics, specify the following\nfields:\n\n#### What is monitored\n\nThe following table provides the list of metrics that the Ops Agent collects\nfrom the ActiveMQ instance.\n\n\nVerify the configuration\n------------------------\n\nThis section describes how to verify that you correctly configured the\nActiveMQ receiver. It might take one or two\nminutes for the Ops Agent to begin collecting telemetry.\n\nTo verify that ActiveMQ logs are being sent to\nCloud Logging, do the following:\n\n1. In the Google Cloud console, go to the **Logs Explorer** page:\n\n [Go to **Logs Explorer**](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n2. Enter the following query in the editor, and then click **Run query** : \n\n ```\n resource.type=\"gce_instance\"\n log_id(\"syslog\")\n jsonPayload.message~='(activemq[[0-9]+]|activemq):'\n ```\n\n\u003cbr /\u003e\n\nTo verify that ActiveMQ metrics are being sent to\nCloud Monitoring, do the following:\n\n1. In the Google Cloud console, go to the\n *leaderboard* **Metrics explorer** page:\n\n [Go to **Metrics explorer**](https://console.cloud.google.com/monitoring/metrics-explorer)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the query-builder pane, select the button whose name is either *code* **MQL** or *code* **PromQL**.\n3. Verify that **PromQL** is selected in the **Language** toggle. The language toggle is in the same toolbar that lets you format your query.\n4. Enter the following query in the editor, and then click **Run query** : \n\n ```\n {\"workload.googleapis.com/activemq.consumer.count\", monitored_resource=\"gce_instance\"}\n ```\n\n\u003cbr /\u003e\n\nView dashboard\n--------------\n\nTo view your ActiveMQ metrics, you must have a chart or dashboard\nconfigured.\n\nThe ActiveMQ integration includes one or more dashboards for you.\n\nAny dashboards are automatically installed after you configure the\nintegration and the Ops Agent has begun collecting metric data.\n\nYou can also view static previews of dashboards without\ninstalling the integration.\n\nTo view an installed dashboard, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Select the **Dashboard List** tab, and then choose the **Integrations** category.\n3. Click the name of the dashboard you want to view.\n\n\u003cbr /\u003e\n\nIf you have configured an integration but the dashboard has not been\ninstalled, then check that the Ops Agent is running. When there is no\nmetric data for a chart in the dashboard, installation of the dashboard fails.\nAfter the Ops Agent begins collecting metrics, the dashboard is installed\nfor you.\n\nTo view a static preview of the dashboard, do the following:\n\n1. In the Google Cloud console, go to the\n **Integrations**\n page:\n\n [Go to **Integrations**](https://console.cloud.google.com/monitoring/integrations)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Click the **Compute Engine** deployment-platform filter.\n3. Locate the entry for ActiveMQ and click **View Details**.\n4. Select the **Dashboards** tab to see a static preview. If the dashboard is installed, then you can navigate to it by clicking **View dashboard**.\n\n\u003cbr /\u003e\n\nFor more information about dashboards in Cloud Monitoring, see\n[Dashboards and charts](/monitoring/dashboards).\n\nFor more information about using the **Integrations** page, see\n[Manage integrations](/monitoring/agent/integrations).\n\nInstall alerting policies\n-------------------------\n\nAlerting policies instruct Cloud Monitoring to notify you when\nspecified conditions occur.\n\nThe ActiveMQ integration includes one or more alerting policies for\nyou to use.\n\nYou can view and install\nthese alerting policies from the **Integrations** page in\nMonitoring.\n\nTo view the descriptions of available alerting policies and\ninstall them, do the following:\n\n1. In the Google Cloud console, go to the\n **Integrations**\n page:\n\n [Go to **Integrations**](https://console.cloud.google.com/monitoring/integrations)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Locate the entry for ActiveMQ and click **View Details**.\n3. Select the **Alerts** tab. This tab provides descriptions of available alerting policies and provides an interface for installing them.\n4. Install alerting policies. Alerting policies need to know where to send notifications that the alert has been triggered, so they require information from you for installation. To install alerting policies, do the following:\n 1. From the list of available alerting policies, select those that you want to install.\n 2. In the **Configure notifications** section, select one or\n more notification channels. You have the option to disable the\n use of notification channels, but if you do, then your alerting\n policies fire silently. You can check their status in\n Monitoring, but you receive no notifications.\n\n For more information about notification channels,\n see [Manage\n notification channels](/monitoring/support/notification-options).\n 3. Click **Create Policies**.\n\n\u003cbr /\u003e\n\nFor more information about alerting policies in Cloud Monitoring, see\n[Introduction to alerting](/monitoring/alerts).\n\nFor more information about using the **Integrations** page, see\n[Manage integrations](/monitoring/agent/integrations).\n\nWhat's next\n-----------\n\nFor a walkthrough on how to use Ansible to install the Ops Agent, configure\na third-party application, and install a sample dashboard, see the\n[Install the Ops Agent to troubleshoot third-party applications](https://www.youtube.com/watch?v=GQgNygd-XJU&t=7s) video."]]