-
-
Notifications
You must be signed in to change notification settings - Fork 251
node_exporter: create module for textfile scraping #881
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
base: master
Are you sure you want to change the base?
Conversation
| Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef, | ||
| Stdlib::Absolutepath $web_config_file = '/etc/node_exporter_web-config.yml', | ||
| Prometheus::Web_config $web_config_content = {}, | ||
| Optional[String] $textfile_directory = undef, |
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.
Maybe Stdlib::Absolutepath is a better choice?
templates/update_metrics.sh.epp
Outdated
| @@ -0,0 +1,11 @@ | |||
| <% | | |||
| Optional[Hash] $metrics = {}, | |||
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.
Why the optional here?
|
Can you please tell me a bit about the benefit this brings? Where do the metrics put in the class param actually come from ? If its from hiera this seems like an unnecessary extra step. Why do you need one file per key? I've been using textfile collectors for quite some time, usually each collector gathers its own data and dumps it into its own file. What is the benefit of passing that through puppet? Not a big fan of shell-scripts with templating. IMHO any kind of executable should be static an consume a templated confgi/data file. |
templates/cleanup_metrics.sh.epp
Outdated
| @@ -0,0 +1,20 @@ | |||
| <% | | |||
| Optional[Hash] $metrics = {}, | |||
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.
Why optional here?
manifests/node_exporter_textfile.pp
Outdated
| class prometheus::node_exporter_textfile ( | ||
| String $update_script_location = '/usr/local/bin/update_metrics.sh', | ||
| String $cleanup_script_location = '/usr/local/bin/cleanup_metrics.sh', | ||
| Hash $metrics = {}, |
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.
Maybe better Hash[String[1],String[1]] ?
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 hash looks like
metrics = {
"metric_name": {
"command": "cat whatever"
"static": false
}
}
So I'd assume a type such as Hash[String[1], Hash[String[1], Variant[String[1], Boolean]]] would be better?
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.
Right... so a custom type might be in order ;)
manifests/node_exporter_textfile.pp
Outdated
| user => $user, | ||
| } | ||
|
|
||
| if $prometheus::server::init_style == 'systemd' { |
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.
Textfile test
|
Just fixed many of the concerns from earlier, mainly making it configuration-based and making the script static. |
Pull Request (PR) description
This PR creates a module that manages a script responsible for generating
.promfiles, which can be used with the node_exporter textfile collector. Currently, it supports systemd, but it can easily be modified to use a cron job for machines running other init systems. This PR also updates the node_exporter module to allow configuration of the textfile collectors directory without usingcollectors_enable.This Pull Request (PR) fixes the following issues
n/a