JSON Data Telegraf InfluxDB httpjson Error

Hi,

I want to add some data in Influxdb via Telegraf. My input data is XML data, but, I can get it in JSON format with “accept: application/json” header. When I try adding the accept header it gives me a parsing error.

Also, I am getting: 40Z E! ERROR in input [inputs.httpjson]: Get https://x.x.x.x/suite-api/api/resources: x509: cannot validate certificate for x.x.x.x because it doesn’t contain any IP SANs. No luck.

I tried to make some changes in SSL config as per ubuntu - Failed tls handshake. Does not contain any IP SANs - Server Fault

Please let me know how to tackle these issues? Also, let me know if you need more information.

Thanks.

This means your certificate is not valid for connecting by IP address. You either need to create a cert for the address, or connect via the hostname specified in the cert.

Hi Daniel,

Thank you for getting back to me.

I am passing the URL as http://x.x.x.x/suite-api/api/resources and not as “https”, still the error shows it as “Get https://x.x.x.x/suite-api/api/resources: x509: cannot validate certificate for x.x.x.x because it doesn’t contain any IP SANs”. Can you please confirm if Telegraf expects it to be “https” always?

Thanks.

It supports normal http, any chance your server is using tls on port 80? Double check that curl "http://x.x.x.x/suite-api/api/resources" works.

Just wanted to update that the issue is on our side. We need to generate a certificate and apply it to both client and server. Thanks Daniel.

Hi Daniel, can you please confirm how Telegraf deals with wildcards? What I mean is, I generated a certificate at server end at a URL location (abc.com) and “Common Name” (xyz, inc) and saved the certificate at client’s end as well.

When I hit the URL location abc.com, I get a new error: certificate is valid for xyz, inc., not abc.com

Telegraf should support wildcards, we are using the standard Go tls package to handle certificates. Normally a cert would have a Subject Alternative Name with the wildcard domain, does your cert have this and is it what you expect? You might want to try testing with curl to ensure you have your certificate setup correctly.

hi

interested in sending json to influxdb via telegraf by using https, please direct me.