Compare commits
11 Commits
9dd3d4fe96
...
1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| aa83361a8e | |||
| c2149834d3 | |||
| 5db2481d76 | |||
| eefd846f7c | |||
| 63e1012ff3 | |||
| 8317e78bef | |||
| f883424e26 | |||
| eab95a5b54 | |||
| 96211f2eb5 | |||
| 4217cb39d1 | |||
| 7972cfd5ad |
@@ -37,7 +37,6 @@ Then you can use Grafana itself to visualize those logs and metrics and built an
|
|||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
- installs alloy binaries
|
- installs alloy binaries
|
||||||
- installs node exporter (optional, set `ay_manage_ne`to `true`)
|
|
||||||
|
|
||||||
CONFIGURATION
|
CONFIGURATION
|
||||||
|
|
||||||
@@ -45,6 +44,7 @@ CONFIGURATION
|
|||||||
- manages the main alloy pipeline for loki and prometheus
|
- manages the main alloy pipeline for loki and prometheus
|
||||||
- manages log rotation for rsyslog to allow adm membership
|
- manages log rotation for rsyslog to allow adm membership
|
||||||
- manage service
|
- manage service
|
||||||
|
- optional: include nagios target for the alloy service (set `ay_manage_nagios`to `true`)
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
@@ -54,6 +54,8 @@ See the full Puppet documentation including parameters in `docs/index.html`
|
|||||||
|
|
||||||
All dependencies must be included in the catalogue.
|
All dependencies must be included in the catalogue.
|
||||||
|
|
||||||
|
- [confdroid_nagios](https://sourcecode.confdroid.com/confdroid/confdroid_nagios) if nagios monitoring is desired
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
- native Puppet deployment
|
- native Puppet deployment
|
||||||
|
|||||||
@@ -7,4 +7,8 @@ class confdroid_alloy::main::config (
|
|||||||
|
|
||||||
) inherits confdroid_alloy::params {
|
) inherits confdroid_alloy::params {
|
||||||
include confdroid_alloy::main::service
|
include confdroid_alloy::main::service
|
||||||
|
|
||||||
|
if $ay_manage_nagios == true {
|
||||||
|
include confdroid_alloy::monitoring::target
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
manifests/monitoring/target.pp
Normal file
23
manifests/monitoring/target.pp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
## confdroid_alloy::monitoring::target.pp
|
||||||
|
# Module name: confdroid_alloy
|
||||||
|
# Author: 12ww1160 (12ww1160@puppetsoft.com)
|
||||||
|
# @summary class manages exports for nagios monitoring
|
||||||
|
##############################################################################
|
||||||
|
class confdroid_alloy::monitoring::target (
|
||||||
|
|
||||||
|
) inherits confdroid_alloy::params {
|
||||||
|
if $ay_manage_nagios == true {
|
||||||
|
@@nagios_service { "check_alloy_${fqdn}":
|
||||||
|
check_command => "check_nrpe!check_alloy!${ay_procs_allowed}!alloy",
|
||||||
|
use => 'generic-service',
|
||||||
|
host_name => $fqdn,
|
||||||
|
notification_period => '24x7',
|
||||||
|
service_description => "${fqdn}_check_alloy",
|
||||||
|
target => $ay_target_service,
|
||||||
|
owner => 'nagios',
|
||||||
|
group => 'nagios',
|
||||||
|
mode => '0640',
|
||||||
|
contacts => $ay_target_contacts,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,32 +8,52 @@
|
|||||||
# @param [String] ay_loki_userpass the password to logon to loki
|
# @param [String] ay_loki_userpass the password to logon to loki
|
||||||
# @param [Boolean] ay_manage_loki whether to manage log forwarding to loki
|
# @param [Boolean] ay_manage_loki whether to manage log forwarding to loki
|
||||||
# @param [Boolean] ay_manage_prom whether to manage metric forwarding
|
# @param [Boolean] ay_manage_prom whether to manage metric forwarding
|
||||||
# @param [Boolean] ay_manage_ne whether to manage metric forwarding for
|
|
||||||
# the node exporter (external)
|
|
||||||
# @param [String] ay_prom_url the url where alloy will send metrics
|
# @param [String] ay_prom_url the url where alloy will send metrics
|
||||||
# @param [Array] ay_log_targets the logging targets
|
# @param [Array] ay_log_targets the logging targets
|
||||||
|
# @param [Boolean] ay_prom_honor_timestamps whether to honor
|
||||||
|
# timestamps in prometheus metrics
|
||||||
|
# @param [Boolean] ay_prom_track_timestamps_staleness whether to track timestamps
|
||||||
|
# staleness in prometheus metrics
|
||||||
|
# @param [String] ay_prom_max_shards the maximum number of shards to use for prometheus metrics
|
||||||
|
# @param [String] ay_prom_max_samples_per_send the maximum number of samples to send
|
||||||
|
# @param [String] ay_prom_batch_send_deadline the maximum time to wait before sending
|
||||||
|
# @param [Boolean] ay_manage_nagios whether to manage nagios service exports
|
||||||
|
# @param [String] ay_target_service the target file for nagios service exports
|
||||||
|
# @param [Array] ay_target_contacts the contacts for nagios service exports
|
||||||
|
# @param [String] ay_procs_allowed the allowed number of processes for nagios service exports
|
||||||
# @summary Class contains all parameters for the confdroid_alloy module.
|
# @summary Class contains all parameters for the confdroid_alloy module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class confdroid_alloy::params (
|
class confdroid_alloy::params (
|
||||||
|
|
||||||
String $ay_reqpackages = 'alloy',
|
String $ay_reqpackages = 'alloy',
|
||||||
String $ay_pkg_ensure = 'latest',
|
String $ay_pkg_ensure = 'latest',
|
||||||
|
|
||||||
# loki
|
# loki
|
||||||
Boolean $ay_manage_loki = true,
|
Boolean $ay_manage_loki = true,
|
||||||
String $ay_loki_url = 'https://loki.example.net/loki/api/v1/push',
|
String $ay_loki_url = 'https://loki.example.net/loki/api/v1/push',
|
||||||
String $ay_loki_username = 'loki_user',
|
String $ay_loki_username = 'loki_user',
|
||||||
String $ay_loki_userpass = 'loki_pass',
|
String $ay_loki_userpass = 'loki_pass',
|
||||||
Array $ay_log_targets = ['/var/log/messages','/var/log/secure',],
|
Array $ay_log_targets = ['/var/log/messages','/var/log/secure',],
|
||||||
|
|
||||||
# prometheus
|
# prometheus
|
||||||
Boolean $ay_manage_prom = true,
|
Boolean $ay_manage_prom = true,
|
||||||
String $ay_prom_url = 'https://prometheus.example.net/api/v1/write',
|
String $ay_prom_url = 'https://prometheus.example.net/api/v1/write',
|
||||||
|
Boolean $ay_prom_honor_timestamps = true,
|
||||||
|
Boolean $ay_prom_track_timestamps_staleness = true,
|
||||||
|
String $ay_prom_max_shards = '10',
|
||||||
|
String $ay_prom_max_samples_per_send = '2000',
|
||||||
|
String $ay_prom_batch_send_deadline = '5s',
|
||||||
|
|
||||||
# node exporter (external)
|
# nagios
|
||||||
Boolean $ay_manage_ne = false,
|
Boolean $ay_manage_nagios = false,
|
||||||
|
String $ay_target_service = '/etc/nagios/conf.d/alloy_service.cfg',
|
||||||
|
Array $ay_target_contacts = ['nagiosadmin'],
|
||||||
|
String $ay_procs_allowed = '1:1'
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
# defaults
|
||||||
|
$fqdn = $facts['networking']['fqdn']
|
||||||
|
|
||||||
# service
|
# service
|
||||||
$ay_service = 'alloy'
|
$ay_service = 'alloy'
|
||||||
|
|
||||||
|
|||||||
@@ -65,29 +65,40 @@ discovery.relabel "node_exporter" {
|
|||||||
|
|
||||||
rule {
|
rule {
|
||||||
target_label = "instance"
|
target_label = "instance"
|
||||||
replacement = constants.hostname // <-- this is the key
|
replacement = constants.hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
rule {
|
rule {
|
||||||
target_label = "job"
|
target_label = "job"
|
||||||
replacement = "integrations/node_exporter" // or whatever job name you prefer
|
replacement = "integrations/node_exporter"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Scrape the properly labeled targets
|
// 3. Scrape the properly labeled targets
|
||||||
prometheus.scrape "node_exporter" {
|
prometheus.scrape "node_exporter" {
|
||||||
targets = discovery.relabel.node_exporter.output
|
targets = discovery.relabel.node_exporter.output
|
||||||
forward_to = [prometheus.remote_write.prometheus.receiver]
|
forward_to = [prometheus.remote_write.prometheus.receiver]
|
||||||
scrape_interval = "15s"
|
scrape_interval = "15s"
|
||||||
|
honor_timestamps = <%= @ay_prom_honor_timestamps %>
|
||||||
|
track_timestamps_staleness = <%= @ay_prom_track_timestamps_staleness %>
|
||||||
}
|
}
|
||||||
|
|
||||||
prometheus.remote_write "prometheus" {
|
prometheus.remote_write "prometheus" {
|
||||||
|
external_labels = {
|
||||||
|
// makes every series from this Alloy unmistakably unique
|
||||||
|
alloy_instance = constants.hostname,
|
||||||
|
}
|
||||||
endpoint {
|
endpoint {
|
||||||
url = "<%= @ay_prom_url %>"
|
url = "<%= @ay_prom_url %>"
|
||||||
basic_auth {
|
basic_auth {
|
||||||
username = "<%= @ay_loki_username %>"
|
username = "<%= @ay_loki_username %>"
|
||||||
password = "<%= @ay_loki_userpass %>"
|
password = "<%= @ay_loki_userpass %>"
|
||||||
}
|
}
|
||||||
|
queue_config {
|
||||||
|
max_shards = <%= @ay_prom_max_shards %>
|
||||||
|
max_samples_per_send = <%= @ay_prom_max_samples_per_send %>
|
||||||
|
batch_send_deadline = "<%= @ay_prom_batch_send_deadline %>"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<% end %>
|
<% end %>
|
||||||
Reference in New Issue
Block a user