VMware Modern Apps Community
AbhishekSK
Hot Shot
Hot Shot
Jump to solution

Unauthorized access using Ruby wavefront client

Tried using Ruby wavefront client (GitHub - wavefrontHQ/ruby-client: Ruby client for working with Wavefront ) to make the requests to wavefront. Following is the piece of code we are using. Have modified the token and the query here in the example. The request in the ruby code fails with 401 error : unauthorized access. But the same works fine with the curl get request.

Ruby code :

TOKEN ='3654000b-b9a4-46b8-94a0-0258b826fa25'

wave = Wavefront::Client.new(TOKEN)

response = wave.query('sum(rate(ts(~collector.points.valid)))', 'm', {tart_time => Time.now - 86400, :end_time => Time.now})

Curl :

curl -G "https://intuit.wavefront.com/chart/api?&s=1470153631&e=1470240031&g=s&i=false&strict=true" -H 'X-AUTH-TOKEN: 3654000b-b9a4-46b8-94a0-0258b826fa25' --data-urlencode 'q=sum(rate(ts(~collector.points.valid)))'

0 Kudos
1 Solution

Accepted Solutions
AbhishekSK
Hot Shot
Hot Shot
Jump to solution

Hi Samata,

The Wavefront Client initializer takes up to 3 parameters:

  • token - A valid Wavefront API Token. This is required.
  • host - A String representing the Wavefront endpoint to connect to. Default: metrics.wavefront.com.
  • debug true|false - When set to true output RestClient debugging to stdout. Default: false.

Looks like you are passing Token and so the default host is set to metrics.wavefront.com (which is our multi - tenant instance) . As Intuit has its own dedicated VPN instance you would need to pass host=intuit.wavefront.com

Can you try updating your code to below

TOKEN ='3654000b-b9a4-46b8-94a0-0258b826fa25'

HOST = 'intuit.wavefront.com'

wave = Wavefront::Client.new(TOKEN,HOST)

Please let me know if this fixes things.

Thanks,

Salil D

View solution in original post

0 Kudos
2 Replies
AbhishekSK
Hot Shot
Hot Shot
Jump to solution

Had missed on specifying the host. Works fine!

0 Kudos
AbhishekSK
Hot Shot
Hot Shot
Jump to solution

Hi Samata,

The Wavefront Client initializer takes up to 3 parameters:

  • token - A valid Wavefront API Token. This is required.
  • host - A String representing the Wavefront endpoint to connect to. Default: metrics.wavefront.com.
  • debug true|false - When set to true output RestClient debugging to stdout. Default: false.

Looks like you are passing Token and so the default host is set to metrics.wavefront.com (which is our multi - tenant instance) . As Intuit has its own dedicated VPN instance you would need to pass host=intuit.wavefront.com

Can you try updating your code to below

TOKEN ='3654000b-b9a4-46b8-94a0-0258b826fa25'

HOST = 'intuit.wavefront.com'

wave = Wavefront::Client.new(TOKEN,HOST)

Please let me know if this fixes things.

Thanks,

Salil D

0 Kudos