Skip to content

Commit

Permalink
Merge pull request #470 from kkunkel/master
Browse files Browse the repository at this point in the history
Issue 469: Add dellhw_exporter support
  • Loading branch information
bastelfreak authored Jun 28, 2020
2 parents 5c5673a + 99a3831 commit 8457c1b
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 3 deletions.
247 changes: 244 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _Public Classes_
* [`prometheus::collectd_exporter`](#prometheuscollectd_exporter): This module manages prometheus node collectd_exporter
* [`prometheus::config`](#prometheusconfig): Configuration class for prometheus monitoring system
* [`prometheus::consul_exporter`](#prometheusconsul_exporter): This module manages prometheus node consul_exporter
* [`prometheus::dellhw_exporter`](#prometheusdellhw_exporter): This module manages prometheus dellhw_exporter
* [`prometheus::elasticsearch_exporter`](#prometheuselasticsearch_exporter): This module manages prometheus elasticsearch_exporter
* [`prometheus::graphite_exporter`](#prometheusgraphite_exporter): This module manages prometheus node graphite_exporter
* [`prometheus::haproxy_exporter`](#prometheushaproxy_exporter): This module manages prometheus haproxy_exporter
Expand Down Expand Up @@ -59,9 +60,9 @@ This can be used to make prometheus find instances of your running service or ap

**Data types**

* [`Prometheus::Initstyle`](#prometheusinitstyle):
* [`Prometheus::S3Uri`](#prometheuss3uri):
* [`Prometheus::Uri`](#prometheusuri):
* [`Prometheus::Initstyle`](#prometheusinitstyle):
* [`Prometheus::S3Uri`](#prometheuss3uri):
* [`Prometheus::Uri`](#prometheusuri):

## Classes

Expand Down Expand Up @@ -2354,6 +2355,246 @@ Data type: `Optional[Hash]`



Default value: `undef`

### prometheus::dellhw_exporter

This module manages prometheus dellhw_exporter

#### Parameters

The following parameters are available in the `prometheus::dellhw_exporter` class.

##### `arch`

Data type: `String[1]`

Architecture (amd64 or i386)

Default value: $prometheus::real_arch

##### `bin_dir`

Data type: `String`

Directory where binaries are located

Default value: $prometheus::bin_dir

##### `download_extension`

Data type: `String`

Extension for the release binary archive

Default value: 'tar.gz'

##### `download_url`

Data type: `Optional[String]`

Complete URL corresponding to the where the release binary archive can be downloaded

Default value: `undef`

##### `download_url_base`

Data type: `String`

Base URL for the binary archive

Default value: 'https://github.com/galexrt/dellhw_exporter/releases'

##### `extra_groups`

Data type: `Array[String]`

Extra groups to add the binary user to

Default value: []

##### `extra_options`

Data type: `String`

Extra options added to the startup command

Default value: ''

##### `group`

Data type: `String`

Group under which the binary is running

Default value: 'dellhw-exporter'

##### `init_style`

Data type: `Prometheus::Initstyle`

Service startup scripts style (e.g. rc, upstart or systemd)

Default value: $facts['service_provider']

##### `install_method`

Data type: `String`

Installation method: url or package (only url is supported currently)

Default value: $prometheus::install_method

##### `manage_group`

Data type: `Boolean`

Whether to create a group for or rely on external code for that

Default value: `true`

##### `manage_service`

Data type: `Boolean`

Should puppet manage the service? (default true)

Default value: `true`

##### `manage_user`

Data type: `Boolean`

Whether to create user or rely on external code for that

Default value: `true`

##### `os`

Data type: `String[1]`

Operating system (linux is the only one supported)

Default value: downcase($facts['kernel'])

##### `package_ensure`

Data type: `String`

If package, then use this for package ensure default 'latest'

Default value: 'present'

##### `package_name`

Data type: `String[1]`

The binary package name - not available yet

Default value: 'dellhw_exporter'

##### `purge_config_dir`

Data type: `Boolean`

Purge config files no longer generated by Puppet

Default value: `true`

##### `restart_on_change`

Data type: `Boolean`

Should puppet restart the service on configuration change? (default true)

Default value: `true`

##### `service_enable`

Data type: `Boolean`

Whether to enable the service from puppet (default true)

Default value: `true`

##### `service_ensure`

Data type: `Stdlib::Ensure::Service`

State ensured for the service (default 'running')

Default value: 'running'

##### `service_name`

Data type: `String[1]`

Name of the dellhw exporter service (default 'dellhw_exporter')

Default value: 'dellhw_exporter'

##### `user`

Data type: `String`

User which runs the service

Default value: 'dellhw-exporter'

##### `version`

Data type: `String`

The binary release version

Default value: '1.6.0'

##### `omreport_path`

Data type: `Stdlib::Unixpath`

The file path to the omReport executable

Default value: '/opt/dell/srvadmin/bin/omreport'

##### `export_scrape_job`

Data type: `Boolean`



Default value: `false`

##### `scrape_port`

Data type: `Stdlib::Port`



Default value: 9137

##### `scrape_job_name`

Data type: `String[1]`



Default value: 'dellhw'

##### `scrape_job_labels`

Data type: `Optional[Hash]`



Default value: `undef`

##### `bin_name`

Data type: `String[1]`



Default value: `undef`

### prometheus::elasticsearch_exporter
Expand Down
122 changes: 122 additions & 0 deletions manifests/dellhw_exporter.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# @summary This module manages prometheus node dellhw_exporter
# @param arch
# Architecture (amd64 or i386)
# @param bin_dir
# Directory where binaries are located
# @param download_extension
# Extension for the release binary archive
# @param download_url
# Complete URL corresponding to the where the release binary archive can be downloaded
# @param download_url_base
# Base URL for the binary archive
# @param extra_groups
# Extra groups to add the binary user to
# @param extra_options
# Extra options added to the startup command
# @param group
# Group under which the binary is running
# @param init_style
# Service startup scripts style (e.g. rc, upstart or systemd)
# @param install_method
# Installation method: url or package (only url is supported currently)
# @param manage_group
# Whether to create a group for or rely on external code for that
# @param manage_service
# Should puppet manage the service? (default true)
# @param manage_user
# Whether to create user or rely on external code for that
# @param os
# Operating system (linux is the only one supported)
# @param package_ensure
# If package, then use this for package ensure default 'latest'
# @param package_name
# The binary package name - not available yet
# @param purge_config_dir
# Purge config files no longer generated by Puppet
# @param restart_on_change
# Should puppet restart the service on configuration change? (default true)
# @param service_enable
# Whether to enable the service from puppet (default true)
# @param service_ensure
# State ensured for the service (default 'running')
# @param service_name
# Name of the dellhw exporter service (default 'dellhw_exporter')
# @param user
# User which runs the service
# @param version
# The binary release version
# @param omreport_path
# The file path to the omReport executable (default "/opt/dell/srvadmin/bin/omreport")
class prometheus::dellhw_exporter (
String[1] $download_extension = 'tar.gz',
String[1] $download_url_base = 'https://github.com/galexrt/dellhw-exporter/releases',
Array[String] $extra_groups = [],
String[1] $group = 'dellhw-exporter',
String[1] $package_ensure = 'present',
String[1] $package_name = 'dellhw_exporter',
String[1] $user = 'dellhw-exporter',
String[1] $version = '1.6.0',
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
String[1] $service_name = 'dellhw_exporter',
Prometheus::Initstyle $init_style = $facts['service_provider'],
String[1] $install_method = $prometheus::install_method,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String[1] $os = downcase($facts['kernel']),
String $extra_options = '',
Optional[String] $download_url = undef,
String[1] $arch = $prometheus::real_arch,
String[1] $bin_dir = $prometheus::bin_dir,
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9137,
String[1] $scrape_job_name = 'dellhw',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
Stdlib::Unixpath $omreport_path = '/opt/dell/srvadmin/bin/omreport',
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/dellhw_exporter-${version}.${os}-${arch}.${download_extension}")

$notify_service = $restart_on_change ? {
true => Service[$service_name],
default => undef,
}

$real_omreport_path = "--collectors-omreport=${omreport_path}"
$real_scrape_port = "--web-listen-address=${scrape_port}"
$options = join([$extra_options, $real_omreport_path, $real_scrape_port], ' ')

prometheus::daemon { $service_name:
install_method => $install_method,
version => $version,
download_extension => $download_extension,
os => $os,
arch => $arch,
real_download_url => $real_download_url,
bin_dir => $bin_dir,
notify_service => $notify_service,
package_name => $package_name,
package_ensure => $package_ensure,
manage_user => $manage_user,
user => $user,
extra_groups => $extra_groups,
group => $group,
manage_group => $manage_group,
purge => $purge_config_dir,
options => $options,
init_style => $init_style,
service_ensure => $service_ensure,
service_enable => $service_enable,
manage_service => $manage_service,
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
archive_bin_path => "/opt/dellhw_exporter-${version}.${os}-${arch}/dellhw_exporter",
}
}
Loading

0 comments on commit 8457c1b

Please sign in to comment.