Troubleshooting Agent Installation

This page helps you diagnose problems in the installation or running of the Stackdriver Monitoring agent.

Checklist

If you are having trouble installing or using the Stackdriver Monitoring agent, here are some things to check:

  • If installation commands result in errors, then make sure that on Linux you prefix the installation commands with sudo.

  • On Linux, make sure you include the flag --write-gcm on the install script.

  • If you're not sure if the agent daemon process is running on your Linux VM instance, then use the following command:

    sudo service stackdriver-agent status
    

    If the agent is not running, you might need to restart it. On Linux, use the following command:

    sudo service stackdriver-agent restart
    

    If the restart fails, reinstall the agent. See the following section, Reinstalling the agent.

  • See if the agent daemon has written error messages to the logs. The Monitoring agent on Linux is a collectd package and it logs messages to /var/log/syslog or /var/log/messages. The log messages are prefixed by collectd or stackdriver-agent:

  • If you see HTTP 429 errors, you might have exceeded your Stackdriver Monitoring API quotas. You can see your available quota by selecting APIs & services > Dashboard in the Cloud Platform Console. Choose the Stackdriver Monitoring API.

  • If you see proxy problems, check that you correctly configured you HTTP proxy. The instructions are part of Installing on Linux or Installing on Windows.

  • If you see API access or authorization problems, see the following section, Verifying project and credentials.

  • If the agent seems to be running normally, but you are not getting data or your alerting policies are not acting as you think they should, then you should check that the agent is sending data to the correct project. See the following section, Verifying project and credentials.

Verifying project and credentials

If the agent is reporting access or authorization errors, or if the agent seems to be running normally but there is no data or your alerting policies are not working as you expect, then you should check if your VM instance's credentials are correct, including if they specify the correct project:

  • To see if data is arriving in Stackdriver Monitoring, try to read some of the time series data. For instructions, see Verifying the agent-to-project connection. If you do see data, then the problem is not with the agent.

  • If you are using a Google Compute Engine VM instance with standard (not private-key) credentials, then it is unlikely that data is going to the wrong project, but your credentials might still be deficient. For information about credentials, see Authorizing the agent. To verify your credentials, see Verifying Compute Engine credentials.

  • If you are using an Amazon EC2 VM instance, or if you are using private-key credentials on your Google Compute Engine instance, then the credentials could be invalid or they could be from the wrong project. For AWS accounts, the project used by the agent must be the AWS connector project, typically named "AWS Link...". For information about credentials, see Authorizing the agent. To verify your credentials, see Verifying private-key credentials.

If you still have not resolved your problem, see Reinstalling the agent.

Verifying the agent data

To verify that the agent is sending metrics correctly, use the timeseries.list method of the Stackdriver Monitoring API to look for recent time series data from the VM instance. You can call the method using the APIs Explorer form at the bottom of the method's documentation page. If you do not see any data, it may be that the agent is sending data to the wrong project. To check that, see Verifying project and credentials.

Here are detailed instructions for using the timeseries.list method:

  1. Determine the instance ID of the VM instance where you installed the agent:

    • Compute Engine: Go to Compute Engine's detail page for your instance. At the bottom of the page, click Equivalent REST. The ID is a 19-digit number.

    • Amazon EC2: The ID for each instance is shown in the list of instances. The ID looks like i-1a2b3c4d.

  2. Go to the documentation page for the timeseries.list method:

    Open the timeseries.list page

  3. In the Try it! section, click the switch Authorize requests using OAuth 2.0. Accept the form without changes and click Authorize.

  4. Fill out the APIs Explorer form:

    1. Set name to the project containing your VM instance, prefixed by projects/. For example, projects/[YOUR_PROJECT_ID]. For Amazon EC2 instances, you must use the AWS connector project for your Amazon account, which is typically has a name beginning with "AWS Link".

    2. Set filter to the following line to choose an agent metric from your VM instance. Copy and paste it into the APIs Explorer, and then change the VM instance ID:

      metric.type = "agent.googleapis.com/memory/bytes_used" AND resource.label.instance_id = "[YOUR-VM-INSTANCE-ID]"
      
    3. Set the search time interval. You want approximately a five-minute interval:

      • Set interval.endTime to the current GMT time, which you can find at time.is/GMT. The time must be formatted like the following example. Do not enclose the time in quotation marks:

        2016-10-31T14:10:00Z
        
      • Set interval.startTime to approximately five minutes before the end time, using the same format.

    4. Leave all the other fields blank.

  5. Click Execute.

You should see output like the following:

{
 "timeSeries": [
  {
   "metric": {
    "labels": {
     "state": "buffered"
    },
    "type": "agent.googleapis.com/memory/bytes_used"
   },
   "resource": {
    "type": "[GCE-OR-EC2-INSTANCE-TYPE]",
    "labels": {
     "instance_id": "[YOUR-VM-INSTANCE-ID]",
     "zone": "[YOUR-INSTANCE-ZONE]",
     "project_id": "[YOUR-PROJECT-ID]"
    }
   },
   "metricKind": "GAUGE",
   "valueType": "DOUBLE",
   "points": [
    {
     "interval": {
      "startTime": "[START_TIME]",
      "endTime": "[END_TIME]"
     },
     "value": {
      "doubleValue": 27451392
     }
    },
    ...

If the API call returns any time series data from your VM instance, as shown above, then your agent is working properly and you are finished.

If you do not see any time series data, check the following:

  • If your API call results in an error message, this does not indicate an agent problem. Check that the APIs Explorer fields are filled properly. Check the spelling and format of the project ID, filter, and the two time stamps. "Not authorized" errors can mean you misspelled the project ID. "Not found" errors can indicate that you've omitted the required projects/ prefix in the "name" field. Fix the problems and try the API call again.

  • If the API call succeeds but you see only an empty response, { }, then check that your filter and time interval are correct. Errors in formatting the timestamps can result in no data being returned. If everything seems correct but you are getting no data, then the agent is not sending metric data, or at least not to the project you are expecting it to. This might indicate a credentials problem; see Verifying private-key credentials.

Reinstalling the agent

Installing the most recent version of the agent can solve many problems:

Send feedback about...

Stackdriver Monitoring