• 8

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Stackdriver Extractor fails

I'm trying to get stackdriver working with GCE. I went through the standard instructions to install (executing --write-gcm), however it doesn't seem to work at all. When I add monitoring alerts to watch processes, I get:

Process monitoring not available for this instance

In /var/log/messages I see:

Mar 28 19:47:59 myhost stackdriver-agent: which: no java in (/root/.gvm/bin:/usr/local/sbin:/sbin
Mar 28 19:47:59 myhost stackdriver-agent: Starting stackdriver-collectd: option = PIDFile; value 
= /var/run/;
Mar 28 19:47:59 myhost stackdriver-agent: option = Interval; value = 60.000000;
Mar 28 19:47:59 myhost stackdriver-agent: Created new plugin context.
Mar 28 19:47:59 myhost stackdriver-agent: [  OK  ]
Mar 28 19:47:59 myhost collectd[1934]: Initialization complete, entering read-loop.
Mar 28 19:47:59 myhost systemd: Started LSB: start and stop Stackdriver Agent.
Mar 28 19:47:59 myhost collectd[1934]: match_throttle_metadata_keys: 1 history entries, 1 distinc
t keys, 71 bytes server memory.
Mar 28 19:47:59 myhost collectd[1934]: tcpconns plugin: Reading from netlink succeeded. Will use 
the netlink method from now on.
Mar 28 19:47:59 myhost collectd[1934]: write_gcm: Asking metadata server for auth token

I have verified that the service is enabled. When I check the permissions, it says I don't need to need special credentials since I am using GCE. However, when I restart the stackdriver-extractor service, I get:

Please set STACKDRIVER_API_KEY in /etc/sysconfig/stackdriver

And so if I set that... I get:

stackdriver-extractor[3020]: Starting stackdriver-extractor: Unable to determine extractor endpoint! 
stackdriver-extractor[3020]: Unable to generate config file

I feel like something is wrong at the project level where this service is not getting the key information automatically like it is supposed to.

I dug into the scripts and found where it gets it...

curl -f -H "Metadata-Flavor: Google"

But this is getting a 404.

Also, when I check the scopes:

# curl --silent -f -H "Metadata-Flavor: Google"

Any ideas? My ultimate problem is that I can't create alerts on the process counts, but I think this is where Stackdriver gets it from.

      • 2
    • @Faizan At first I thought this fixed it when I rebuilt my VM, but it didn't. What actually fixed this is... modifying the /etc/sysconfig/stackdriver file, adding in the STACKDRIVER_API_KEY WITH double quotes. I accidentally remove the double quotes apparently.
    • I'm glad to know your issue is resolved. Can you post your resolution as an answer so that I can benefit other users with the similar issue.
      • 1
    • Will do, and thanks for the reply. I see now the order of events that I did that messed things up. I'll document it. It all started with my messing up the COPY/PASTE of my API key.

To fix this problem, I fixed the API key. I accidentally left out the double quotes when I edited the file.

That brings me to the next point. Why did I edit the file? They provide a nice easy utility for adding an API key. We should use it.

/opt/stackdriver/stack-config --api-key DEADBEEFDEADBEEFDEADBEEFDEADBEEF...

It will even restart the services for you.

As for how I got to this place to begin with... I accidentally copy/pasted a partial API key. It wasn't obvious because I missed a little bit at the end. Little bits matter.

As for why I could not get this working by changing the scope to all API access, I don't know. I thought that would work as I really don't want to have to mess around with any more statefulness in my VM disk than I have to. But I'll take a working solution at this point.

One final bit of advice... if you are here, you might need to also find your API key. You can find it here:

If one isn't there, you can create it.

Good luck!

  • 4
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags