-
-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate Alertmanager config #277
Conversation
Install the amtool and validate alertmanager config file prior changes.
Fixed lint and require parameter
Fixed require parameter and cleaned all lint warnings. |
Uses bin_dir instead of prometheus::server::bin_dir
manifests/alertmanager.pp
Outdated
content => template('prometheus/alertmanager.yaml.erb'), | ||
notify => $notify_service, | ||
require => File["${bin_dir}/amtool", $config_dir], | ||
validate_cmd => "${bin_dir}/amtool check-config --alertmanager.url='' %", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if this works for different versions of the alertmanager? Can you provide an acceptance test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing a quick check on Alertmanager Github page, the amtool command was implemented in version 0.10.0. I could implement a "versioncmp" to make sure to do the validation check if the version is equal or grater than 0.10.0. This works for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
Check Alertmanager version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that I've introduced an old behaviour in the "notify" parameter. Let me correct it.
Nothing left from my part. |
@allangood can you add an acceptance test for this? |
Never did it before, I will do my best using "prometheus_server_spec.rb" as template. |
Ping @allangood :) |
Sorry about this long silence... I started to work with something else and completely forgot to commit this code. |
Acceptance test for Alertmanager
Alertmanager acceptance test via class
Well, looks like I need some guidance with the acceptance test! Someone could give me a hand? |
spec/acceptance/alertmanager_spec.rb
Outdated
|
||
describe 'prometheus alertmanager' do | ||
it 'alertmanager works idempotently with no errors' do | ||
pp = "class { 'prometheus::alertmanager': }" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous style was correct, you can undo the last commit.
Hi. The test itself works. Puppet creates the service |
Thanks for all the work @allangood |
Wow! It's working now! I had to include some configuration to Alertmanager, the default "include prometheus::alermanager" is not enough. Sorry for the amount of commits. :) |
* Validate Alertmanager config Install the amtool and validate alertmanager config file prior changes. * Fixed lint and require parameter Fixed lint and require parameter * Removed trailing whitespace * Uses bind_dir Uses bin_dir instead of prometheus::server::bin_dir * Update alertmanager.pp Check Alertmanager version. * Identation corrected * Corrected notify service * Acceptance test for Alertmanager Acceptance test for Alertmanager * Alertmanager acceptance test via class Alertmanager acceptance test via class * Using my tested config for Alertmanager * Minimal configuration for Alertmanager * Fixed syntax, added missing closing braces * Removed IPv4 configuration to allow IPv6 test
* Validate Alertmanager config Install the amtool and validate alertmanager config file prior changes. * Fixed lint and require parameter Fixed lint and require parameter * Removed trailing whitespace * Uses bind_dir Uses bin_dir instead of prometheus::server::bin_dir * Update alertmanager.pp Check Alertmanager version. * Identation corrected * Corrected notify service * Acceptance test for Alertmanager Acceptance test for Alertmanager * Alertmanager acceptance test via class Alertmanager acceptance test via class * Using my tested config for Alertmanager * Minimal configuration for Alertmanager * Fixed syntax, added missing closing braces * Removed IPv4 configuration to allow IPv6 test
Install the amtool and validate alertmanager config file prior changes.
Pull Request (PR) description
Validate Alertmanager config file prior changes
This Pull Request (PR) fixes the following issues
Alertmanager has a validation tool but it's not installed nor used by this modules until now.