awslabs / collectd-cloudwatch

A collectd plugin for sending data to Amazon CloudWatch
MIT License
200 stars 132 forks source link

Non-interactive setup #47

Closed kkrynitski closed 7 years ago

kkrynitski commented 7 years ago

First, I want to say thank you guys, for that cool and very useful plugin. But for my needs (I suppose not only for my) I need non-interactive setup, cause that plugin is a part of debian package. So let me introduse setup, with non-interactive feature. So the work is not fully done. The purpose of the PR is to show way how I see it to be done, and to confirm that not only I intrested in such feature. Thank you for your attension.

Examples:

1.) sudo ./setup.py -i inteactive mode, with EC2 metadata as defaults if possible (region, hostname, IAM) 2.) sudo ./setup.py -i -r -H intercactive mode, with overrading region and hostname 3.) sudo ./setup.py -i -a -s interactive mode, with IAM user 4.) sudo ./setup -i -a -s -P interactive mode, with IAM user and custom aws credentials path

yimuniao commented 7 years ago

Please confirm this contribution is under the terms of the MIT license.

kkrynitski commented 7 years ago

'-d' argument is not working now, it not designed for change in the final configuration file "/opt/collectd-plugins/cloudwatch/config/plugin.conf cause it was not in original setup. It will be something like that:


        logger.info('-=**********DEBUG**********=-')
        logger.info('PUSH ASG: {}'.format(self.config.push_asg))
        logger.info('PUSH CONSTANT: {}'.format(self.config.push_constant))
        logger.info('CONSTANT DIMENSION VALUE: {}'.format(self.config.constant_dimension_value))
        logger.info('CREDENTIALS PATH: {}'.format(self.config.credentials_path))
        logger.info('SECRET KEY: {}'.format(self.config.secret_key))
        logger.info('ACCESS KEY: {}'.format(self.config.access_key))
        logger.info('HOST: {}'.format(self.config.host))
        logger.info('PROXY NAME: {}'.format(self.config.proxy_server_name))
        logger.info('PROXY PORT: {}'.format(self.config.proxy_server_port))
        logger.info('CREDENTIALS PATH: {}'.format(self.config.credentials_path))
        logger.info('METHOD ONLY ADD PLUGIN: {}'.format(self.config.only_add_plugin))
        logger.info('USE RECOMMENDED CONFIG: {}'.format(self.config.use_recommended_collectd_config))
        logger.info('REGION: {}'.format(self.config.region)) ```
kkrynitski commented 7 years ago

I confirm that this contribution is under the terms of the MIT license.

kkrynitski commented 7 years ago

@yimuniao About '-d', now I see that you mean:

# The debug parameter enables verbose logging of published metrics
debug = "False"

Will check, how it drives from setup.py.

kkrynitski commented 7 years ago

Hi, so I've add some more functional and unittests (it's not cover everything, unfortunately have no time to work more on unittests), please check and accept PR if everything fine. Thank you.

yimuniao commented 7 years ago

Yes, Thanks a lot for this patch. I am applying for merging.

yimuniao commented 7 years ago

Merge request was approved. But a new feature merged already, and two more new parameter need to add for Non-interactive. one is enable_high_resolution_metrics, the other is flush_interval_in_seconds = 60 . Could you help merge it?

dgouldin commented 7 years ago

I've resolved the merge conflicts and added non-interactive args for enable_high_resolution_metrics and flush_interval_in_seconds in my fork: https://github.com/dgouldin/collectd-cloudwatch/tree/non_interactive_setup

All tests pass, but I've not done any manual testing so caveat emptor.

My fork is MIT licensed.

yimuniao commented 7 years ago

Thanks for your response. But looks like there is still conflict. The "Merge pull request" button is disabled.

yimuniao commented 7 years ago

I create a new pull request from your repo, https://github.com/awslabs/collectd-cloudwatch/pull/52

Is that ok for you?

dgouldin commented 7 years ago

That's fine.

yimuniao commented 7 years ago

Hi dgouldin,

Two comments for your codes. please check https://github.com/awslabs/collectd-cloudwatch/pull/52 Please fix it. I want to merge the codes as soon as possible.

Thanks Liang