'collectd is reporting "Request is missing Authentication Token" when trying to post the metrics to AWS cloudwatch by custom collectd plugin

I am new to collectd and AWS cloud watching. Created custom plugin using C++ and installed rpms for collectd and collectd plugin.

enter image description here

customd plugin (.so) is located in /opt/collectd/plugin_libs after installing collectd plugin rpm.

Below is the snippet in collectd.conf related to the plugin

PluginDir "/opt/collectd/plugin_libs"
LoadPlugin "plugin"

<Plugin plugin>
    default_name_space "SS"
    max_posts_per_second 5
    max_queue_size 100000
    post_cw true
    write_log true
    log_filename "/tmp/cd_metrics.csv"
 </Plugin>

When collectd is trying to post the metrics to AWS cloud watch, we are getting the error "Request is missing Authentication Token".

I am thinking some how we need to point the collectd to look in to some file for AWS credentials. I have the credentials but I am not sure in which file I need to place those credentials and how to inform the collectd to use that file for aws credentials.

Is my understanding correct? Can some one please help me to fix this issue.



Solution 1:[1]

If you're using the SDK then take a look here for how credentials are looked up: https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/credentials.html

If you're not using the SDK, then update the question with the actual code that does the API call.

Also, CloudWatch provides a collectd plugin. Maybe that could be of use to you: https://github.com/awslabs/collectd-cloudwatch

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dejan Peretin