Google Cloud Platform : Stackdriver Agent installation and Condiguration error on GCP VM instance

3.7k views Asked by At

I dont have hands on experience on stackdriver monitoring configuration for google cloud platform VM instances monitoring. our basic monitoring for our project works fine but while trying to install stackdriver agent in Ubuntu 14.04 OS it gives us error and stack driver with agent does not works for us. below is the error for your reference.

Jan 3 10:43:42 ubuntu-uat01 collectd[2283]: write_gcm: Unsuccessful HTTP request 403: {#012 "error": {#012 "code": 403,#012
"message": "User is not authorized to access the project monitoring records.",#012 "status": "PERMISSION_DENIED"#012 }#012} Jan 3 10:43:42 ubuntu-uat01 collectd[2283]: write_gcm: Error -2 from wg_curl_get_or_post Jan 3 10:43:42 ubuntu-uat01 collectd[2283]: write_gcm: wg_transmit_unique_segment failed.

Can someone help me in setting up stackdriver monitoring with Agent installed on server or provide me some documentation link if any available.

3

There are 3 answers

2
Rondo On

I got this precise error on my instances until I added the permission 'Monitoring Metric Writer' to the service account.

You could also, as Igor suggested, add the monitoring api scope to the instance See the StackDriver Monitoring docs

0
Pouya Naghizadeh On

If you are installing StackDriver monitoring and logging agent on your instance, you need to make sure attached service-account to your instance has proper rights to edit/write data to StackDriver. Simply run following commands to assign proper roles:

gcloud projects add-iam-policy-binding PROJECT_NAME --member="serviceAccount:SERVICE_ACCOUNT_EMAIL" --role="roles/logging.logWriter"

gcloud projects add-iam-policy-binding PROJECT_NAME --member="serviceAccount:SERVICE_ACCOUNT_EMAIL" --role="roles/monitoring.metricWriter"

replace PROJECT_NAME and SERVICE_ACCOUNT_EMAIL with proper values from your environment.

0
Igor Peshansky On

Most likely you either don't have the Stackdriver Monitoring API enabled in your project, or your VM does not have the correct scopes. There are extensive instructions on the Google Cloud site for installing the agent, including the troubleshooting page.